[libvirt] [test-API 09/17] Substitute guestos with os_type

Martin Kletzander mkletzan at redhat.com
Fri Apr 20 08:27:25 UTC 2012


On 04/20/2012 08:46 AM, Osier Yang wrote:
> ---
>  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                  |   14 +++++-----
>  repos/domain/install_windows_cdrom.py              |   24 ++++++++++----------
>  .../multiple_thread_block_on_domain_create.py      |   12 +++++-----
>  14 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/cases/consumption_cpu_topology.conf b/cases/consumption_cpu_topology.conf
> index 1d76256..429f856 100644
> --- a/cases/consumption_cpu_topology.conf
> +++ b/cases/consumption_cpu_topology.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/consumption_domain_nfs_start.conf b/cases/consumption_domain_nfs_start.conf
> index f97cda0..acc7f9e 100644
> --- a/cases/consumption_domain_nfs_start.conf
> +++ b/cases/consumption_domain_nfs_start.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/consumption_eventhandler.conf b/cases/consumption_eventhandler.conf
> index 768d616..0fc4509 100644
> --- a/cases/consumption_eventhandler.conf
> +++ b/cases/consumption_eventhandler.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
> index 4eb8f86..330d7fc 100644
> --- a/cases/consumption_libvirtd.conf
> +++ b/cases/consumption_libvirtd.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/consumption_ownership_test.conf b/cases/consumption_ownership_test.conf
> index 58468fd..dc0d7ab 100644
> --- a/cases/consumption_ownership_test.conf
> +++ b/cases/consumption_ownership_test.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/domain_linux_net_inst.conf b/cases/domain_linux_net_inst.conf
> index 4c8ab5d..76bb6ba 100644
> --- a/cases/domain_linux_net_inst.conf
> +++ b/cases/domain_linux_net_inst.conf
> @@ -3,7 +3,7 @@ domain:install_linux_net
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
> index 5059c0d..bae93e6 100644
> --- a/cases/linux_domain.conf
> +++ b/cases/linux_domain.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/snapshot.conf b/cases/snapshot.conf
> index 0557c86..924ef61 100644
> --- a/cases/snapshot.conf
> +++ b/cases/snapshot.conf
> @@ -3,7 +3,7 @@ domain:install_linux_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
> index 6eed3f5..917f3ec 100644
> --- a/cases/windows_domain.conf
> +++ b/cases/windows_domain.conf
> @@ -3,7 +3,7 @@ domain:install_windows_cdrom
>          $defaultname
>      virt_type
>          $defaulthv
> -    guestos
> +    os_type
>          $defaultos
>      guestarch
>          $defaultarch
> diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
> index 80dcf1a..12c638e 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', 'guestos', 'guestarch',)
> +required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
>  optional_params = ('uuid',
>                     'memory',
>                     'vcpu',
> @@ -35,12 +35,12 @@ def install_image(params):
>  
>      guestname = params.get('guestname')
>      virt_type = params.get('virt_type')
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      guestarch = params.get('guestarch')
>  
>      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" % guestos)
> +    logger.info("the os of domain is %s" % os_type)
>      logger.info("the arch of domain is %s" % guestarch)
>  
>      # Connect to local hypervisor connection URI
> @@ -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" % (guestos, guestarch))
> +    image_url = global_parser.get_value("image", "%s_%s" % (os_type, guestarch))
>  
>      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 faa60ab..53edce5 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', 'guestos', 'guestarch',)
> +required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
>  optional_params = ('uuid',
>                     'memory',
>                     'vcpu',
> @@ -160,7 +160,7 @@ def install_linux_cdrom(params):
>  
>      guestname = params.get('guestname')
>      virt_type = params.get('virt_type')
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      guestarch = params.get('guestarch')
>  
>      logger.info("the name of domain is %s" % guestname)
> @@ -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", guestos + "_" +guestarch)
> -    ks = global_parser.get_value("guest", guestos + "_" +guestarch + "_http_ks")
> +    ostree = global_parser.get_value("guest", os_type + "_" +guestarch)
> +    ks = global_parser.get_value("guest", os_type + "_" +guestarch + "_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 2c04796..797f8a9 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', 'guestos', 'guestarch','netmethod',)
> +required_params = ('guestname', 'virt_type', 'os_type', 'guestarch','netmethod',)
>  optional_params = ('uuid',
>                     'memory',
>                     'vcpu',
> @@ -136,7 +136,7 @@ def install_linux_net(params):
>  
>      guestname = params.get('guestname')
>      virt_type = params.get('virt_type')
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      guestarch = params.get('guestarch')
>      installmethod = params.get('netmethod')
>  
> @@ -197,14 +197,14 @@ def install_linux_net(params):
>      # and installation method from global.cfg
>  
>      if installmethod == 'http':
> -        ks = global_parser.get_value("guest", guestos + "_" + guestarch +
> +        ks = global_parser.get_value("guest", os_type + "_" + guestarch +
>                                  "_http_ks")
>      elif installmethod == 'ftp':
> -        ks = global_parser.get_value("guest", guestos + "_" + guestarch + "_ftp_ks")
> +        ks = global_parser.get_value("guest", os_type + "_" + guestarch + "_ftp_ks")
>      elif installmethod == "nfs":
> -        ks = global_parser.get_value("guest", guestos + "_" + guestarch + "_nfs_ks")
> +        ks = global_parser.get_value("guest", os_type + "_" + guestarch + "_nfs_ks")
>  
> -    ostree = global_parser.get_value("guest", guestos + "_" + guestarch)
> +    ostree = global_parser.get_value("guest", os_type + "_" + guestarch)
>  
>      logger.debug('install source: \n    %s' % ostree)
>      logger.debug('kisckstart file: \n    %s' % ks)
> @@ -277,7 +277,7 @@ def install_linux_net(params):
>              logger.error("fail to define domain %s" % guestname)
>              return 1
>  
> -    if 'rhel3u9' in guestos:
> +    if 'rhel3u9' in os_type:
>          interval = 0
>          logger.info("waiting 1000 seconds for the installation to complete...")
>          while(interval < 1000):
> diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
> index 868c72b..8211cb0 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', 'guestos', 'guestarch',)
> +required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
>  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, guestos, guestarch,
> +def prepare_floppy_image(guestname, os_type, guestarch,
>                           windows_unattended_path, cdkey, FLOOPY_IMG):
>      """Making corresponding floppy images for the given guestname
>      """
> @@ -103,19 +103,19 @@ def prepare_floppy_image(guestname, guestos, guestarch,
>              "failed to mount /tmp/floppy.img to /mnt/libvirt_floppy")
>              return 1
>  
> -        if '2008' in guestos or '7' in guestos or 'vista' in guestos:
> +        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" %
> -                                 (guestos, guestarch))
> +                                 (os_type, guestarch))
>  
> -        elif '2003' in guestos or 'xp' in guestos:
> +        elif '2003' in os_type or 'xp' in os_type:
>              dest_fname = "winnt.sif"
>              setup_file = 'winnt.bat'
>              setup_file_path = os.path.join(windows_unattended_path, setup_file)
>              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" %
> -                                  (guestos, guestarch))
> +                                  (os_type, guestarch))
>  
>          dest = os.path.join(floppy_mount, dest_fname)
>  
> @@ -197,7 +197,7 @@ def install_windows_cdrom(params):
>  
>      guestname = params.get('guestname')
>      virt_type = params.get('virt_type')
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      guestarch = params.get('guestarch')
>  
>      logger.info("the name of domain is %s" % guestname)
> @@ -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", guestos + '_' + guestarch)
> -    cdkey = global_parser.get_value("guest", "%s_%s_key" % (guestos, guestarch))
> +    iso_file = global_parser.get_value("guest", os_type + '_' + guestarch)
> +    cdkey = global_parser.get_value("guest", "%s_%s_key" % (os_type, guestarch))
>  
>      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, guestos, guestarch,
> +    status = prepare_floppy_image(guestname, os_type, guestarch,
>                                    windows_unattended_path, cdkey, FLOOPY_IMG)
>      if status:
>          logger.error("making floppy image failed")
> @@ -424,12 +424,12 @@ def install_windows_cdrom_clean(params):
>                  logger.error("failed to undefine domain %s" % guestname)
>                  logger.error("%s" % output)
>  
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      guestarch = params.get('guestarch')
>  
>      envfile = os.path.join(HOME_PATH, 'global.cfg')
>      global_parser = global_parser.GlobalParser(envfile)
> -    iso_file = global_parser.get_value("guest", guestos + '_' + guestarch)
> +    iso_file = global_parser.get_value("guest", os_type + '_' + guestarch)
>  
>      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 8556966..c99bde5 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 = ('guestos', 'guestarch', 'virt_type', 'guestnum', 'uri')
> +required_params = ('os_type', 'guestarch', 'virt_type', 'guestnum', 'uri')
>  optional_params = ()
>  
>  def request_credentials(credentials, user_data):
> @@ -96,12 +96,12 @@ def multiple_thread_block_on_domain_create(params):
>          check the return status of calling create API
>      """
>      logger = params['logger']
> -    guestos = params.get('guestos')
> +    os_type = params.get('os_type')
>      arch = params.get('guestarch')
>      type = params.get('virt_type')
>      num = params.get('guestnum')
>  
> -    logger.info("the os of domain is %s" % guestos)
> +    logger.info("the os of domain is %s" % os_type)
>      logger.info("the arch of domain is %s" % arch)
>      logger.info("the type of domain is %s" % type)
>      logger.info("the number of domain we are going to install is %s" % num)
> @@ -118,8 +118,8 @@ def multiple_thread_block_on_domain_create(params):
>  
>      envfile = os.path.join(homepath, 'global.cfg')
>      global_parser = global_parser.GlobalParser(envfile)
> -    ostree = global_parser.get_value("guest", guestos + "_" + arch)
> -    ks = global_parser.get_value("guest", guestos + "_" + arch +
> +    ostree = global_parser.get_value("guest", os_type + "_" + arch)
> +    ks = global_parser.get_value("guest", os_type + "_" + arch +
>                                  "_http_ks")
>  
>      # download vmlinuz and initrd.img
> @@ -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 = domain_install(guestname, guestos, arch, type, ks, conn, util, logger)
> +        thr = domain_install(guestname, os_type, arch, type, ks, conn, util, logger)
>          thread_pid.append(thr)
>  
>      for id in thread_pid:

Looks good, ACK.

Martin




More information about the libvir-list mailing list