[libvirt] [test-API 10/17] Substitute guestarch with os_arch

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


An example of the libvirt XML will tell why os_arch is better.

  <os>
    <type arch='x86_64'>exe</type>
    <init>/bin/systemd</init>
    <initarg>--unit</initarg>
    <initarg>emergency.service</initarg>
  </os>
---
 cases/consumption_cpu_topology.conf                |    2 +-
 cases/consumption_domain_nfs_start.conf            |    2 +-
 cases/consumption_eventhandler.conf                |    2 +-
 cases/consumption_libvirtd.conf                    |    2 +-
 cases/consumption_ownership_test.conf              |    2 +-
 cases/domain_linux_net_inst.conf                   |    2 +-
 cases/linux_domain.conf                            |    2 +-
 cases/snapshot.conf                                |    2 +-
 cases/windows_domain.conf                          |    2 +-
 repos/domain/install_image.py                      |    8 ++++----
 repos/domain/install_linux_cdrom.py                |    8 ++++----
 repos/domain/install_linux_net.py                  |   12 ++++++------
 repos/domain/install_windows_cdrom.py              |   20 ++++++++++----------
 .../multiple_thread_block_on_domain_create.py      |    4 ++--
 14 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/cases/consumption_cpu_topology.conf b/cases/consumption_cpu_topology.conf
index 429f856..1fdb1e2 100644
--- a/cases/consumption_cpu_topology.conf
+++ b/cases/consumption_cpu_topology.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/consumption_domain_nfs_start.conf b/cases/consumption_domain_nfs_start.conf
index acc7f9e..f213b2a 100644
--- a/cases/consumption_domain_nfs_start.conf
+++ b/cases/consumption_domain_nfs_start.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/consumption_eventhandler.conf b/cases/consumption_eventhandler.conf
index 0fc4509..47de579 100644
--- a/cases/consumption_eventhandler.conf
+++ b/cases/consumption_eventhandler.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
index 330d7fc..6cf070e 100644
--- a/cases/consumption_libvirtd.conf
+++ b/cases/consumption_libvirtd.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/consumption_ownership_test.conf b/cases/consumption_ownership_test.conf
index dc0d7ab..e588b54 100644
--- a/cases/consumption_ownership_test.conf
+++ b/cases/consumption_ownership_test.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/domain_linux_net_inst.conf b/cases/domain_linux_net_inst.conf
index 76bb6ba..5e30434 100644
--- a/cases/domain_linux_net_inst.conf
+++ b/cases/domain_linux_net_inst.conf
@@ -5,7 +5,7 @@ domain:install_linux_net
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     netmethod
 	http
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index bae93e6..73ef9f3 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/snapshot.conf b/cases/snapshot.conf
index 924ef61..bceabe2 100644
--- a/cases/snapshot.conf
+++ b/cases/snapshot.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
index 917f3ec..073009c 100644
--- a/cases/windows_domain.conf
+++ b/cases/windows_domain.conf
@@ -5,7 +5,7 @@ domain:install_windows_cdrom
         $defaulthv
     os_type
         $defaultos
-    guestarch
+    os_arch
         $defaultarch
     vcpu
         $defaultvcpu
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index 12c638e..64d4d91 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -17,7 +17,7 @@ from utils import xml_builder
 
 HOME_PATH = os.getcwd()
 
-required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
+required_params = ('guestname', 'virt_type', 'os_type', 'os_arch',)
 optional_params = ('uuid',
                    'memory',
                    'vcpu',
@@ -36,12 +36,12 @@ def install_image(params):
     guestname = params.get('guestname')
     virt_type = params.get('virt_type')
     os_type = params.get('os_type')
-    guestarch = params.get('guestarch')
+    os_arch = params.get('os_arch')
 
     logger.info("the name of domain is %s" % guestname)
     logger.info("the type of domain is %s" % virt_type)
     logger.info("the os of domain is %s" % os_type)
-    logger.info("the arch of domain is %s" % guestarch)
+    logger.info("the arch of domain is %s" % os_arch)
 
     # Connect to local hypervisor connection URI
     hypervisor = utils.get_hypervisor()
@@ -64,7 +64,7 @@ def install_image(params):
     logger.info("the environment file is %s" % envfile)
 
     global_parser = global_parser.GlobalParser(envfile)
-    image_url = global_parser.get_value("image", "%s_%s" % (os_type, guestarch))
+    image_url = global_parser.get_value("image", "%s_%s" % (os_type, os_arch))
 
     logger.info("download images file from %s" % image_url)
     urllib.urlretrieve(image_url, imgfullpath)
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 53edce5..4588333 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -18,7 +18,7 @@ from src import global_parser
 from utils import utils
 from utils import xml_builder
 
-required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
+required_params = ('guestname', 'virt_type', 'os_type', 'os_arch',)
 optional_params = ('uuid',
                    'memory',
                    'vcpu',
@@ -161,7 +161,7 @@ def install_linux_cdrom(params):
     guestname = params.get('guestname')
     virt_type = params.get('virt_type')
     os_type = params.get('os_type')
-    guestarch = params.get('guestarch')
+    os_arch = params.get('os_arch')
 
     logger.info("the name of domain is %s" % guestname)
     logger.info("the type of domain is %s" % virt_type)
@@ -227,8 +227,8 @@ def install_linux_cdrom(params):
     logger.info("the environment file is %s" % envfile)
 
     global_parser = global_parser.GlobalParser(envfile)
-    ostree = global_parser.get_value("guest", os_type + "_" +guestarch)
-    ks = global_parser.get_value("guest", os_type + "_" +guestarch + "_http_ks")
+    ostree = global_parser.get_value("guest", os_type + "_" +os_arch)
+    ks = global_parser.get_value("guest", os_type + "_" +os_arch + "_http_ks")
 
     logger.debug('install source: \n    %s' % ostree)
     logger.debug('kisckstart file: \n    %s' % ks)
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index 797f8a9..dd350f4 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -18,7 +18,7 @@ from src import global_parser
 from utils import utils
 from utils import xml_builder
 
-required_params = ('guestname', 'virt_type', 'os_type', 'guestarch','netmethod',)
+required_params = ('guestname', 'virt_type', 'os_type', 'os_arch','netmethod',)
 optional_params = ('uuid',
                    'memory',
                    'vcpu',
@@ -137,7 +137,7 @@ def install_linux_net(params):
     guestname = params.get('guestname')
     virt_type = params.get('virt_type')
     os_type = params.get('os_type')
-    guestarch = params.get('guestarch')
+    os_arch = params.get('os_arch')
     installmethod = params.get('netmethod')
 
     logger.info("the name of domain is %s" % guestname)
@@ -197,14 +197,14 @@ def install_linux_net(params):
     # and installation method from global.cfg
 
     if installmethod == 'http':
-        ks = global_parser.get_value("guest", os_type + "_" + guestarch +
+        ks = global_parser.get_value("guest", os_type + "_" + os_arch +
                                 "_http_ks")
     elif installmethod == 'ftp':
-        ks = global_parser.get_value("guest", os_type + "_" + guestarch + "_ftp_ks")
+        ks = global_parser.get_value("guest", os_type + "_" + os_arch + "_ftp_ks")
     elif installmethod == "nfs":
-        ks = global_parser.get_value("guest", os_type + "_" + guestarch + "_nfs_ks")
+        ks = global_parser.get_value("guest", os_type + "_" + os_arch + "_nfs_ks")
 
-    ostree = global_parser.get_value("guest", os_type + "_" + guestarch)
+    ostree = global_parser.get_value("guest", os_type + "_" + os_arch)
 
     logger.debug('install source: \n    %s' % ostree)
     logger.debug('kisckstart file: \n    %s' % ks)
diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
index 8211cb0..f6f03d7 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -26,7 +26,7 @@ FLOOPY_IMG = "/tmp/floppy.img"
 ISO_MOUNT_POINT = "/mnt/libvirt_windows"
 HOME_PATH = os.getcwd()
 
-required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
+required_params = ('guestname', 'virt_type', 'os_type', 'os_arch',)
 optional_params = ('uuid',
                    'memory',
                    'vcpu',
@@ -68,7 +68,7 @@ def prepare_iso(iso_file, mount_point):
 
     return 0, iso_local_path
 
-def prepare_floppy_image(guestname, os_type, guestarch,
+def prepare_floppy_image(guestname, os_type, os_arch,
                          windows_unattended_path, cdkey, FLOOPY_IMG):
     """Making corresponding floppy images for the given guestname
     """
@@ -106,7 +106,7 @@ def prepare_floppy_image(guestname, os_type, guestarch,
         if '2008' in os_type or '7' in os_type or 'vista' in os_type:
             dest_fname = "autounattend.xml"
             source = os.path.join(windows_unattended_path, "%s_%s.xml" %
-                                 (os_type, guestarch))
+                                 (os_type, os_arch))
 
         elif '2003' in os_type or 'xp' in os_type:
             dest_fname = "winnt.sif"
@@ -115,7 +115,7 @@ def prepare_floppy_image(guestname, os_type, guestarch,
             setup_file_dest = os.path.join(floppy_mount, setup_file)
             shutil.copyfile(setup_file_path, setup_file_dest)
             source = os.path.join(windows_unattended_path, "%s_%s.sif" %
-                                  (os_type, guestarch))
+                                  (os_type, os_arch))
 
         dest = os.path.join(floppy_mount, dest_fname)
 
@@ -198,7 +198,7 @@ def install_windows_cdrom(params):
     guestname = params.get('guestname')
     virt_type = params.get('virt_type')
     os_type = params.get('os_type')
-    guestarch = params.get('guestarch')
+    os_arch = params.get('os_arch')
 
     logger.info("the name of domain is %s" % guestname)
     logger.info("the type of domain is %s" % virt_type)
@@ -261,8 +261,8 @@ def install_windows_cdrom(params):
 
     # Get iso file based on domain os and arch from global.cfg
     global_parser = global_parser.GlobalParser(envfile)
-    iso_file = global_parser.get_value("guest", os_type + '_' + guestarch)
-    cdkey = global_parser.get_value("guest", "%s_%s_key" % (os_type, guestarch))
+    iso_file = global_parser.get_value("guest", os_type + '_' + os_arch)
+    cdkey = global_parser.get_value("guest", "%s_%s_key" % (os_type, os_arch))
 
     windows_unattended_path = os.path.join(HOME_PATH,
                               "repos/domain/windows_unattended")
@@ -278,7 +278,7 @@ def install_windows_cdrom(params):
         return 1
     params['bootcd'] = iso_local_path
 
-    status = prepare_floppy_image(guestname, os_type, guestarch,
+    status = prepare_floppy_image(guestname, os_type, os_arch,
                                   windows_unattended_path, cdkey, FLOOPY_IMG)
     if status:
         logger.error("making floppy image failed")
@@ -425,11 +425,11 @@ def install_windows_cdrom_clean(params):
                 logger.error("%s" % output)
 
     os_type = params.get('os_type')
-    guestarch = params.get('guestarch')
+    os_arch = params.get('os_arch')
 
     envfile = os.path.join(HOME_PATH, 'global.cfg')
     global_parser = global_parser.GlobalParser(envfile)
-    iso_file = global_parser.get_value("guest", os_type + '_' + guestarch)
+    iso_file = global_parser.get_value("guest", os_type + '_' + os_arch)
 
     status, iso_local_path = prepare_iso(iso_file, ISO_MOUNT_POINT)
     if os.path.exists(iso_local_path):
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
index c99bde5..c4f6732 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -21,7 +21,7 @@ from utils import xml_builder
 IMAG_PATH = "/var/lib/libvirt/images/"
 DISK_DD = "dd if=/dev/zero of=%s bs=1 count=1 seek=6G"
 
-required_params = ('os_type', 'guestarch', 'virt_type', 'guestnum', 'uri')
+required_params = ('os_type', 'os_arch', 'virt_type', 'guestnum', 'uri')
 optional_params = ()
 
 def request_credentials(credentials, user_data):
@@ -97,7 +97,7 @@ def multiple_thread_block_on_domain_create(params):
     """
     logger = params['logger']
     os_type = params.get('os_type')
-    arch = params.get('guestarch')
+    arch = params.get('os_arch')
     type = params.get('virt_type')
     num = params.get('guestnum')
 
-- 
1.7.7.3




More information about the libvir-list mailing list