Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Setup OpenStack with Virtuozzo 7

2,038 bytes added, 17:36, 20 January 2017
no edit summary
$ systemctl restart openstack-cinder-scheduler
$ systemctl restart openstack-cinder-volume
 
== How to create a new image ploop image ready to upload to Glance == <!--T:17-->
 
* Select os template. The following templates are possible: vzlinux-7, centos-7, ubuntu-16.04, ubuntu-14.04, debian-8.0, centos-6, debian-8.0-x86_64-minimal
 
$ ct=centos-7
 
* Create a new container based on necessary os distribution
 
$ prlctl create glance-$ct --vmtype ct --ostemplate $ct
 
* Set IP address and DNS to be able to connect to internet from the container
 
$ prlctl set glance-$ct --ipadd IPADDR --nameserver DNS_IPADDR
 
* Add additional network adapter
 
$ prlctl set glance-$ct --device-add net --network Bridged --dhcp on
 
* Start the container
 
$ prlctl start glance-$ct
 
* Install cloud-init packet
 
$ prlctl exec glance-$ct yum install cloud-init -y
 
* Remove the following modules from cloud.cfg
 
$ prlctl exec glance-$ct sed -i '/- growpart/d' /etc/cloud/cloud.cfg
$ prlctl exec glance-$ct sed -i '/- resizefs/d' /etc/cloud/cloud.cfg
 
* Prepare network scripts
 
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << _EOF
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
_EOF
 
* If you need more than one network adapters withing a container, make as many copies as you need
 
$ prlctl exec glance-$ct cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
$ prlctl exec glance-$ct sed -i '/eth0/eth1' /etc/sysconfig/network-scripts/ifcfg-eth1
 
* Perform some cleanup
 
$ rm -f /etc/sysconfig/network-scripts/ifcfg-venet0*
$ rm -f /etc/resolv.conf
 
* Stop the container
 
$ prlctl stop glance-$ct
 
* Create ploop disk and copy files
 
$ mkdir /tmp/ploop-$ct
$ ploop init -s 950M /tmp/ploop-$ct/$ct.hds
$ mkdir /tmp/ploop-$ct/dst
$ ploop mount -m /tmp/ploop-$ct/dst /tmp/ploop-$ct/DiskDescriptor.xml
$ prlctl mount glance-$ct
$ id=$(vzlist glance-$ct | awk ' NR>1 { print $1 }')
$ cp -Pr --preserve=all /vz/root/$id/* /tmp/ploop-$ct/dst/
$ prlctl umount glance-$ct
$ ploop umount -m /tmp/ploop-$ct/dst/
 
* Now the image tmp/ploop-$ct/$ct.hds is ready to be uploaded to Glance
== See also == <!--T:100-->
74
edits