[libvirt] [test-API 07/17] Substitute _guest with _domain

Osier Yang jyang at redhat.com
Fri Apr 20 06:46:13 UTC 2012


---
 .../en-US/Creating_a_configuration_file.xml        |   82 ++++++++++----------
 .../en-US/Writing_a_test_case.xml                  |   24 +++---
 .../libvirt-test-API_Guide/en-US/extras/log.txt    |   18 ++--
 repos/domain/domain_list.py                        |   12 ++--
 repos/domain/install_linux_cdrom.py                |   18 ++--
 repos/domain/install_linux_net.py                  |    8 +-
 repos/domain/install_windows_cdrom.py              |    6 +-
 repos/domain/update_devflag.py                     |    6 +-
 8 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
index 80ebdb1..ffac187 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
@@ -90,7 +90,7 @@ module:test_case
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-Domain:install_guest
+Domain:install_domain
     guestname
         rhel5u4
     memory
@@ -105,7 +105,7 @@ Domain:install_guest
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}]
 ]
 </programlisting>
       </example>
@@ -119,7 +119,7 @@ Domain:install_guest
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-Domain:install_guest
+Domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -136,9 +136,9 @@ Domain:install_guest
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}]
 ]
 </programlisting>
       </example>
@@ -152,7 +152,7 @@ Domain:install_guest
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
     memory
@@ -171,7 +171,7 @@ storage:initialize_storage
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
 ]
 </programlisting>
       </example>
@@ -185,7 +185,7 @@ storage:initialize_storage
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -206,9 +206,9 @@ storage:initialize_storage
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
 ]
 </programlisting>
       </example>
@@ -222,7 +222,7 @@ storage:initialize_storage
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -232,7 +232,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
          rhel5u4 only rhel5u4
          rhel5u3 only rhel5u3
@@ -245,9 +245,9 @@ domain:shutdown_guest
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u3'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u2'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u3'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u2'}}]
 ]
 </programlisting>
       </example>
@@ -261,7 +261,7 @@ domain:shutdown_guest
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -271,7 +271,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
          rhel5u4 no rhel5u2|rhel5u3
          rhel5u3 no rhel5u2|rhel5u4
@@ -284,9 +284,9 @@ domain:shutdown_guest
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u3'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u2'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u3'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u2'}}]
 ]
 </programlisting>
       </example>
@@ -300,7 +300,7 @@ domain:shutdown_guest
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -310,7 +310,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
         rhel5u4 no
         rhel5u3 only rhel5u3
@@ -323,9 +323,9 @@ domain:shutdown_guest
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u3'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u3'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}]
 ]
 </programlisting>
       </example>
@@ -339,7 +339,7 @@ domain:shutdown_guest
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
         rhel5u3
@@ -349,7 +349,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
         rhel5u4 no
         rhel5u3 only rhel5u3
@@ -367,9 +367,9 @@ shutdowndomain
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'shutdowndomain': {'domainname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u3'}}, {'shutdowndomain': {'domainname': 'rhel5u3'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'shutdowndomain': {'domainname': 'rhel5u2'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'shutdowndomain': {'domainname': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u3'}}, {'shutdowndomain': {'domainname': 'rhel5u3'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': '1'}}, {'shutdowndomain': {'domainname': 'rhel5u2'}}]
 ]
 </programlisting>
       </example>
@@ -383,7 +383,7 @@ shutdowndomain
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest times 2
+domain:install_domain times 2
     guestname
         rhel5u4
     memory
@@ -398,7 +398,7 @@ domain:install_guest times 2
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}]
 ]
 </programlisting>
       </example>
@@ -412,7 +412,7 @@ domain:install_guest times 2
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
     memory
@@ -420,7 +420,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
         rhel5u4
 
@@ -433,9 +433,9 @@ options times 2
 	      <title>List data structure</title>
 <programlisting>
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': '1'}}, {'domain:shutdown_domain': {'guestname': 'rhel5u4'}}]
 ]
 </programlisting>
       </example>
@@ -449,7 +449,7 @@ options times 2
 	    <example>
 	      <title>Configuration file</title>
 <programlisting>
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
     memory
@@ -457,7 +457,7 @@ domain:install_guest
     vcpu
         1
 
-domain:shutdown_guest
+domain:shutdown_domain
     guestname
         rhel5u4
 
diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index b36c660..64eb308 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -16,7 +16,7 @@
 	  <para><application>Filename</application></para>
 	  <blockquote>
 	    <para>The name of the test case file must be the same as the name of the main function inside it.</para>
-	    <para>For example, if the main function is <application>install_guest()</application>, then test case file must be named <filename>install_guest.py</filename>.</para>
+	    <para>For example, if the main function is <application>install_domain()</application>, then test case file must be named <filename>install_domain.py</filename>.</para>
 	    <para>Save the test case to its corresponding directory in <filename>/repos</filename>. For example, if the test case is related to domain then save the file in the <filename>/repos/domain</filename> directory.</para>
 	  </blockquote>
 
@@ -42,23 +42,23 @@
     <example>
       <title>Test case file</title>
 <programlisting>
-#  install_guest.py
+#  install_domain.py
 import time
 import sys
 import os
 
-def install_guest(dict):
+def install_domain(dict):
     logger = dict['logger']
     print "this is from testcase_repos:domain"
     for eachvargs in dict.keys():
         logger.info("the argu is %s" % eachvargs)
         time.sleep(1)
         logger.info("the corresponding value is %s" % dict[eachvargs])
-    logger.info("I am from install_guest log info")
-    logger.debug("I am from install_guest log debug")
-    logger.warning("I am from install_guest log warning")
-    logger.error("I am from install_guest log error")
-    logger.critical("I am from install_guest log critical")
+    logger.info("I am from install_domain log info")
+    logger.debug("I am from install_domain log debug")
+    logger.warning("I am from install_domain log warning")
+    logger.error("I am from install_domain log error")
+    logger.critical("I am from install_domain log critical")
     return 0
 </programlisting>
     </example>
@@ -86,7 +86,7 @@ def install_guest(dict):
       </listitem>
       <listitem>
         <para>Install the guest on the volume.</para>
-        <para>The install test case is called 'domain_install' and is located in <filename>/repos/domain/install_guest.py</filename></para>
+        <para>The install test case is called 'domain_install' and is located in <filename>/repos/domain/install_domain.py</filename></para>
       </listitem>
     </orderedlist>
     <para>The two test case are independent of each other, which allows the test cases to be re-used and combined with other test cases to create different test runs.</para>
@@ -105,7 +105,7 @@ storage:initialize_storage
     volformat
          raw
 
-domain:install_guest
+domain:install_domain
     guestname
         rhel5u4
     virt_type
@@ -180,7 +180,7 @@ def initialize_storage(dict):
     </example>
 
     <example>
-      <title>Install guest test case <filename>/repos/domain/install_guest.py</filename></title>
+      <title>Install guest test case <filename>/repos/domain/install_domain.py</filename></title>
 <programlisting>
 #!/usr/bin/env python
 
@@ -229,7 +229,7 @@ def prepare_cdrom(*args):
         logger.debug(text)
     os.chdir(src_path)
 
-def install_guest(dict):
+def install_domain(dict):
     logger = dict['logger']
     gname = dict['guestname']
     dict['ifacetype'] = 'bridge'
diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/extras/log.txt b/docs/User_Guide/libvirt-test-API_Guide/en-US/extras/log.txt
index 682aa6b..210e57c 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/extras/log.txt
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/extras/log.txt
@@ -16,16 +16,16 @@
 -------------   initialize_storage pass   -------------
 
 
-------------------   install_guest   ------------------
-[2009-09-18 15:38:50] 5141 INFO     (install_guest:55) get system environment information 
-[2009-09-18 15:38:50] 5141 DEBUG    (install_guest:59) install source: 
+------------------   install_domain   ------------------
+[2009-09-18 15:38:50] 5141 INFO     (install_domain:55) get system environment information 
+[2009-09-18 15:38:50] 5141 DEBUG    (install_domain:59) install source: 
     http://download.redhat.com/pub/rhel/rel-eng/RHEL5.4-Server-latest/tree-x86_64 
-[2009-09-18 15:38:50] 5141 DEBUG    (install_guest:60) kisckstart file: 
+[2009-09-18 15:38:50] 5141 DEBUG    (install_domain:60) kisckstart file: 
     http://10.00.00.01/ks-rhel-5.4-x86_64-noxen-smp-minimal.cfg 
-[2009-09-18 15:38:50] 5141 INFO     (install_guest:62) prepare installation booting cdrom 
-[2009-09-18 15:39:01] 5141 DEBUG    (install_guest:67) dump installation guest xml: 
+[2009-09-18 15:38:50] 5141 INFO     (install_domain:62) prepare installation booting cdrom 
+[2009-09-18 15:39:01] 5141 DEBUG    (install_domain:67) dump installation guest xml: 
 <?xml version="1.0" ?> 
 <domain type="xen"><name>rhel5u4</name><memory>1048576</memory><vcpu>1</vcpu><os><type>hvm</type><loader>/usr/lib/xen/boot/hvmloader</loader><boot dev="cdrom"/></os><features><acpi/><apic/><pae/></features><clock offset="utc"/><on_poweroff>destroy</on_poweroff><on_reboot>restart</on_reboot><on_crash>restart</on_crash><devices><emulator>/usr/lib64/xen/bin/qemu-dm</emulator><disk device="disk" type="file"><driver name="file"/><source file="/var/lib/xen/images/rhel5u4.img"/><target bus="ide" dev="hda"/></disk><disk device="cdrom" type="file"><driver name="file"/><source file="/tmp/rhel5u4/custom.iso"/><target bus="ide" dev="hdc"/><readonly/></disk><interface type="bridge"><source bridge="xenbr0"/><script path="vif-bridge"/></interface><console/><input bus="ps2" type="mouse"/><graphics keymap="en-us" port="-1" type="vnc"/></devices></domain> 
-[2009-09-18 15:39:01] 5141 INFO     (install_guest:71) define guest from xml description 
-[2009-09-18 15:39:01] 5141 INFO     (install_guest:74) start installation guest ... 
-[2009-09-18 15:39:02] 5141 DEBUG    (install_guest:78) current guest state: running 
+[2009-09-18 15:39:01] 5141 INFO     (install_domain:71) define guest from xml description 
+[2009-09-18 15:39:01] 5141 INFO     (install_domain:74) start installation guest ... 
+[2009-09-18 15:39:02] 5141 DEBUG    (install_domain:78) current guest state: running 
diff --git a/repos/domain/domain_list.py b/repos/domain/domain_list.py
index 0250723..a9cd8a7 100644
--- a/repos/domain/domain_list.py
+++ b/repos/domain/domain_list.py
@@ -70,7 +70,7 @@ def check_inactive_option(logger):
         logger.error(ret)
         return 1
 
-    inactive_guest = []
+    inactive_domain = []
 
     for entry in entries:
         if not entry.endswith('.xml'):
@@ -80,13 +80,13 @@ def check_inactive_option(logger):
                 continue
             else:
                 guest = entry[:-4]
-                inactive_guest.append(guest)
+                inactive_domain.append(guest)
 
     inactive_output = ret.split('\n')
     if inactive_output[0] == '':
         inactive_output = []
 
-    if sorted(inactive_guest) != sorted(inactive_output):
+    if sorted(inactive_domain) != sorted(inactive_output):
         logger.error("virsh list --inactive error")
         return 1
 
@@ -103,19 +103,19 @@ def check_default_option(logger):
         logger.error(ret)
         return 1
 
-    running_guest = []
+    running_domain = []
     for entry in running_dir_entries:
         if not entry.endswith('.xml'):
             continue
         else:
             guest = entry[:-4]
-            running_guest.append(guest)
+            running_domain.append(guest)
 
     active_output = ret.split('\n')
     if active_output[0] == '':
         active_output = []
 
-    if sorted(running_guest) != sorted(active_output):
+    if sorted(running_domain) != sorted(active_output):
         logger.error("virsh list error")
         return 1
 
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 8ff43e3..26f6557 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -82,7 +82,7 @@ def prepare_cdrom(*args):
                 src_path)
     os.chdir(src_path)
 
-def prepare_boot_guest(domobj, dict, logger, installtype):
+def prepare_boot_domain(domobj, dict, logger, installtype):
     """ After guest installation is over, undefine the guest with
         bootting off cdrom, to define the guest to boot off harddisk.
     """
@@ -131,21 +131,21 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
 
 def check_domain_state(conn, guestname, logger):
     """ if a guest with the same name exists, remove it """
-    running_guests = []
+    running_domains = []
     ids = conn.listDomainsID()
     for id in ids:
         obj = conn.lookupByID(id)
-        running_guests.append(obj.name())
+        running_domains.append(obj.name())
 
-    if guestname in running_guests:
+    if guestname in running_domains:
         logger.info("A guest with the same name %s is running!" % guestname)
         logger.info("destroy it...")
         domobj = conn.lookupByName(guestname)
         domobj.destroy()
 
-    defined_guests = conn.listDefinedDomains()
+    defined_domains = conn.listDefinedDomains()
 
-    if guestname in defined_guests:
+    if guestname in defined_domains:
         logger.info("undefine the guest with the same name %s" % guestname)
         domobj = conn.lookupByName(guestname)
         domobj.undefine()
@@ -301,7 +301,7 @@ def install_linux_cdrom(params):
             if(state == libvirt.VIR_DOMAIN_SHUTOFF):
                 logger.info("guest installaton of define type is complete.")
                 logger.info("boot guest vm off harddisk")
-                ret  = prepare_boot_guest(domobj, params, logger, installtype)
+                ret  = prepare_boot_domain(domobj, params, logger, installtype)
                 if ret:
                     logger.info("booting guest vm off harddisk failed")
                     return 1
@@ -319,7 +319,7 @@ def install_linux_cdrom(params):
             if guestname not in domain_names:
                 logger.info("guest installation of create type is complete.")
                 logger.info("define the vm and boot it up")
-                ret = prepare_boot_guest(domobj, params, logger, installtype)
+                ret = prepare_boot_domain(domobj, params, logger, installtype)
                 if ret:
                     logger.info("booting guest vm off harddisk failed")
                     return 1
@@ -334,7 +334,7 @@ def install_linux_cdrom(params):
             "guest installaton will be destoryed forcelly for rhel3u9 guest")
             domobj.destroy()
             logger.info("boot guest vm off harddisk")
-            ret =  prepare_boot_guest(domobj, params, logger, installtype)
+            ret =  prepare_boot_domain(domobj, params, logger, installtype)
             if ret:
                 logger.info("booting guest vm off harddisk failed")
                 return 1
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index 795a465..1f6e656 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -39,7 +39,7 @@ VM_UNDEFINE = "virsh undefine %s"
 BOOT_DIR = "/var/lib/libvirt/boot/"
 HOME_PATH = os.getcwd()
 
-def prepare_boot_guest(domobj, dict, logger, installtype):
+def prepare_boot_domain(domobj, dict, logger, installtype):
     """After guest installation is over, undefine the guest with
        bootting off cdrom, to define the guest to boot off harddisk.
     """
@@ -286,7 +286,7 @@ def install_linux_net(params):
             interval += 10
 
         domobj.destroy()
-        ret =  prepare_boot_guest(domobj, params, logger, installtype)
+        ret =  prepare_boot_domain(domobj, params, logger, installtype)
 
         if ret:
             logger.info("booting guest vm off harddisk failed")
@@ -302,7 +302,7 @@ def install_linux_net(params):
                 if(state == libvirt.VIR_DOMAIN_SHUTOFF):
                     logger.info("guest installaton of define type is complete")
                     logger.info("boot guest vm off harddisk")
-                    ret  = prepare_boot_guest(domobj, params, logger, \
+                    ret  = prepare_boot_domain(domobj, params, logger, \
                                               installtype)
                     if ret:
                         logger.info("booting guest vm off harddisk failed")
@@ -321,7 +321,7 @@ def install_linux_net(params):
                 if guestname not in domain_names:
                     logger.info("guest installation of create type is complete")
                     logger.info("define the vm and boot it up")
-                    ret = prepare_boot_guest(domobj, params, logger, \
+                    ret = prepare_boot_domain(domobj, params, logger, \
                                              installtype)
                     if ret:
                         logger.info("booting guest vm off harddisk failed")
diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
index 775875f..15f553f 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -144,7 +144,7 @@ def prepare_floppy_image(guestname, guestos, guestarch,
 
     return 0
 
-def prepare_boot_guest(domobj, dict, installtype):
+def prepare_boot_domain(domobj, dict, installtype):
     """ After guest installation is over, undefine the guest with
         bootting off cdrom, to define the guest to boot off harddisk.
     """
@@ -329,7 +329,7 @@ def install_windows_cdrom(params):
             if(state == libvirt.VIR_DOMAIN_SHUTOFF):
                 logger.info("guest installaton of define type is complete.")
                 logger.info("boot guest vm off harddisk")
-                ret  = prepare_boot_guest(domobj, params, installtype)
+                ret  = prepare_boot_domain(domobj, params, installtype)
                 if ret:
                     logger.info("booting guest vm off harddisk failed")
                     return 1
@@ -347,7 +347,7 @@ def install_windows_cdrom(params):
             if guestname not in domain_names:
                 logger.info("guest installation of create type is complete.")
                 logger.info("define the vm and boot it up")
-                ret = prepare_boot_guest(domobj, params, installtype)
+                ret = prepare_boot_domain(domobj, params, installtype)
                 if ret:
                     logger.info("booting guest vm off harddisk failed")
                     return 1
diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
index 4706d6e..f1ecf32 100644
--- a/repos/domain/update_devflag.py
+++ b/repos/domain/update_devflag.py
@@ -77,7 +77,7 @@ def create_image(params, util, img_name):
 
     return True
 
-def check_device_in_guest(params, util, guestip):
+def check_device_in_domain(params, util, guestip):
     """Check updated device in guest"""
     logger = params['logger']
 
@@ -129,7 +129,7 @@ def check_updated_device(params, output, util, guestip, domobj, srcfile):
         elif diskTag.parentNode.getAttribute('device') == 'floppy':
             upfile = diskTag.getAttribute("file")
 
-    res = check_device_in_guest(params, util, guestip)
+    res = check_device_in_domain(params, util, guestip)
     if res[0] and cmp(res[1], output):
         if upfile == srcfile:
             logger.debug("checking fail.")
@@ -211,7 +211,7 @@ def update_devflag(params):
         return 1
 
     time.sleep(60)
-    ret, output = check_device_in_guest(params, util, guestip)
+    ret, output = check_device_in_domain(params, util, guestip)
     logger.debug(output)
     if not ret:
         return 1
-- 
1.7.7.3




More information about the libvir-list mailing list