From 050bc120594ffe865c3d823382afb56ea62f556e Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 16 Nov 2015 15:03:50 +0000 Subject: [PATCH] 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 --- nova/compute/hv_type.py | 2 ++ nova/objects/hv_spec.py | 3 ++- nova/objects/image_meta.py | 6 ++++-- nova/tests/unit/compute/test_hvtype.py | 3 +++ nova/tests/unit/objects/test_objects.py | 6 +++--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/nova/compute/hv_type.py b/nova/compute/hv_type.py index aaf8cc566e91..0840544e88b5 100644 --- a/nova/compute/hv_type.py +++ b/nova/compute/hv_type.py @@ -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, diff --git a/nova/objects/hv_spec.py b/nova/objects/hv_spec.py index 9e2a28b66817..0a0dc5cc6ebc 100644 --- a/nova/objects/hv_spec.py +++ b/nova/objects/hv_spec.py @@ -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(), diff --git a/nova/objects/image_meta.py b/nova/objects/image_meta.py index a12e2c0597f0..9d92b69a5ed4 100644 --- a/nova/objects/image_meta.py +++ b/nova/objects/image_meta.py @@ -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, diff --git a/nova/tests/unit/compute/test_hvtype.py b/nova/tests/unit/compute/test_hvtype.py index 10f246e6b2d4..3c0e84e1c11e 100644 --- a/nova/tests/unit/compute/test_hvtype.py +++ b/nova/tests/unit/compute/test_hvtype.py @@ -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)) diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py index 45401d5e6444..466810665f74 100644 --- a/nova/tests/unit/objects/test_objects.py +++ b/nova/tests/unit/objects/test_objects.py @@ -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',