+def TestInstanceModify(instance):
+ """gnt-instance modify"""
+ master = qa_config.GetMasterNode()
+
+ # Assume /sbin/init exists on all systems
+ test_kernel = "/sbin/init"
+ test_initrd = test_kernel
+
+ orig_memory = qa_config.get('mem')
+ orig_bridge = qa_config.get('bridge', 'xen-br0')
+ args = [
+ ["-B", "%s=128" % constants.BE_MEMORY],
+ ["-B", "%s=%s" % (constants.BE_MEMORY, orig_memory)],
+ ["-B", "%s=2" % constants.BE_VCPUS],
+ ["-B", "%s=1" % constants.BE_VCPUS],
+ ["-B", "%s=%s" % (constants.BE_VCPUS, constants.VALUE_DEFAULT)],
+
+ ["-H", "%s=%s" % (constants.HV_KERNEL_PATH, test_kernel)],
+ ["-H", "%s=%s" % (constants.HV_KERNEL_PATH, constants.VALUE_DEFAULT)],
+ ["-H", "%s=%s" % (constants.HV_INITRD_PATH, test_initrd)],
+ ["-H", "no_%s" % (constants.HV_INITRD_PATH, )],
+ ["-H", "%s=%s" % (constants.HV_INITRD_PATH, constants.VALUE_DEFAULT)],
+
+ # TODO: bridge tests
+ #["--bridge", "xen-br1"],
+ #["--bridge", orig_bridge],
+
+ # TODO: Do these tests only with xen-hvm
+ #["-H", "%s=acn" % constants.HV_BOOT_ORDER],
+ #["-H", "%s=%s" % (constants.HV_BOOT_ORDER, constants.VALUE_DEFAULT)],
+ ]
+ for alist in args:
+ cmd = ['gnt-instance', 'modify'] + alist + [instance['name']]
+ AssertEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+ # check no-modify
+ cmd = ['gnt-instance', 'modify', instance['name']]
+ AssertNotEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+