Add 'lxd' to the list of recognized hypervisors

Currently its not possible to set the hypervisor_type on a
glance image to 'lxd' to ensure it gets targetted to the
right type of hypervisors as 'lxd' is not a recognised
hypervisor type.

Change-Id: I9607c2f062b5ae19480a92be313fd4e21aa43ca5
Closes-Bug: 1516652
This commit is contained in:
James Page 2015-11-16 15:03:50 +00:00
parent faa65c1aae
commit 050bc12059
5 changed files with 14 additions and 6 deletions

View File

@ -36,6 +36,7 @@ IRONIC = "ironic"
KQEMU = "kqemu"
KVM = "kvm"
LXC = "lxc"
LXD = "lxd"
OPENVZ = "openvz"
PARALLELS = "parallels"
VIRTUOZZO = "vz"
@ -58,6 +59,7 @@ ALL = (
KQEMU,
KVM,
LXC,
LXD,
OPENVZ,
PARALLELS,
PHYP,

View File

@ -23,7 +23,8 @@ from nova import utils
class HVSpec(base.NovaObject):
# Version 1.0: Initial version
# Version 1.1: Added 'vz' hypervisor
VERSION = '1.1'
# Version 1.2: Added 'lxd' hypervisor
VERSION = '1.2'
fields = {
'arch': fields.ArchitectureField(),

View File

@ -37,7 +37,8 @@ class ImageMeta(base.NovaObject):
# Version 1.5: ImageMetaProps version 1.5
# Version 1.6: ImageMetaProps version 1.6
# Version 1.7: ImageMetaProps version 1.7
VERSION = '1.7'
# Version 1.8: ImageMetaProps version 1.8
VERSION = '1.8'
# These are driven by what the image client API returns
# to Nova from Glance. This is defined in the glance
@ -134,7 +135,8 @@ class ImageMetaProps(base.NovaObject):
# Version 1.5: added os_admin_user field
# Version 1.6: Added 'lxc' and 'uml' enum types to DiskBusField
# Version 1.7: added img_config_drive field
VERSION = '1.7'
# Version 1.8: Added 'lxd' to hypervisor types
VERSION = '1.8'
def obj_make_compatible(self, primitive, target_version):
super(ImageMetaProps, self).obj_make_compatible(primitive,

View File

@ -28,6 +28,9 @@ class HvTypeTest(test.NoDBTestCase):
def test_valid_docker(self):
self.assertTrue(hv_type.is_valid("docker"))
def test_valid_lxd(self):
self.assertTrue(hv_type.is_valid("lxd"))
def test_valid_vz(self):
self.assertTrue(hv_type.is_valid(hv_type.VIRTUOZZO))

View File

@ -1185,9 +1185,9 @@ object_data = {
'FloatingIP': '1.10-52a67d52d85eb8b3f324a5b7935a335b',
'FloatingIPList': '1.11-7f2ba670714e1b7bab462ab3290f7159',
'HostMapping': '1.0-1a3390a696792a552ab7bd31a77ba9ac',
'HVSpec': '1.1-6b4f7c0f688cbd03e24142a44eb9010d',
'ImageMeta': '1.7-642d1b2eb3e880a367f37d72dd76162d',
'ImageMetaProps': '1.7-f12fc4cf3e25d616f69a66fb9d2a7aa6',
'HVSpec': '1.2-db672e73304da86139086d003f3977e7',
'ImageMeta': '1.8-642d1b2eb3e880a367f37d72dd76162d',
'ImageMetaProps': '1.8-a07a00bb829668f3bdccf8de03c128bb',
'Instance': '2.0-ff56804dce87d81d9a04834d4bd1e3d2',
'InstanceAction': '1.1-f9f293e526b66fca0d05c3b3a2d13914',
'InstanceActionEvent': '1.1-e56a64fa4710e43ef7af2ad9d6028b33',