On 08/01/2012 06:17 AM, Yu Mingfei wrote:
This patch adds a testcase for rename.

*PLEASE DO NOT COMMENT*

Signed-off-by: Yu Mingfei <[email protected]>
---
  client/tests/libvirt/tests/virsh_rename_domain.py |   25
+++++++++++++++++++++
  client/virt/subtests.cfg.sample                   |    5 ++++
  2 files changed, 30 insertions(+), 0 deletions(-)
  create mode 100644 client/tests/libvirt/tests/virsh_rename_domain.py

diff --git a/client/tests/libvirt/tests/virsh_rename_domain.py
b/client/tests/libvirt/tests/virsh_rename_domain.py
new file mode 100644
index 0000000..2e65bad
--- /dev/null
+++ b/client/tests/libvirt/tests/virsh_rename_domain.py
@@ -0,0 +1,25 @@
+import logging
+from autotest.client.shared import utils, error
+from autotest.client.virt import libvirt_vm, libvirt_xml
+
+def run_virsh_rename_domain(test, params, env):
+    """
+    Rename a domain to different type.
+    """
+    vm_name = params.get("main_vm")
+    vm = env.get_vm(params["main_vm"])
+    new_name = params.get("new_name", "test")
+    logging.info("Test rename %s to %s.", vm_name, new_name)
+
+    libvirt_xml.vm_rename(vm_name, new_name)
+    vm.name = new_name
+    logging.info(vm.get_xml())
+    if vm.start():
+        logging.info("Start new guest %s succeed.", new_name)
+    vm.destroy()
+
+    libvirt_xml.vm_rename(new_name, vm_name)
+    vm.name = vm_name
+    logging.info(vm.get_xml())
+    if vm.start():
+        logging.info("Back up to old guest %s succeed.", vm_name)
diff --git a/client/virt/subtests.cfg.sample
b/client/virt/subtests.cfg.sample
index c2aca1f..faea04f 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -307,6 +307,11 @@ variants:
                  libvirtd = "off"
                  status_error = "yes"

+    - virsh_rename_domain:
+        type = virsh_rename_domain
+        new_name = "test"
+        start_vm = "no"
+
      - module_probe:
          type = module_probe
          # You can specify your own module list, though it is not
needed usually.
--
1.7.1


--
Best Regards
Yu Mingfei


This looks good as well, I'll give it a try then apply to next.

Thanks!

--
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to