OpenVZ-legacy
  1. OpenVZ-legacy

pcs-nova-driver

Public
AuthorCommitMessageCommit dateIssues
Dmitry GuryanovDmitry Guryanov
72fc7ec2d51add more info to README file
Dmitry GuryanovDmitry Guryanov
100b59e89ccadd COPYING file
Dmitry GuryanovDmitry Guryanov
cb579040e69add README file
Dmitry GuryanovDmitry Guryanov
decb447b4faadd license information
Dmitry GuryanovDmitry Guryanov
71d4cd62db3don't use DHCP for network configuration by defaultSetting static IP configuration on interfaces is more reliable, than using DHCP. At least now DHCP doesn't work, if you set external gateway on router (because we don't have full namespaces support and DHCP replies are being SNAT'ed).
Dmitry GuryanovDmitry Guryanov
94d275d3ee4assume we always use neutron's firewallLet's forbid nova's firewall, since it doesn't work anyway (because we need to change devname in network_info into appropriate value vethXXX.X or vmeXXXX). Also let's always connect instances to integration bridge via intermediate linux bridge. Let's keep VifOvsEthernet class and all methods, which tune nova firewall. Maybe someone will need it later.
Dmitry GuryanovDmitry Guryanov
7a57c7eddf4add firewall class for neutronHere is how neutron with OVS works: br-int <pcsvoXXX>|--|<pcsvbXXX> pcsbrXXX <veth100.0>|---<eth0 in CT> First, we have integration bridge br-int and veth pair, one end of which is inside container, another one (veth100.0) - in host. We have to connect veth100.0 to bridge br-int. Also neutron need to setup security group rules between container and br-int. IptablesFirewallDriver class does it...
Dmitry GuryanovDmitry Guryanov
b6db6d5d1b7don't rename PCS's network devicesInstead of renaming PCS devices 'vethXXX.X' and 'vmeXXX' we can provide name to netutron's firewall driver with help of OVS's external_ids. So first, don't rename devices and second, add iface-name external id to OVS port (linux_net.create_ovs_vif_port can't do it, so add function pcs_create_ovs_vif_port).
Dmitry GuryanovDmitry Guryanov
d4d1f562147implement networking with help of prlsdkapiWe can't use vzctl for VMs, so it's needed to manage network in VEs using prlsdkapi. It's not possible to get device in host with given name using only prlsdkapi, so I use 2 hacks: 1. If you specify unexistent virtual network id, device will not be connected to any bridges, and VE will be started correctly. 2. Interface can be renamed if it's down. So all works exactly as before: we creat...
Dmitry GuryanovDmitry Guryanov
64e7fa205f2add format_mac functionMAC addresses can have different string formats. So we can't compare them as is. format_mac will convert MAC address to format XX:XX:XX:XX:XX:XX, so macs returned by this function could be compared.
Dmitry GuryanovDmitry Guryanov
e5ce38408bfimport prlsdkapi in vif.pySubsequent patches will use prlconsts, so import prlsdkapi and consts module. Exactly as in driver.py.
Dmitry GuryanovDmitry Guryanov
f612dbd0631pass prlsdkapi.Vm object to vif driverCreating Vm object by given uuid or name of the VE is relatively slow operation and should be avoided if possible. So let's pass Vm object to plug and unplug methods of vif driver. Consequent patches will need it.
Dmitry GuryanovDmitry Guryanov
06c510bb4e9call unplug_vifs before VE destroyunplug_vifs checks, if VE exists, so if we destroy it before, unplug_vifs will not be called.
Dmitry GuryanovDmitry Guryanov
162a057e9c8fix integer options in pcs-glance-tool--min-disk and --min-ram options has type int, so corresponding 'type' kerword argument should be given to @arg decorator.
Dmitry GuryanovDmitry Guryanov
3052022b9c4fix snapshot method for VMsadd VM support to snapshot method. We have to set disk_format to ploop-vm in this case. Snapshot for VMs can be created only if VM is powered off, because of limitation in prlsdkapi.
Dmitry GuryanovDmitry Guryanov
8075363ba31use disk_format to distinguish containers and VMsUse disk_format to distinguish containers and VMs instead of container_format. When we will add support of booting from volumes it will be easier to check, which virtualization type is supported by specific volume. ez templates support will be removed soon, so let's also use another disk_format for them.
Dmitry GuryanovDmitry Guryanov
bb2bd54a1e7fix pcs-glance-tool for VMsget_home_path works differently for VMs and containers, for containers it returns path to private area, but for VMs - path to cofnig file config.pvs.
Dmitry GuryanovDmitry Guryanov
a3bb84ea4f3add basic support of VMsAdd support of running VMs as openstack instances. You have to create image in glance with container format pcs-vm and then launch it, proper type of virtualization will be automatically selected. Netwokirng is not supported yet, because vzctl is used to configure network in container and that place have to be fixed before enabling networking in VMs.
Dmitry GuryanovDmitry Guryanov
84de6643c20change disk size correctlyChanging disk size is not a change in a config file, so it should be outsize of begin_edit/commit. Also this is an asynchronous operation and return job object, which have to be wait'ed.
Dmitry GuryanovDmitry Guryanov
f32376d89ffadd tool for creating glance images from PCS VEsAdd script pcs-glance-tool which creates glance images by given container or VM name. It's a sort of an extension to glance command, so it supports all common arguments, which are supported by glance and environment variables (like --os-auth-url, --os-tenant-id or OS_USERNAME env var). Example of usage: ./pcs-image-util.py --os-image-api-version 2 \ image-create my-container --name ne...
Dmitry GuryanovDmitry Guryanov
11b26a0ba74rename install-image.py to add-ez-image.pyI'll add another script for creating image from existing container or VM, which also will do 'install-image', so let's rename this one.
Dmitry GuryanovDmitry Guryanov
20a05efdaf0rename image container_format to pcs-containerI'm going to add support for VMs and they should have another container format since it's should be possible if we have to create container or VM from given image. Templates of both containers and VMs called 'golden image' in our terminology, so let's use container formats 'pcs-container' and 'pcs-vm'.
Dmitry GuryanovDmitry Guryanov
17bab21642arename pcs_golden_image_dir to pcs_template_dirRename configuration parameter pcs_golden_image_dir to pcs_template_dir.
Dmitry GuryanovDmitry Guryanov
28c5e72472arename PCSDriver._psrv to psrvThere is no need to have name of this variable starting with underscope, because all parts of the driver need to work with SDK and have to use prlsdkapi.Server object.
Dmitry GuryanovDmitry Guryanov
38c430c0be7pass link to virt driver to vif driverFurther patches will use parallels SDK, so prlsdkapi.Server is needed at least in vif driver classes.
Dmitry GuryanovDmitry Guryanov
a226ba273beimplement methods for firewall managementAdd a set of methods, which do different operations with firewall. In case of PCS driver they only call the same methods from nova's firewall driver.
Dmitry GuryanovDmitry Guryanov
eb3477471e8remove firewall rules after destroying instanceFirewall rules must be removed when we destroy an instance.
Dmitry GuryanovDmitry Guryanov
ea6fd9c367ffix bug with setting up VNCget_vnc_port method of Vm class doesn't requests new VNC port from server, it just returns a value, which was retrieved with get_vm_config SDK call (0, if VNC was disabled). So after setting up VNC we have to request new VM config from server.
Dmitry GuryanovDmitry Guryanov
a4c0d0be42bremove unneded function get_name from EzTemplate classDirect access to the name attribute is better inside class.
Dmitry GuryanovDmitry Guryanov
a4e96f9059badd helper function for sdk error codes conversionParallels SDK provides error codes in exceptions different from constants defined. Special function conv_error must be used to convert condtant to error code in python. So let's add helper function get_sdk_errcode.
Dmitry GuryanovDmitry Guryanov
70f50ebd789add support of spawning instances from snapshotsAdd ability to create an instance based on snapshot. GoldenImageTemplate is added for this purpose. get_template will return proper PCSTemplate object depending on container_type property of an image.
Dmitry GuryanovDmitry Guryanov
b339e139375remove network adapters from VE before saving imageWe don't need to store information about network adapters in snapshot. Moreover disk data is the only thing we need to store in snapshot, but it's not possible with parallels SDK to create container from existing disk. We will add new network adapters each time in spawn method. So snapshot method is a good place to clean network configuration.
Dmitry GuryanovDmitry Guryanov
05192a17e8edon't use image_ref and context attributes in EzTemplateimage_ref and context attributes was removed by previous patch, so don't use them anymore.
Dmitry GuryanovDmitry Guryanov
7f691ece73ddon't store unneded attributes in EzTemplate classcontext and image_ref are used only in __init__ in EzTemplate class. So no need to store them as attributes.
Dmitry GuryanovDmitry Guryanov
d39fdbaba65use special container types in glanceNow we have to different types of images in glance: ez templates and tarred containers. So we need to distinguish them. Let's use container types 'pcs-ez' and 'pcs-golden-image' for this purpose.
Dmitry GuryanovDmitry Guryanov
fd453d681ffrefactor code for implementing new template typeAbility to create instances from snapshot is needed, because now you can only create snapshot, but can't create a new instance from it. This paths does some preparation before implementing that functinality. * Make PCSTemplate base class and add EzTemplate class. * Move code for creating container to Template class (create_instance method) and add function get_template, which will select p...
Dmitry GuryanovDmitry Guryanov
b23c0b9432bimplement snapshot functionPCS support clone-to-template operation, which clones existing container to a container of special type. It, in turn, can be cloned later and the new container will be new auto-generated mac addresses on network adapter, new ID, new name, e.t.c. Image in glance is an array of data and metadata on form of key:value pairs. So we can't upload directory with container as-is. Let's use tar to conve...
Dmitry GuryanovDmitry Guryanov
335ac80b70bcall unplug_vifs before plug_vifs in power_onOpenstack thinks that power_off operation will not destroy network interfaces and VM still will be connected to virtual port. So all other drivers don't call unplug_vifs in power_off and plug_vifs in power_on. If we will not call unplug/plug_vifs - veth devices will be destroyed on container shutdown, but port in openvswitch will be left and when veth device will appear this port will not work...
rootDmitry Guryanovroot
08698adf8aedo set_ram_size together with set_resourcephyspages will not change if you set only PHYSPAGES parameter using ve.set_resource(PCR_PHYSPAGES, x). You also need to call set_ram_size.
Dmitry GuryanovDmitry Guryanov
30c4ffb2a9fapply flavor parameters to the containerTune number of cpus, memory, swap and root disk size. Since we create containers with vSwap memory model, memory and swap sizes simply map to the physpages and swappages container parameters. Containers are created with existing disk, so we have to do resize of the ploop disk after creating.
Dmitry GuryanovDmitry Guryanov
bd32855c603implement power_off/power_on operationsStop operation will shutdown container using ACPI, poweron - start it and connect veth device to the bridge.
Dmitry GuryanovDmitry Guryanov
760a35eef6eimplement get_vnc_console operationBy default VNC is not started for containers and VMs in PCS. So we have to enable it, if it's not done before. First call to this function will start VNC server, subsequent ones - only get VNC port and return it.
Dmitry GuryanovDmitry Guryanov
7f916abe2e4implement suspend/resume operationsThese operations calls corresponding functions from parallels SDK. Also resume operation calls plug_vifs to ensure, that instance is connected to network.
Dmitry GuryanovDmitry Guryanov
aa099eb1b78implement reboot operationImplement reboot operation. Now it only works if instance is started, so it has to be extended to all other possible states, because base ComputeDriver class requires it.
Dmitry GuryanovDmitry Guryanov
08d5c3551bekeep host_ifname of veth during dhcp configurationYou have to provide --host_ifname together with --ifname to command, which tunes veth parameters, or interface name in the host will be changed to default vethXXX.X.
Dmitry GuryanovDmitry Guryanov
f6ae8b9635avif: don't plug iface to bridge, if it already therenova calls plug_vifs after start, but if an instance already started - iface could be plugged into bridge. So we have to check, if we really need to plug interface into bridge.
Dmitry GuryanovDmitry Guryanov
3fb08213526add script for creating glance images from rpmsIt's very unconvenient to execute glance command with a lot of arguments to upload ez-template to glance. So add helper script, which will do all that work. Usage: ./utils/install-image.py <rpm file>
Dmitry GuryanovDmitry Guryanov
b6d042fbcc9create instances, based on images from glanceGlance will store rpm files of EZ templates. When you try to create an instance based on a image from glance, pcs driver will first retrieve info about rpm from glance: If the image has properties pcs_name, pcs_version and pcs_release - they will be used, if not - compute driver will download rpm and get name and version from an rpm file. If rpm is already installed and has the same or higher...
Dmitry GuryanovDmitry Guryanov
7c8620568b3initial commit