summaryrefslogtreecommitdiff
path: root/nova/tests
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem@us.ibm.com>2017-01-03 17:27:40 -0500
committerMatt Riedemann <mriedem@us.ibm.com>2017-01-03 17:27:40 -0500
commit98d93196cddab435f7a258bc1ef8beca6a7e2004 (patch)
treea8986a3411ab7dff2466b75792d466137877c7d2 /nova/tests
parent12327ff595823ba38cfcea8ef6203f1f35140db4 (diff)
downloadnova-98d93196cddab435f7a258bc1ef8beca6a7e2004.tar.gz
Add 'disabled' to WatchdogAction field
Image property hw_watchdog_action can have a 'disabled' value which is actually defined in the glance metadefs so someone using Horizon might pick that. Also, it's the default behavior in the libvirt driver. However, if you try to create a server with that set the create fails in nova-api because the enum field didn't have 'disabled' as a valid value. This adds it, bumps the ImageMetaProps version and adds tests. Change-Id: I4cec3e8b8527b909cc60893db26732a19263220d Closes-Bug: #1633200
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/unit/objects/test_image_meta.py13
-rw-r--r--nova/tests/unit/objects/test_objects.py2
2 files changed, 14 insertions, 1 deletions
diff --git a/nova/tests/unit/objects/test_image_meta.py b/nova/tests/unit/objects/test_image_meta.py
index b672ea3fcd..ccbc62c239 100644
--- a/nova/tests/unit/objects/test_image_meta.py
+++ b/nova/tests/unit/objects/test_image_meta.py
@@ -16,6 +16,7 @@ import datetime
from nova import exception
from nova import objects
+from nova.objects import fields
from nova import test
@@ -294,6 +295,7 @@ class TestImageMetaProps(test.NoDBTestCase):
'os_secure_boot': 'required',
'hw_rescue_bus': 'ide',
'hw_rescue_device': 'disk',
+ 'hw_watchdog_action': fields.WatchdogAction.DISABLED,
}
obj = objects.ImageMetaProps(**props)
@@ -306,6 +308,17 @@ class TestImageMetaProps(test.NoDBTestCase):
self.assertRaises(exception.ObjectActionError,
obj.obj_to_primitive, '1.0')
+ def test_obj_make_compatible_watchdog_action_not_disabled(self):
+ """Tests that we don't pop the hw_watchdog_action if the value is not
+ 'disabled'.
+ """
+ obj = objects.ImageMetaProps(
+ hw_watchdog_action=fields.WatchdogAction.PAUSE)
+ primitive = obj.obj_to_primitive('1.0')
+ self.assertIn('hw_watchdog_action', primitive['nova_object.data'])
+ self.assertEqual(fields.WatchdogAction.PAUSE,
+ primitive['nova_object.data']['hw_watchdog_action'])
+
def test_set_os_secure_boot(self):
props = {'os_secure_boot': "required"}
secure_props = objects.ImageMetaProps.from_dict(props)
diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py
index aac62578f8..ff86dcc677 100644
--- a/nova/tests/unit/objects/test_objects.py
+++ b/nova/tests/unit/objects/test_objects.py
@@ -1095,7 +1095,7 @@ object_data = {
'HVSpec': '1.2-de06bcec472a2f04966b855a49c46b41',
'IDEDeviceBus': '1.0-29d4c9f27ac44197f01b6ac1b7e16502',
'ImageMeta': '1.8-642d1b2eb3e880a367f37d72dd76162d',
- 'ImageMetaProps': '1.15-89dcdd30b2ec5995a45c8da73c9e1eb9',
+ 'ImageMetaProps': '1.16-3e5ad8e86f2ea36e565702162acc3e65',
'Instance': '2.3-4f98ab23f4b0a25fabb1040c8f5edecc',
'InstanceAction': '1.1-f9f293e526b66fca0d05c3b3a2d13914',
'InstanceActionEvent': '1.1-e56a64fa4710e43ef7af2ad9d6028b33',