summaryrefslogtreecommitdiff
path: root/nova/tests/unit/objects/test_image_meta.py
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/unit/objects/test_image_meta.py
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/unit/objects/test_image_meta.py')
-rw-r--r--nova/tests/unit/objects/test_image_meta.py13
1 files changed, 13 insertions, 0 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)