[test-API 04/17] Substitute guest_ with domain_

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 repos/domain/attach_disk.py                        |    4 ++--
 repos/domain/attach_interface.py                   |    2 +-
 repos/domain/autostart.py                          |    4 ++--
 repos/domain/balloon_memory.py                     |    8 ++++----
 repos/domain/blkstats.py                           |    4 ++--
 repos/domain/cpu_topology.py                       |   12 ++++++------
 repos/domain/detach_disk.py                        |    4 ++--
 repos/domain/detach_interface.py                   |    4 ++--
 repos/domain/dump.py                               |   10 +++++-----
 repos/domain/ifstats.py                            |    4 ++--
 repos/domain/install_linux_cdrom.py                |    6 +++---
 repos/domain/install_linux_net.py                  |    6 +++---
 repos/domain/restore.py                            |   14 +++++++-------
 repos/domain/save.py                               |   16 ++++++++--------
 repos/domain/sched_params.py                       |    4 ++--
 .../multiple_thread_block_on_domain_create.py      |   16 ++++++++--------
 repos/snapshot/delete.py                           |    4 ++--
 repos/snapshot/snapshot_list.py                    |   16 ++++++++--------
 18 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/repos/domain/attach_disk.py b/repos/domain/attach_disk.py
index 4711ad1..f07b5bb 100644
--- a/repos/domain/attach_disk.py
+++ b/repos/domain/attach_disk.py
@@ -32,7 +32,7 @@ def create_image(name, size, logger):
     else:
         return False
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -76,7 +76,7 @@ def attach_disk(params):
     logger.debug("original disk number: %s" %disk_num1)
 
     if disktype == "virtio":
-        if check_guest_status(domobj):
+        if check_domain_status(domobj):
             pass
         else:
             domobj.create()
diff --git a/repos/domain/attach_interface.py b/repos/domain/attach_interface.py
index 4d605f9..ce4282a 100644
--- a/repos/domain/attach_interface.py
+++ b/repos/domain/attach_interface.py
@@ -15,7 +15,7 @@ from utils import xml_builder
 required_params = ('guestname', 'ifacetype', 'source',)
 optional_params = ('hdmodel',)
 
-def check_guest_status(guestname, domobj):
+def check_domain_status(guestname, domobj):
     """Check guest current status"""
     state = domobj.get_state(guestname)
     if state == "shutoff" or state == "shutdown":
diff --git a/repos/domain/autostart.py b/repos/domain/autostart.py
index da428c2..0b11022 100644
--- a/repos/domain/autostart.py
+++ b/repos/domain/autostart.py
@@ -13,7 +13,7 @@ from src import sharedmod
 required_params = ('guestname', 'autostart',)
 optional_params = ()
 
-def check_guest_autostart(*args):
+def check_domain_autostart(*args):
     """Check domain start automatically result, if setting domain is
        successful, guestname.xml will exist under
        /etc/libvirt/{hypervisor}/autostart/
@@ -59,7 +59,7 @@ def autostart(params):
 
     try:
         domobj.setAutostart(flag)
-        if check_guest_autostart(guestname, uri.split(":")[0], flag, logger):
+        if check_domain_autostart(guestname, uri.split(":")[0], flag, logger):
             logger.info("current %s autostart: %s" %
                         (guestname, domobj.autostart()))
             logger.info("executing autostart operation is successful")
diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
index fc7383c..642c1fa 100644
--- a/repos/domain/balloon_memory.py
+++ b/repos/domain/balloon_memory.py
@@ -64,7 +64,7 @@ def redefine_memory_size(domobj, domname, memsize):
 
     return doc.toxml()
 
-def guest_power_on(domobj, domname, mac):
+def domain_power_on(domobj, domname, mac):
     """ power on guest virtual machine"""
 
     try:
@@ -96,7 +96,7 @@ def guest_power_on(domobj, domname, mac):
 
     return 0
 
-def guest_power_off(domobj, domname):
+def domain_power_off(domobj, domname):
     """ power off guest virtual machine"""
 
     state = domobj.info()[0]
@@ -161,7 +161,7 @@ def balloon_memory(params):
                      power off it to set memory to maximum memory" %
                      domname)
         domobj = conn.lookupByName(domname)
-        ret = guest_power_off(domobj, domname)
+        ret = domain_power_off(domobj, domname)
         if ret:
             return 1
 
@@ -188,7 +188,7 @@ def balloon_memory(params):
         return 1
 
     logger.info("memory set is finished, boot up the guest %s " % domname)
-    ret = guest_power_on(domobj, domname, mac)
+    ret = domain_power_on(domobj, domname, mac)
     if ret:
         return 1
 
diff --git a/repos/domain/blkstats.py b/repos/domain/blkstats.py
index 31bd37f..24c4b85 100644
--- a/repos/domain/blkstats.py
+++ b/repos/domain/blkstats.py
@@ -14,7 +14,7 @@ from src import sharedmod
 required_params = ('guestname',)
 optional_params = ()
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -37,7 +37,7 @@ def blkstats(params):
     domobj = conn.lookupByName(guestname)
 
     # Check domain block status
-    if check_guest_status(domobj):
+    if check_domain_status(domobj):
         pass
     else:
         domobj.create()
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
index c3cc553..a463668 100644
--- a/repos/domain/cpu_topology.py
+++ b/repos/domain/cpu_topology.py
@@ -57,7 +57,7 @@ def add_cpu_xml(domobj, guestname, sockets, cores, threads, logger):
 
     return doc.toxml()
 
-def guest_undefine(domobj, logger):
+def domain_undefine(domobj, logger):
     """undefine original guest"""
     try:
         logger.info("undefine guest")
@@ -71,7 +71,7 @@ def guest_undefine(domobj, logger):
 
     return 0
 
-def guest_define(domobj, domxml, logger):
+def domain_define(domobj, domxml, logger):
     """define new guest xml"""
     try:
         logger.info("define guest")
@@ -86,7 +86,7 @@ def guest_define(domobj, domxml, logger):
 
     return 0
 
-def guest_start(domobj, guestname, util, logger):
+def domain_start(domobj, guestname, util, logger):
     """start guest"""
     timeout = 600
     ip = ''
@@ -184,13 +184,13 @@ def cpu_topology(params):
     domobj = conn.lookupByName(guestname)
     domxml = add_cpu_xml(domobj, guestname, sockets, cores, threads, logger)
 
-    if guest_undefine(domobj, logger):
+    if domain_undefine(domobj, logger):
         return 1
 
-    if guest_define(domobj, domxml, logger):
+    if domain_define(domobj, domxml, logger):
         return 1
 
-    ret, ip = guest_start(domobj, guestname, util, logger)
+    ret, ip = domain_start(domobj, guestname, util, logger)
     if ret:
         return 1
 
diff --git a/repos/domain/detach_disk.py b/repos/domain/detach_disk.py
index d723474..faddea4 100644
--- a/repos/domain/detach_disk.py
+++ b/repos/domain/detach_disk.py
@@ -16,7 +16,7 @@ from utils import xml_builder
 required_params = ('guestname', 'virt_type', 'imagename', 'hdmodel',)
 optional_params = ()
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -53,7 +53,7 @@ def detach_disk(params):
     logger.debug("original disk number: %s" %disk_num1)
 
     if disktype == "virtio":
-        if check_guest_status(domobj):
+        if check_domain_status(domobj):
             pass
         else:
             domobj.create()
diff --git a/repos/domain/detach_interface.py b/repos/domain/detach_interface.py
index 82deffb..48dc01b 100644
--- a/repos/domain/detach_interface.py
+++ b/repos/domain/detach_interface.py
@@ -16,7 +16,7 @@ from utils import xml_builder
 required_params = ('guestname', 'ifacetype', 'source', 'nicmodel',)
 optional_params = ()
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -54,7 +54,7 @@ def detach_interface(params):
     iface_num1 = utils.dev_num(guestname, "interface")
     logger.debug("original interface number: %s" % iface_num1)
 
-    if check_guest_status(domobj):
+    if check_domain_status(domobj):
         pass
     else:
         domobj.create()
diff --git a/repos/domain/dump.py b/repos/domain/dump.py
index 24b2353..98061c4 100644
--- a/repos/domain/dump.py
+++ b/repos/domain/dump.py
@@ -17,7 +17,7 @@ from utils import check
 required_params = ('guestname', 'file',)
 optional_params = ()
 
-def check_guest_status(*args):
+def check_domain_status(*args):
     """Check guest current status"""
     (guestname, domobj, logger) = args
 
@@ -31,7 +31,7 @@ def check_guest_status(*args):
     else:
         return True
 
-def check_guest_kernel(*args):
+def check_domain_kernel(*args):
     """Check guest kernel version"""
     (guestname, logger) = args
 
@@ -57,7 +57,7 @@ def check_dump(*args):
     """Check dumpping core file validity"""
     (guestname, file, kernel, logger) = args
 
-    kernel = check_guest_kernel(guestname, logger)
+    kernel = check_domain_kernel(guestname, logger)
     (big, other) = kernel.split("-")
     small = other.split(".")
     arch = small[-1]
@@ -126,8 +126,8 @@ def dump(params):
 
     domobj = conn.lookupByName(guestname)
 
-    if check_guest_status(guestname, domobj, logger):
-        kernel = check_guest_kernel(guestname, logger)
+    if check_domain_status(guestname, domobj, logger):
+        kernel = check_domain_kernel(guestname, logger)
         if kernel == None:
             logger.error("can't get guest kernel version")
             return 1
diff --git a/repos/domain/ifstats.py b/repos/domain/ifstats.py
index ec03203..0afabf6 100644
--- a/repos/domain/ifstats.py
+++ b/repos/domain/ifstats.py
@@ -16,7 +16,7 @@ from utils import utils
 required_params = ('guestname',)
 optional_params = ()
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -37,7 +37,7 @@ def ifstats(params):
     conn = sharedmod.libvirtobj['conn']
     domobj = conn.lookupByName(guestname)
 
-    if check_guest_status(domobj):
+    if check_domain_status(domobj):
         pass
     else:
         try:
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 59ef5d7..98918bc 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -416,6 +416,6 @@ def install_linux_cdrom_clean(params):
         if os.path.exists(initrd):
             os.remove(initrd)
     elif virt_type == 'xenfv' or virt_type == 'kvm':
-        guest_dir = os.path.join(HOME_PATH, guestname)
-        if os.path.exists(guest_dir):
-            shutil.rmtree(guest_dir)
+        domain_dir = os.path.join(HOME_PATH, guestname)
+        if os.path.exists(domain_dir):
+            shutil.rmtree(domain_dir)
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index ae97137..d4a4695 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -406,6 +406,6 @@ def install_linux_net_clean(params):
         if os.path.exists(initrd):
             os.remove(initrd)
     elif virt_type == 'xenfv':
-        guest_dir = os.path.join(HOME_PATH, guestname)
-        if os.path.exists(guest_dir):
-            shutil.rmtree(guest_dir)
+        domain_dir = os.path.join(HOME_PATH, guestname)
+        if os.path.exists(domain_dir):
+            shutil.rmtree(domain_dir)
diff --git a/repos/domain/restore.py b/repos/domain/restore.py
index fe1b2b2..8372fbf 100644
--- a/repos/domain/restore.py
+++ b/repos/domain/restore.py
@@ -14,7 +14,7 @@ from utils import utils
 required_params = ('guestname', 'filepath',)
 optional_params = ()
 
-def get_guest_ipaddr(*args):
+def get_domain_ipaddr(*args):
     """Get guest ip address"""
     (guestname, util, logger) = args
 
@@ -31,7 +31,7 @@ def get_guest_ipaddr(*args):
         logger.error("Error: can't ping current guest")
         return None
 
-def check_guest_status(*args):
+def check_domain_status(*args):
     """Check guest current status"""
     (domobj, logger) = args
 
@@ -43,14 +43,14 @@ def check_guest_status(*args):
     else:
         return True
 
-def check_guest_restore(*args):
+def check_domain_restore(*args):
     """Check restore domain result, if restore domain is successful,
        guest status will not be paused and can be ping
     """
     (guestname, domobj, util, logger) = args
 
-    if check_guest_status(domobj, logger):
-        if get_guest_ipaddr(guestname, util, logger):
+    if check_domain_status(domobj, logger):
+        if get_domain_ipaddr(guestname, util, logger):
             return True
         else:
             return False
@@ -66,14 +66,14 @@ def restore(params):
 
     domobj = conn.lookupByName(guestname)
 
-    if check_guest_status(domobj, logger):
+    if check_domain_status(domobj, logger):
         logger.error("Error: current guest status is not shutoff or shutdown,\
                       can not do restore operation")
         return 1
 
     try:
         conn.restore(filepath)
-        if check_guest_restore(guestname, domobj, util, logger):
+        if check_domain_restore(guestname, domobj, util, logger):
             logger.info("restore %s domain successful" % guestname)
         else:
             logger.error("Error: fail to check restore domain")
diff --git a/repos/domain/save.py b/repos/domain/save.py
index eac39d2..a57f574 100644
--- a/repos/domain/save.py
+++ b/repos/domain/save.py
@@ -14,7 +14,7 @@ from utils import utils
 required_params = ('guestname', 'filepath',)
 optional_params = ()
 
-def get_guest_ipaddr(*args):
+def get_domain_ipaddr(*args):
     """Get guest ip address"""
     (guestname, util, logger) = args
 
@@ -31,7 +31,7 @@ def get_guest_ipaddr(*args):
         logger.error("Error: can't ping current guest")
         return None
 
-def check_guest_status(*args):
+def check_domain_status(*args):
     """Check guest current status"""
     (domobj, logger) = args
 
@@ -45,15 +45,15 @@ def check_guest_status(*args):
     else:
         return True
 
-def check_guest_save(*args):
+def check_domain_save(*args):
     """Check save domain result, if save domain is successful,
        guestname.save will exist under /tmp directory and guest
        can't be ping and status is paused
     """
     (guestname, domobj, util, logger) = args
 
-    if not check_guest_status(domobj, logger):
-        if not get_guest_ipaddr(guestname, util, logger):
+    if not check_domain_status(domobj, logger):
+        if not get_domain_ipaddr(guestname, util, logger):
             return True
         else:
             return False
@@ -70,9 +70,9 @@ def save(params):
     domobj = conn.lookupByName(guestname)
 
     # Save domain
-    ipaddr = get_guest_ipaddr(guestname, util, logger)
+    ipaddr = get_domain_ipaddr(guestname, util, logger)
 
-    if not check_guest_status(domobj, logger):
+    if not check_domain_status(domobj, logger):
         logger.error("Error: current guest status is shutoff")
         return 1
 
@@ -82,7 +82,7 @@ def save(params):
 
     try:
         domobj.save(filepath)
-        if check_guest_save(guestname, domobj, util, logger):
+        if check_domain_save(guestname, domobj, util, logger):
             logger.info("save %s domain successful" %guestname)
         else:
             logger.error("Error: fail to check save domain")
diff --git a/repos/domain/sched_params.py b/repos/domain/sched_params.py
index ee21365..59f91d7 100644
--- a/repos/domain/sched_params.py
+++ b/repos/domain/sched_params.py
@@ -14,7 +14,7 @@ from utils import utils
 required_params = ('guestname', 'capshares',)
 optional_params = ()
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
     """Check guest current status"""
     state = domobj.info()[0]
     if state == libvirt.VIR_DOMAIN_SHUTOFF or state == libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -58,7 +58,7 @@ def sched_params(params):
 
     domobj = conn.lookupByName(guestname)
 
-    if check_guest_status(domobj):
+    if check_domain_status(domobj):
         sched_params = domobj.schedulerParameters()
         logger.info("original scheduler parameters: %s\n" % sched_params)
 
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
index ac7a165..08a9190 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -46,7 +46,7 @@ def request_credentials(credentials, user_data):
     return 0
 
 
-class guest_install(Thread):
+class domain_install(Thread):
     """function callable by as a thread to create guest
     """
     def __init__(self, name, os, arch, type, ks, conn, util, logger):
@@ -61,12 +61,12 @@ class guest_install(Thread):
         self.logger = logger
 
     def run(self):
-        guest_params = {};
-        guest_params['virt_type'] = self.type
-        guest_params['guestname'] = self.name
-        guest_params['kickstart'] = self.ks
+        domain_params = {};
+        domain_params['virt_type'] = self.type
+        domain_params['guestname'] = self.name
+        domain_params['kickstart'] = self.ks
         macaddr = self.utils.get_rand_mac()
-        guest_params['macaddr'] = macaddr
+        domain_params['macaddr'] = macaddr
 
 	# prepare disk image file
         imagepath = IMAG_PATH + self.name
@@ -77,7 +77,7 @@ class guest_install(Thread):
             self.logger.info("creating disk images file is successful.")
 
         xmlobj = xml_builder.XmlBuilder()
-        guestxml = xmlobj.build_domain_install(guest_params)
+        guestxml = xmlobj.build_domain_install(domain_params)
         self.logger.debug("guestxml is %s" % guestxml)
         self.logger.info('create guest %sfrom xml description' % self.name)
         try:
@@ -136,7 +136,7 @@ def multiple_thread_block_on_domain_create(params):
     thread_pid = []
     for i in range(int(start_num), int(end_num)):
         guestname =  name + str(i)
-        thr = guest_install(guestname, guestos, arch, type, ks, conn, util, logger)
+        thr = domain_install(guestname, guestos, arch, type, ks, conn, util, logger)
         thread_pid.append(thr)
 
     for id in thread_pid:
diff --git a/repos/snapshot/delete.py b/repos/snapshot/delete.py
index c7c7453..06ca21e 100644
--- a/repos/snapshot/delete.py
+++ b/repos/snapshot/delete.py
@@ -26,8 +26,8 @@ def check_domain_state(conn, guestname, logger):
 
 def delete_check(guestname, snapshotname, expected_flag, logger):
     """ after deleting, check if appropriate xml file exists or not"""
-    guest_snapshot_dir = os.path.join(SNAPSHOT_DIR, guestname)
-    snapshot_entries = os.listdir(guest_snapshot_dir)
+    domain_snapshot_dir = os.path.join(SNAPSHOT_DIR, guestname)
+    snapshot_entries = os.listdir(domain_snapshot_dir)
     if snapshotname + ".xml" in snapshot_entries and expected_flag == "exist":
         return True
     elif snapshotname + ".xml" in snapshot_entries and expected_flag == "noexist":
diff --git a/repos/snapshot/snapshot_list.py b/repos/snapshot/snapshot_list.py
index cbd68a8..0cfe8f9 100644
--- a/repos/snapshot/snapshot_list.py
+++ b/repos/snapshot/snapshot_list.py
@@ -28,27 +28,27 @@ def snapshot_list(params):
         snapshot_list = ret.split('\n')
         logger.info("snapshot list is %s" % snapshot_list)
 
-    guest_snapshot_dir = os.path.join(SNAPSHOT_DIR, guestname)
-    if (not os.path.isdir(guest_snapshot_dir) or not os.listdir(guest_snapshot_dir)) \
+    domain_snapshot_dir = os.path.join(SNAPSHOT_DIR, guestname)
+    if (not os.path.isdir(domain_snapshot_dir) or not os.listdir(domain_snapshot_dir)) \
         and snapshot_list == ['']:
         logger.info("guest %s has no snapshot records" % guestname)
         return 0
-    elif (not os.path.isdir(guest_snapshot_dir) or not os.listdir(guest_snapshot_dir)) \
+    elif (not os.path.isdir(domain_snapshot_dir) or not os.listdir(domain_snapshot_dir)) \
         and snapshot_list != ['']:
         logger.error("snapshot_list output contains snapshot names: %s" % snapshot_list)
         logger.error("but the folder %s doesn't exist or is empty" % SNAPSHOT_DIR)
         return 1
-    elif os.listdir(guest_snapshot_dir) and snapshot_list == ['']:
+    elif os.listdir(domain_snapshot_dir) and snapshot_list == ['']:
         logger.error("snapshot_list output contains no records")
         logger.error("but the folder contains snapshot xml files: %s" % \
-                      os.listdir(guest_snapshot_dir))
+                      os.listdir(domain_snapshot_dir))
         return 1
 
     logger.info("the path of snapshot for guest %s is %s" % \
-                  (guestname, guest_snapshot_dir))
+                  (guestname, domain_snapshot_dir))
 
-    snapshot_entries = os.listdir(guest_snapshot_dir)
-    logger.info("%s in %s" % (snapshot_entries, guest_snapshot_dir))
+    snapshot_entries = os.listdir(domain_snapshot_dir)
+    logger.info("%s in %s" % (snapshot_entries, domain_snapshot_dir))
 
     for entry in snapshot_entries:
         if not entry.endswith('.xml'):
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]