Re: [test-API 06/17] Substitute guestxml with domxml

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

 



On 04/20/2012 08:46 AM, Osier Yang wrote:
> ---
>  repos/domain/balloon_memory.py                     |   12 ++++++------
>  repos/domain/cpu_affinity.py                       |   12 ++++++------
>  repos/domain/cpu_topology.py                       |    6 +++---
>  repos/domain/install_image.py                      |    6 +++---
>  repos/domain/install_linux_cdrom.py                |   14 +++++++-------
>  repos/domain/install_linux_net.py                  |   14 +++++++-------
>  repos/domain/install_windows_cdrom.py              |   14 +++++++-------
>  repos/domain/update_devflag.py                     |   10 +++++-----
>  .../multiple_thread_block_on_domain_create.py      |    6 +++---
>  utils/xml_builder.py                               |    2 +-
>  10 files changed, 48 insertions(+), 48 deletions(-)
> 
> diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
> index 642c1fa..11d4565 100644
> --- a/repos/domain/balloon_memory.py
> +++ b/repos/domain/balloon_memory.py
> @@ -42,10 +42,10 @@ def redefine_memory_size(domobj, domname, memsize):
>      """ dump domain xml description to change the memory size,
>          then, define the domain again
>      """
> -    guestxml = domobj.XMLDesc(0)
> -    logger.debug('''original guest %s xml :\n%s''' % (domname, guestxml))
> +    domxml = domobj.XMLDesc(0)
> +    logger.debug('''original guest %s xml :\n%s''' % (domname, domxml))
>  
> -    doc = minidom.parseString(guestxml)
> +    doc = minidom.parseString(domxml)
>  
>      newmem = doc.createElement('memory')
>      newmemval = doc.createTextNode(str(memsize))
> @@ -166,8 +166,8 @@ def balloon_memory(params):
>              return 1
>  
>      # Redefine domain with specified memory size
> -    newguestxml = redefine_memory_size(domobj, domname, maxmem)
> -    logger.debug('''new guest %s xml :\n%s''' %(domname, newguestxml))
> +    newdomxml = redefine_memory_size(domobj, domname, maxmem)
> +    logger.debug('''new guest %s xml :\n%s''' %(domname, newdomxml))
>  
>      logger.info("undefine the original guest")
>      try:
> @@ -180,7 +180,7 @@ def balloon_memory(params):
>  
>      logger.info("define guest with new xml")
>      try:
> -        conn.defineXML(newguestxml)
> +        conn.defineXML(newdomxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
> index fc99664..1b300dc 100644
> --- a/repos/domain/cpu_affinity.py
> +++ b/repos/domain/cpu_affinity.py
> @@ -22,10 +22,10 @@ def redefine_vcpu_number(domobj, domain_name, vcpu):
>      """dump domain xml description to change the vcpu number,
>         then, define the domain again
>      """
> -    guestxml = domobj.XMLDesc(0)
> -    logger.debug('''original guest %s xml :\n%s''' %(domain_name, guestxml))
> +    domxml = domobj.XMLDesc(0)
> +    logger.debug('''original guest %s xml :\n%s''' %(domain_name, domxml))
>  
> -    doc = minidom.parseString(guestxml)
> +    doc = minidom.parseString(domxml)
>  
>      newvcpu = doc.createElement('vcpu')
>      newvcpuval = doc.createTextNode(vcpu)
> @@ -78,8 +78,8 @@ def set_vcpus(util, domobj, domain_name, vcpu):
>          logger.error("the domain couldn't be destroied within 60 secs.")
>          return 1
>  
> -    newguestxml = redefine_vcpu_number(domobj, domain_name, vcpu)
> -    logger.debug('''new guest %s xml :\n%s''' %(domain_name, newguestxml))
> +    newdomxml = redefine_vcpu_number(domobj, domain_name, vcpu)
> +    logger.debug('''new guest %s xml :\n%s''' %(domain_name, newdomxml))
>  
>      logger.info("undefine the original guest")
>      try:
> @@ -93,7 +93,7 @@ def set_vcpus(util, domobj, domain_name, vcpu):
>      logger.info("define guest with new xml")
>      try:
>          conn = domobj._conn
> -        conn.defineXML(newguestxml)
> +        conn.defineXML(newdomxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
> index a463668..ccde97f 100644
> --- a/repos/domain/cpu_topology.py
> +++ b/repos/domain/cpu_topology.py
> @@ -34,10 +34,10 @@ def check_domain_running(conn, guestname, logger):
>  def add_cpu_xml(domobj, guestname, sockets, cores, threads, logger):
>      """edit domain xml description and insert <cpu> element"""
>  
> -    guestxml = domobj.XMLDesc(0)
> -    logger.debug('''original guest %s xml :\n%s''' %(guestname, guestxml))
> +    domxml = domobj.XMLDesc(0)
> +    logger.debug('''original guest %s xml :\n%s''' %(guestname, domxml))
>  
> -    doc = minidom.parseString(guestxml)
> +    doc = minidom.parseString(domxml)
>      cpu = doc.createElement('cpu')
>      topology = doc.createElement('topology')
>      topology.setAttribute('sockets', sockets)
> diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
> index 84df56d..fe05ca8 100644
> --- a/repos/domain/install_image.py
> +++ b/repos/domain/install_image.py
> @@ -77,10 +77,10 @@ def install_image(params):
>  
>      xmlobj.add_disk(params, domain)
>      xmlobj.add_interface(params, domain)
> -    guestxml = xmlobj.build_domain(domain)
> +    domxml = xmlobj.build_domain(domain)
>  
>      try:
> -        domobj = conn.defineXML(guestxml)
> +        domobj = conn.defineXML(domxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> @@ -89,7 +89,7 @@ def install_image(params):
>  
>      logger.info("define guest %s " % guestname)
>      logger.debug("the xml description of guest booting off harddisk is %s" %
> -                  guestxml)
> +                  domxml)
>  
>      logger.info('boot guest up ...')
>  
> diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
> index 98918bc..8ff43e3 100644
> --- a/repos/domain/install_linux_cdrom.py
> +++ b/repos/domain/install_linux_cdrom.py
> @@ -98,7 +98,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      xmlobj.add_disk(params, domain)
>      xmlobj.add_interface(params, domain)
> -    guestxml = xmlobj.build_domain(domain)
> +    domxml = xmlobj.build_domain(domain)
>  
>      if installtype != 'create':
>          domobj.undefine()
> @@ -106,7 +106,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      try:
>          conn = domobj._conn
> -        domobj = conn.defineXML(guestxml)
> +        domobj = conn.defineXML(domxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> @@ -115,7 +115,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      logger.info("define guest %s " % guestname)
>      logger.debug("the xml description of guest booting off harddisk is %s" %
> -                 guestxml)
> +                 domxml)
>  
>      logger.info('boot guest up ...')
>  
> @@ -259,15 +259,15 @@ def install_linux_cdrom(params):
>          return 1
>  
>      xmlobj = xml_builder.XmlBuilder()
> -    guestxml = xmlobj.build_domain_install(params)
> -    logger.debug('dump installation guest xml:\n%s' % guestxml)
> +    domxml = xmlobj.build_domain_install(params)
> +    logger.debug('dump installation guest xml:\n%s' % domxml)
>  
>      installtype = params.get('type')
>  
>      if installtype == None or installtype == 'define':
>          logger.info('define guest from xml description')
>          try:
> -            domobj = conn.defineXML(guestxml)
> +            domobj = conn.defineXML(domxml)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> @@ -286,7 +286,7 @@ def install_linux_cdrom(params):
>      elif installtype == 'create':
>          logger.info('create guest from xml description')
>          try:
> -            domobj = conn.createXML(guestxml, 0)
> +            domobj = conn.createXML(domxml, 0)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
> index d4a4695..795a465 100644
> --- a/repos/domain/install_linux_net.py
> +++ b/repos/domain/install_linux_net.py
> @@ -55,7 +55,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      xmlobj.add_disk(params, domain)
>      xmlobj.add_interface(params, domain)
> -    guestxml = xmlobj.build_domain(domain)
> +    domxml = xmlobj.build_domain(domain)
>  
>      if installtype != 'create':
>          domobj.undefine()
> @@ -63,7 +63,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      try:
>          conn = domobj._conn
> -        domobj = conn.defineXML(guestxml)
> +        domobj = conn.defineXML(domxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> @@ -72,7 +72,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
>  
>      logger.info("define guest %s " % guestname)
>      logger.debug("the xml description of guest booting off harddisk is %s" %
> -                 guestxml)
> +                 domxml)
>  
>      logger.info('boot guest up ...')
>  
> @@ -241,8 +241,8 @@ def install_linux_net(params):
>  
>      # Prepare guest installation xml
>      xmlobj = xml_builder.XmlBuilder()
> -    guestxml = xmlobj.build_domain_install(params)
> -    logger.debug('dump installation guest xml:\n%s' % guestxml)
> +    domxml = xmlobj.build_domain_install(params)
> +    logger.debug('dump installation guest xml:\n%s' % domxml)
>  
>      #start installation
>      conn = sharedmod.libvirtobj['conn']
> @@ -251,7 +251,7 @@ def install_linux_net(params):
>      if installtype == None or installtype == 'define':
>          logger.info('define guest from xml description')
>          try:
> -            domobj = conn.defineXML(guestxml)
> +            domobj = conn.defineXML(domxml)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> @@ -270,7 +270,7 @@ def install_linux_net(params):
>      elif installtype == 'create':
>          logger.info('create guest from xml description')
>          try:
> -            domobj = conn.createXML(guestxml, 0)
> +            domobj = conn.createXML(domxml, 0)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
> index 8344447..775875f 100644
> --- a/repos/domain/install_windows_cdrom.py
> +++ b/repos/domain/install_windows_cdrom.py
> @@ -157,7 +157,7 @@ def prepare_boot_guest(domobj, dict, installtype):
>  
>      xmlobj.add_disk(params, domain)
>      xmlobj.add_interface(params, domain)
> -    guestxml = xmlobj.build_domain(domain)
> +    domxml = xmlobj.build_domain(domain)
>  
>      if installtype != 'create':
>          domobj.undefine()
> @@ -165,7 +165,7 @@ def prepare_boot_guest(domobj, dict, installtype):
>  
>      try:
>          conn = domobj._conn
> -        domobj = conn.defineXML(guestxml)
> +        domobj = conn.defineXML(domxml)
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
>                       % (e.message, e.get_error_code()))
> @@ -174,7 +174,7 @@ def prepare_boot_guest(domobj, dict, installtype):
>  
>      logger.info("define guest %s " % guestname)
>      logger.debug("the xml description of guest booting off harddisk is %s" %
> -                 guestxml)
> +                 domxml)
>  
>      logger.info('boot guest up ...')
>  
> @@ -286,8 +286,8 @@ def install_windows_cdrom(params):
>      params['floppysource'] = FLOOPY_IMG
>  
>      xmlobj = xml_builder.XmlBuilder()
> -    guestxml = xmlobj.build_domain_install_win(params)
> -    logger.debug('dump installation guest xml:\n%s' % guestxml)
> +    domxml = xmlobj.build_domain_install_win(params)
> +    logger.debug('dump installation guest xml:\n%s' % domxml)
>  
>      # Generate guest xml
>      conn = sharedmod.libvirtobj['conn']
> @@ -295,7 +295,7 @@ def install_windows_cdrom(params):
>      if installtype == None or installtype == 'define':
>          logger.info('define guest from xml description')
>          try:
> -            domobj = conn.defineXML(guestxml)
> +            domobj = conn.defineXML(domxml)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> @@ -314,7 +314,7 @@ def install_windows_cdrom(params):
>      elif installtype == 'create':
>          logger.info('create guest from xml description')
>          try:
> -            conn.createXML(guestxml, 0)
> +            conn.createXML(domxml, 0)
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
>                           % (e.message, e.get_error_code()))
> diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
> index 48efd72..4706d6e 100644
> --- a/repos/domain/update_devflag.py
> +++ b/repos/domain/update_devflag.py
> @@ -188,22 +188,22 @@ def update_devflag(params):
>                       % (e.message, e.get_error_code()))
>          return 1
>  
> -    guestxml = domobj.XMLDesc(0)
> -    domobj = minidom.parseString(guestxml)
> +    domxml = domobj.XMLDesc(0)
> +    domobj = minidom.parseString(domxml)
>  
>      # Generat device XML for original use
>      origxmlobj = xml_builder.XmlBuilder()
>  
>      if devtype == 'cdrom':
>          origxmlobj.add_cdrom(xmlargs, domobj)
> -        guestxml = origxmlobj.build_domain(domobj)
> +        domxml = origxmlobj.build_domain(domobj)
>      elif devtype == 'floppy':
>          origxmlobj.add_floppy(xmlargs, domobj)
> -        guestxml = origxmlobj.build_domain(domobj)
> +        domxml = origxmlobj.build_domain(domobj)
>  
>      try:
>          domobj.undefine()
> -        conn.defineXML(guestxml)
> +        conn.defineXML(domxml)
>          domobj.create()
>      except libvirtError, e:
>          logger.error("API error message: %s, error code is %s" \
> diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
> index 4224510..bae5e12 100644
> --- a/repos/regression/multiple_thread_block_on_domain_create.py
> +++ b/repos/regression/multiple_thread_block_on_domain_create.py
> @@ -77,11 +77,11 @@ class domain_install(Thread):
>              self.logger.info("creating disk images file is successful.")
>  
>          xmlobj = xml_builder.XmlBuilder()
> -        guestxml = xmlobj.build_domain_install(domain_params)
> -        self.logger.debug("guestxml is %s" % guestxml)
> +        domxml = xmlobj.build_domain_install(domain_params)
> +        self.logger.debug("domxml is %s" % domxml)
>          self.logger.info('create guest %sfrom xml description' % self.name)
>          try:
> -            domobj = self.conn.createXML(guestxml, 0)
> +            domobj = self.conn.createXML(domxml, 0)
>              self.logger.info('guest %s API createXML returned successfuly' % domobj.name())
>          except libvirtError, e:
>              logger.error("API error message: %s, error code is %s" \
> diff --git a/utils/xml_builder.py b/utils/xml_builder.py
> index 435aa84..c11b430 100644
> --- a/utils/xml_builder.py
> +++ b/utils/xml_builder.py
> @@ -315,7 +315,7 @@ if __name__ == "__main__":
>      xmlobj.add_cdrom(params, domain)
>      xmlobj.add_interface(params, domain)
>      xmlobj.add_hostdev(params, domain)
> -    guestxml = xmlobj.build_domain(domain)
> +    domxml = xmlobj.build_domain(domain)
>  
>      #----------------------------------------
>      # get domain xml string for installation

ACK

Martin

--
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]