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

Re: [libvirt] [PATCH test-API 2/2] repos: modify existing testcases to support it



On 03/26/2012 07:18 PM, Guannan Ren wrote:
> ---
>  repos/domain/attach_disk.py                        |    6 +++---
>  repos/domain/attach_interface.py                   |    6 +++---
>  repos/domain/autostart.py                          |    6 +++---
>  repos/domain/balloon_memory.py                     |    6 +++---
>  repos/domain/blkstats.py                           |    6 +++---
>  repos/domain/cpu_affinity.py                       |    6 +++---
>  repos/domain/cpu_topology.py                       |    6 +++---
>  repos/domain/create.py                             |    6 +++---
>  repos/domain/define.py                             |    6 +++---
>  repos/domain/destroy.py                            |    6 +++---
>  repos/domain/detach_disk.py                        |    6 +++---
>  repos/domain/detach_interface.py                   |    6 +++---
>  repos/domain/domain_blkinfo.py                     |    6 +++---
>  repos/domain/domain_id.py                          |    6 +++---
>  repos/domain/domain_uuid.py                        |    6 +++---
>  repos/domain/dump.py                               |    6 +++---
>  repos/domain/eventhandler.py                       |    6 +++---
>  repos/domain/ifstats.py                            |    6 +++---
>  repos/domain/install_image.py                      |    6 +++---
>  repos/domain/install_linux_cdrom.py                |    6 +++---
>  repos/domain/install_linux_check.py                |    6 +++---
>  repos/domain/install_linux_net.py                  |    6 +++---
>  repos/domain/install_windows_cdrom.py              |    6 +++---
>  repos/domain/migrate.py                            |   11 ++++++-----
>  repos/domain/ownership_test.py                     |    6 +++---
>  repos/domain/reboot.py                             |    6 +++---
>  repos/domain/restore.py                            |    6 +++---
>  repos/domain/resume.py                             |    6 +++---
>  repos/domain/save.py                               |    6 +++---
>  repos/domain/sched_params.py                       |    6 +++---
>  repos/domain/shutdown.py                           |    6 +++---
>  repos/domain/start.py                              |    6 +++---
>  repos/domain/suspend.py                            |    6 +++---
>  repos/domain/undefine.py                           |    6 +++---
>  repos/domain/update_devflag.py                     |    6 +++---
>  repos/interface/create.py                          |    6 +++---
>  repos/interface/define.py                          |    6 +++---
>  repos/interface/destroy.py                         |    6 +++---
>  repos/interface/undefine.py                        |    6 +++---
>  repos/libvirtd/qemu_hang.py                        |    6 +++---
>  repos/libvirtd/restart.py                          |    6 +++---
>  repos/network/autostart.py                         |    6 +++---
>  repos/network/create.py                            |    6 +++---
>  repos/network/define.py                            |    6 +++---
>  repos/network/destroy.py                           |    6 +++---
>  repos/network/network_list.py                      |    6 +++---
>  repos/network/network_name.py                      |    6 +++---
>  repos/network/network_uuid.py                      |    6 +++---
>  repos/network/start.py                             |    6 +++---
>  repos/network/undefine.py                          |    6 +++---
>  repos/nodedevice/detach.py                         |    6 +++---
>  repos/nodedevice/reattach.py                       |    6 +++---
>  repos/nodedevice/reset.py                          |    6 +++---
>  repos/npiv/create_virtual_hba.py                   |    6 +++---
>  .../multiple_thread_block_on_domain_create.py      |    6 +++---
>  repos/remoteAccess/tcp_setup.py                    |    6 +++---
>  repos/remoteAccess/tls_setup.py                    |    6 +++---
>  repos/remoteAccess/unix_perm_sasl.py               |   10 +++++-----
>  repos/sVirt/domain_nfs_start.py                    |   18 +++++++++---------
>  repos/snapshot/delete.py                           |    8 ++++----
>  repos/snapshot/file_flag.py                        |    6 +++---
>  repos/snapshot/flag_check.py                       |    6 +++---
>  repos/snapshot/internal_create.py                  |    8 ++++----
>  repos/snapshot/revert.py                           |    8 ++++----
>  repos/storage/activate_pool.py                     |    6 +++---
>  repos/storage/build_dir_pool.py                    |    6 +++---
>  repos/storage/build_disk_pool.py                   |    6 +++---
>  repos/storage/build_logical_pool.py                |    6 +++---
>  repos/storage/build_netfs_pool.py                  |    6 +++---
>  repos/storage/create_dir_pool.py                   |    6 +++---
>  repos/storage/create_dir_volume.py                 |    6 +++---
>  repos/storage/create_fs_pool.py                    |    6 +++---
>  repos/storage/create_iscsi_pool.py                 |    6 +++---
>  repos/storage/create_logical_volume.py             |    6 +++---
>  repos/storage/create_netfs_pool.py                 |    6 +++---
>  repos/storage/create_netfs_volume.py               |    6 +++---
>  repos/storage/create_partition_volume.py           |    6 +++---
>  repos/storage/define_dir_pool.py                   |    6 +++---
>  repos/storage/define_disk_pool.py                  |    6 +++---
>  repos/storage/define_iscsi_pool.py                 |    6 +++---
>  repos/storage/define_logical_pool.py               |    6 +++---
>  repos/storage/define_mpath_pool.py                 |    6 +++---
>  repos/storage/define_netfs_pool.py                 |    6 +++---
>  repos/storage/define_scsi_pool.py                  |    6 +++---
>  repos/storage/delete_dir_volume.py                 |    6 +++---
>  repos/storage/delete_logical_pool.py               |    6 +++---
>  repos/storage/delete_logical_volume.py             |    6 +++---
>  repos/storage/delete_netfs_volume.py               |    6 +++---
>  repos/storage/delete_partition_volume.py           |    6 +++---
>  repos/storage/destroy_pool.py                      |    6 +++---
>  repos/storage/pool_name.py                         |    6 +++---
>  repos/storage/pool_uuid.py                         |    6 +++---
>  repos/storage/undefine_pool.py                     |    6 +++---
>  93 files changed, 293 insertions(+), 292 deletions(-)
> 
> diff --git a/repos/domain/attach_disk.py b/repos/domain/attach_disk.py
> index 3a1175e..93a1b20 100644
> --- a/repos/domain/attach_disk.py
> +++ b/repos/domain/attach_disk.py
> @@ -88,8 +88,8 @@ def attach_disk(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
> @@ -103,7 +103,7 @@ def attach_disk(params):
>          return 1
>  
>      # Generate disk xml
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      xmlobj = xmlbuilder.XmlBuilder()
>      diskxml = xmlobj.build_disk(params)
>      logger.debug("disk xml:\n%s" %diskxml)
> diff --git a/repos/domain/attach_interface.py b/repos/domain/attach_interface.py
> index e6bbbda..9311c42 100644
> --- a/repos/domain/attach_interface.py
> +++ b/repos/domain/attach_interface.py
> @@ -72,14 +72,14 @@ def attach_interface(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Generate interface xml
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      xmlobj = xmlbuilder.XmlBuilder()
>      interfacexml = xmlobj.build_interface(params)
>      logger.debug("interface xml:\n%s" %interfacexml)
> diff --git a/repos/domain/autostart.py b/repos/domain/autostart.py
> index f0fc97c..ce896ac 100644
> --- a/repos/domain/autostart.py
> +++ b/repos/domain/autostart.py
> @@ -85,14 +85,14 @@ def autostart(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Set autostart for domain
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      try:
>          try:
>              domobj.set_auto_start(guestname, flag)
> diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
> index 0a40591..799f1e8 100644
> --- a/repos/domain/balloon_memory.py
> +++ b/repos/domain/balloon_memory.py
> @@ -185,9 +185,9 @@ def balloon_memory(params):
>      mac = util.get_dom_mac_addr(domain_name)
>      logger.info("the mac address of vm %s is %s" % (domain_name, mac))
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      Defined_dom_list =  domobj.get_defined_list()
>      Active_dom_list = domobj.get_list()
> diff --git a/repos/domain/blkstats.py b/repos/domain/blkstats.py
> index 67592f0..a6bd6fd 100644
> --- a/repos/domain/blkstats.py
> +++ b/repos/domain/blkstats.py
> @@ -58,14 +58,14 @@ def blkstats(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Check domain block status
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      if check_guest_status(guestname, domobj):
>          pass
>      else:
> diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
> index 380b307..f5638d0 100644
> --- a/repos/domain/cpu_affinity.py
> +++ b/repos/domain/cpu_affinity.py
> @@ -243,12 +243,12 @@ def cpu_affinity(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      hypervisor = uri.split(':')[0]
>  
>      # Get cpu affinity
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      dom_name_list = domobj.get_list()
>      if domain_name not in dom_name_list:
>          logger.error("guest %s doesn't exist or not be running." %
> diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
> index adf238c..8f1135d 100644
> --- a/repos/domain/cpu_topology.py
> +++ b/repos/domain/cpu_topology.py
> @@ -216,9 +216,9 @@ def cpu_topology(params):
>      uri = util.get_uri('127.0.0.1')
>  
>      logger.info("the uri is %s" % uri)
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if check_domain_running(domobj, guestname, logger):
>          conn.close()
> diff --git a/repos/domain/create.py b/repos/domain/create.py
> index 4e3e1c4..3a43082 100644
> --- a/repos/domain/create.py
> +++ b/repos/domain/create.py
> @@ -100,14 +100,14 @@ def create(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Generate domain xml
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      xmlobj = xmlbuilder.XmlBuilder()
>      domain = xmlobj.add_domain(params)
>      xmlobj.add_disk(params, domain)
> diff --git a/repos/domain/define.py b/repos/domain/define.py
> index 8f0095a..f60b247 100644
> --- a/repos/domain/define.py
> +++ b/repos/domain/define.py
> @@ -204,15 +204,15 @@ def define(params):
>      else:
>          uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Get capabilities debug info
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Generate damain xml
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>      xml_obj = xmlbuilder.XmlBuilder()
>      domain = xml_obj.add_domain(params)
>      xml_obj.add_disk(params, domain)
> diff --git a/repos/domain/destroy.py b/repos/domain/destroy.py
> index 9187d34..29e672b 100644
> --- a/repos/domain/destroy.py
> +++ b/repos/domain/destroy.py
> @@ -72,11 +72,11 @@ def destroy(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Get running domain by name
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>      dom_name_list = dom_obj.get_list()
>      if guestname not in dom_name_list:
>          logger.error("guest %s doesn't exist or isn't running." % guestname)
> diff --git a/repos/domain/detach_disk.py b/repos/domain/detach_disk.py
> index 21c6598..64b5df2 100644
> --- a/repos/domain/detach_disk.py
> +++ b/repos/domain/detach_disk.py
> @@ -76,14 +76,14 @@ def detach_disk(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Detach disk
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      xmlobj = xmlbuilder.XmlBuilder()
>      diskxml = xmlobj.build_disk(params)
>      logger.debug("disk xml:\n%s" %diskxml)
> diff --git a/repos/domain/detach_interface.py b/repos/domain/detach_interface.py
> index 6639336..e78506e 100644
> --- a/repos/domain/detach_interface.py
> +++ b/repos/domain/detach_interface.py
> @@ -79,14 +79,14 @@ def detach_interface(params):
>      logger.debug("mac address: \n%s" % macs)
>      params['macaddr'] = mac_list[-1]
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Detach disk
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      xmlobj = xmlbuilder.XmlBuilder()
>      ifacexml = xmlobj.build_interface(params)
>      logger.debug("interface xml:\n%s" % ifacexml)
> diff --git a/repos/domain/domain_blkinfo.py b/repos/domain/domain_blkinfo.py
> index 700bf02..5a3143b 100644
> --- a/repos/domain/domain_blkinfo.py
> +++ b/repos/domain/domain_blkinfo.py
> @@ -124,11 +124,11 @@ def domblkinfo(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if not check_domain_exists(domobj, guestname, logger):
>          logger.error("need a defined guest, may or may not be active")
> diff --git a/repos/domain/domain_id.py b/repos/domain/domain_id.py
> index 6216e30..58a786d 100644
> --- a/repos/domain/domain_id.py
> +++ b/repos/domain/domain_id.py
> @@ -78,11 +78,11 @@ def domid(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      for dom in doms:
>          if not check_domain_exists(domobj, dom, logger):
> diff --git a/repos/domain/domain_uuid.py b/repos/domain/domain_uuid.py
> index 8b02a15..ebb5ffc 100644
> --- a/repos/domain/domain_uuid.py
> +++ b/repos/domain/domain_uuid.py
> @@ -72,11 +72,11 @@ def domuuid(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if not check_domain_exists(domobj, guestname, logger):
>          logger.error("need a defined guest, may or may not be active")
> diff --git a/repos/domain/dump.py b/repos/domain/dump.py
> index 15951e6..3a8220b 100644
> --- a/repos/domain/dump.py
> +++ b/repos/domain/dump.py
> @@ -165,14 +165,14 @@ def dump(dicts):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Domain core dump
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if check_guest_status(guestname, domobj, logger):
>          kernel = check_guest_kernel(guestname, logger)
> diff --git a/repos/domain/eventhandler.py b/repos/domain/eventhandler.py
> index 7bbd157..a13d360 100644
> --- a/repos/domain/eventhandler.py
> +++ b/repos/domain/eventhandler.py
> @@ -254,12 +254,12 @@ def eventhandler(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> +    conn = connectAPI.ConnectAPI(uri)
>  
> -    virconn = conn.open(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if check_domain_running(domobj, guestname, logger):
>          conn.close()
> diff --git a/repos/domain/ifstats.py b/repos/domain/ifstats.py
> index 73ff9b7..981785d 100644
> --- a/repos/domain/ifstats.py
> +++ b/repos/domain/ifstats.py
> @@ -65,13 +65,13 @@ def ifstats(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if check_guest_status(guestname, domobj):
>          pass
> diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
> index 888e80f..937e18c 100644
> --- a/repos/domain/install_image.py
> +++ b/repos/domain/install_image.py
> @@ -132,9 +132,9 @@ def install_image(params):
>      urllib.urlretrieve(image_url, imgfullpath)
>      logger.info("the image is located in %s" % imgfullpath)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      xmlobj = xmlbuilder.XmlBuilder()
>      domain = xmlobj.add_domain(params)
> diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
> index 79dd41c..56ba0e2 100644
> --- a/repos/domain/install_linux_cdrom.py
> +++ b/repos/domain/install_linux_cdrom.py
> @@ -244,9 +244,9 @@ def install_linux_cdrom(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>      hypervisor = util.get_hypervisor()
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      check_domain_state(domobj, guestname, logger)
>  
> diff --git a/repos/domain/install_linux_check.py b/repos/domain/install_linux_check.py
> index 4431b1c..59495de 100644
> --- a/repos/domain/install_linux_check.py
> +++ b/repos/domain/install_linux_check.py
> @@ -119,9 +119,9 @@ def install_linux_check(params):
>      logger.info("the type of hypervisor is %s" % hypervisor)
>      logger.debug("the uri to connect is %s" % uri)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>      state = domobj.get_state(guestname)
>      conn.close()
>  
> diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
> index 0ef5036..a1e6ca5 100644
> --- a/repos/domain/install_linux_net.py
> +++ b/repos/domain/install_linux_net.py
> @@ -333,9 +333,9 @@ def install_linux_net(params):
>      logger.debug('dump installation guest xml:\n%s' % guestxml)
>  
>      #start installation
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>      installtype = params.get('type')
>      if installtype == None or installtype == 'define':
>          logger.info('define guest from xml description')
> diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
> index 79cd25c..ea66785 100644
> --- a/repos/domain/install_windows_cdrom.py
> +++ b/repos/domain/install_windows_cdrom.py
> @@ -375,9 +375,9 @@ def install_windows_cdrom(params):
>      logger.debug('dump installation guest xml:\n%s' % guestxml)
>  
>      # Generate guest xml
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>      installtype = params.get('type')
>      if installtype == None or installtype == 'define':
>          logger.info('define guest from xml description')
> diff --git a/repos/domain/migrate.py b/repos/domain/migrate.py
> index 5414c32..ed07edd 100644
> --- a/repos/domain/migrate.py
> +++ b/repos/domain/migrate.py
> @@ -227,12 +227,13 @@ def migrate(params):
>  
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
> -    conn = connectAPI.ConnectAPI()
> -    src = conn.open(srcuri)
> -    dst = conn.open(dsturi)
> +    srcconn = connectAPI.ConnectAPI(srcuri)
> +    dstconn = connectAPI.ConnectAPI(dsturi)
> +    srcconn.open()
> +    dstconn.open()
>  
> -    srcdom = DomainAPI(src)
> -    dstdom = DomainAPI(dst)
> +    srcdom = DomainAPI(srcconn)
> +    dstdom = DomainAPI(dstconn)
>  
>      if predstconfig == "true":
>          guest_names = dstdom.get_defined_list()
> diff --git a/repos/domain/ownership_test.py b/repos/domain/ownership_test.py
> index 5464d86..5a929dc 100644
> --- a/repos/domain/ownership_test.py
> +++ b/repos/domain/ownership_test.py
> @@ -220,12 +220,12 @@ def ownership_test(params):
>  
>      # Connect to local hypervisor connection URI
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # save domain to the file
>      logger.info("save domain %s to the file %s" % (guestname, SAVE_FILE))
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("check the domain state")
>      ret = check_domain_running(domobj, guestname, logger)
> diff --git a/repos/domain/reboot.py b/repos/domain/reboot.py
> index 03172c4..1bef7fe 100644
> --- a/repos/domain/reboot.py
> +++ b/repos/domain/reboot.py
> @@ -65,11 +65,11 @@ def reboot(params):
>          logger.info("kvm hypervisor doesn't support the funtion now")
>          return 0
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Get domain ip
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>      logger.info("get the mac address of vm %s" % domain_name)
>      mac = util.get_dom_mac_addr(domain_name)
>      logger.info("the mac address of vm %s is %s" % (domain_name, mac))
> diff --git a/repos/domain/restore.py b/repos/domain/restore.py
> index 528bd75..c3e54cc 100644
> --- a/repos/domain/restore.py
> +++ b/repos/domain/restore.py
> @@ -106,14 +106,14 @@ def restore(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Restore domain
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      if check_guest_status(guestname, domobj, logger):
>          logger.error("Error: current guest status is not shutoff or shutdown,\
>                        can not do restore operation")
> diff --git a/repos/domain/resume.py b/repos/domain/resume.py
> index 798fd2a..7a1be8a 100644
> --- a/repos/domain/resume.py
> +++ b/repos/domain/resume.py
> @@ -79,9 +79,9 @@ def resume(params):
>      uri = util.get_uri('127.0.0.1')
>  
>      # Resume domain
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>      logger.info('resume domain')
>      try:
>          domobj.resume(domname)
> diff --git a/repos/domain/save.py b/repos/domain/save.py
> index d9782e3..840c8ba 100644
> --- a/repos/domain/save.py
> +++ b/repos/domain/save.py
> @@ -102,14 +102,14 @@ def save(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Save domain
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      ipaddr = get_guest_ipaddr(guestname, util, logger)
>  
>      if not check_guest_status(guestname, domobj, logger):
> diff --git a/repos/domain/sched_params.py b/repos/domain/sched_params.py
> index aa736d2..79cf0e7 100644
> --- a/repos/domain/sched_params.py
> +++ b/repos/domain/sched_params.py
> @@ -94,13 +94,13 @@ def sched_params(params):
>      guestname = params['guestname']
>      test_result = False
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      if check_guest_status(guestname, domobj):
>          sched_params = domobj.get_sched_params(guestname)
>          logger.info("original scheduler parameters: %s\n" % sched_params)
> diff --git a/repos/domain/shutdown.py b/repos/domain/shutdown.py
> index 28c01ba..6be5027 100644
> --- a/repos/domain/shutdown.py
> +++ b/repos/domain/shutdown.py
> @@ -74,11 +74,11 @@ def shutdown(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Get domain ip
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>      timeout = 600
>      logger.info('shutdown domain')
>      mac = util.get_dom_mac_addr(domname)
> diff --git a/repos/domain/start.py b/repos/domain/start.py
> index 5ac5010..aa482b8 100644
> --- a/repos/domain/start.py
> +++ b/repos/domain/start.py
> @@ -90,11 +90,11 @@ def start(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Start domain
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>      timeout = 600
>      logger.info('start domain')
>  
> diff --git a/repos/domain/suspend.py b/repos/domain/suspend.py
> index 19c26cf..a0104dc 100644
> --- a/repos/domain/suspend.py
> +++ b/repos/domain/suspend.py
> @@ -77,11 +77,11 @@ def suspend(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Suspend domain
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>      logger.info('suspend domain')
>      try:
>          domobj.suspend(domname)
> diff --git a/repos/domain/undefine.py b/repos/domain/undefine.py
> index 13412fa..781aeae 100644
> --- a/repos/domain/undefine.py
> +++ b/repos/domain/undefine.py
> @@ -59,15 +59,15 @@ def undefine(params):
>      # Connect to local hypervisor connection URI
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      # Get capability debug info
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
>      # Undefine domain
> -    dom_obj = domainAPI.DomainAPI(virconn)
> +    dom_obj = domainAPI.DomainAPI(conn)
>  
>      try:
>          try:
> diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
> index de69c5e..906b18a 100644
> --- a/repos/domain/update_devflag.py
> +++ b/repos/domain/update_devflag.py
> @@ -217,11 +217,11 @@ def update_devflag(params):
>      guestip = util.mac_to_ip(mac, 180)
>      logger.debug("ip address: %s" % guestip)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      caps = conn.get_caps()
>      logger.debug(caps)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      try:
>          if guestname not in domobj.get_defined_list():
> diff --git a/repos/interface/create.py b/repos/interface/create.py
> index 41e5dcc..6ffe884 100644
> --- a/repos/interface/create.py
> +++ b/repos/interface/create.py
> @@ -99,13 +99,13 @@ def create(params):
>      except:
>          logger.info("interface %s is deactive" % ifacename)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    ifaceobj = interfaceAPI.InterfaceAPI(virconn)
> +    ifaceobj = interfaceAPI.InterfaceAPI(conn)
>      display_current_interface(ifaceobj)
>  
>  
> diff --git a/repos/interface/define.py b/repos/interface/define.py
> index 054bd54..7b7a620 100644
> --- a/repos/interface/define.py
> +++ b/repos/interface/define.py
> @@ -84,8 +84,8 @@ def define(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
> @@ -96,7 +96,7 @@ def define(params):
>          logger.info("closed hypervisor connection")
>          return 1
>  
> -    ifaceobj = interfaceAPI.InterfaceAPI(virconn)
> +    ifaceobj = interfaceAPI.InterfaceAPI(conn)
>  
>      xmlobj = xmlbuilder.XmlBuilder()
>      iface_xml = xmlobj.build_host_interface(params)
> diff --git a/repos/interface/destroy.py b/repos/interface/destroy.py
> index 771fa74..1adacc7 100644
> --- a/repos/interface/destroy.py
> +++ b/repos/interface/destroy.py
> @@ -97,13 +97,13 @@ def destroy(params):
>          logger.error("interface %s is deactive" % ifacename)
>          return 1
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    ifaceobj = interfaceAPI.InterfaceAPI(virconn)
> +    ifaceobj = interfaceAPI.InterfaceAPI(conn)
>      display_current_interface(ifaceobj)
>  
>      #xmlobj = xmlbuilder.XmlBuilder()
> diff --git a/repos/interface/undefine.py b/repos/interface/undefine.py
> index 7d49942..8552520 100644
> --- a/repos/interface/undefine.py
> +++ b/repos/interface/undefine.py
> @@ -83,8 +83,8 @@ def undefine(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
> @@ -95,7 +95,7 @@ def undefine(params):
>          logger.info("closed hypervisor connection")
>          return 1
>  
> -    ifaceobj = interfaceAPI.InterfaceAPI(virconn)
> +    ifaceobj = interfaceAPI.InterfaceAPI(conn)
>  
>      try:
>          try:
> diff --git a/repos/libvirtd/qemu_hang.py b/repos/libvirtd/qemu_hang.py
> index 8b1ffda..8c49be3 100644
> --- a/repos/libvirtd/qemu_hang.py
> +++ b/repos/libvirtd/qemu_hang.py
> @@ -101,9 +101,9 @@ def qemu_hang(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("check the domain state")
>      ret = check_domain_running(domobj, guestname, logger)
> diff --git a/repos/libvirtd/restart.py b/repos/libvirtd/restart.py
> index 2d217cb..5586c35 100644
> --- a/repos/libvirtd/restart.py
> +++ b/repos/libvirtd/restart.py
> @@ -101,9 +101,9 @@ def restart(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("check the domain state")
>      ret = check_domain_running(domobj, guestname, logger)
> diff --git a/repos/network/autostart.py b/repos/network/autostart.py
> index ba4b4f1..08d9233 100644
> --- a/repos/network/autostart.py
> +++ b/repos/network/autostart.py
> @@ -99,13 +99,13 @@ def autostart(params):
>  
>      logger.info("uri address is %s" % uri)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      logger.debug("before setting autostart to virtual network, check status:")
>      shell_cmd = "virsh net-list --all"
> diff --git a/repos/network/create.py b/repos/network/create.py
> index a667441..22a973a 100644
> --- a/repos/network/create.py
> +++ b/repos/network/create.py
> @@ -67,13 +67,13 @@ def create(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if not check_network_status(networkname, netobj, logger):
>          logger.error("the %s network is running" % networkname)
> diff --git a/repos/network/define.py b/repos/network/define.py
> index dda8d06..7a0b767 100644
> --- a/repos/network/define.py
> +++ b/repos/network/define.py
> @@ -75,13 +75,13 @@ def define(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if check_network_define(networkname, logger):
>          logger.error("%s network is defined" % networkname)
> diff --git a/repos/network/destroy.py b/repos/network/destroy.py
> index 51663ac..00c2958 100644
> --- a/repos/network/destroy.py
> +++ b/repos/network/destroy.py
> @@ -68,13 +68,13 @@ def destroy(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if not check_network_status(networkname, netobj, logger):
>          logger.error("the %s network is inactive" % networkname)
> diff --git a/repos/network/network_list.py b/repos/network/network_list.py
> index 7448fd9..8390eb1 100644
> --- a/repos/network/network_list.py
> +++ b/repos/network/network_list.py
> @@ -177,10 +177,10 @@ def network_list(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      for option in option_list:
>          if option == ' ':
> diff --git a/repos/network/network_name.py b/repos/network/network_name.py
> index 5b78dec..6385310 100644
> --- a/repos/network/network_name.py
> +++ b/repos/network/network_name.py
> @@ -73,11 +73,11 @@ def netname(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if not check_network_exists(netobj, networkname, logger):
>          logger.error("need a defined network, may or may not be active")
> diff --git a/repos/network/network_uuid.py b/repos/network/network_uuid.py
> index be30fd2..5826eea 100644
> --- a/repos/network/network_uuid.py
> +++ b/repos/network/network_uuid.py
> @@ -73,11 +73,11 @@ def netuuid(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if not check_network_exists(netobj, networkname, logger):
>          logger.error("need a defined network, may or may not be active")
> diff --git a/repos/network/start.py b/repos/network/start.py
> index b28b635..5584b1d 100644
> --- a/repos/network/start.py
> +++ b/repos/network/start.py
> @@ -67,13 +67,13 @@ def start(params):
>  
>      logger.info("uri address is %s" % uri)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      net_defined_list = netobj.defined_list()
>  
> diff --git a/repos/network/undefine.py b/repos/network/undefine.py
> index d7e903e..bc6fac1 100644
> --- a/repos/network/undefine.py
> +++ b/repos/network/undefine.py
> @@ -67,13 +67,13 @@ def undefine(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    netobj = networkAPI.NetworkAPI(virconn)
> +    netobj = networkAPI.NetworkAPI(conn)
>  
>      if check_network_undefine(networkname):
>          logger.error("the network %s is undefine" % networkname)
> diff --git a/repos/nodedevice/detach.py b/repos/nodedevice/detach.py
> index 18e792e..18845f8 100644
> --- a/repos/nodedevice/detach.py
> +++ b/repos/nodedevice/detach.py
> @@ -110,13 +110,13 @@ def detach(dicts):
>  
>      logger.debug("the name of the pci device is: %s" % device_name)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    nodeobj = nodedevAPI.NodedevAPI(virconn)
> +    nodeobj = nodedevAPI.NodedevAPI(conn)
>  
>      try:
>          try:
> diff --git a/repos/nodedevice/reattach.py b/repos/nodedevice/reattach.py
> index 8eafb1d..e578135 100644
> --- a/repos/nodedevice/reattach.py
> +++ b/repos/nodedevice/reattach.py
> @@ -109,13 +109,13 @@ def reattach(dicts):
>  
>      logger.debug("the name of the pci device is: %s" % device_name)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    nodeobj = nodedevAPI.NodedevAPI(virconn)
> +    nodeobj = nodedevAPI.NodedevAPI(conn)
>  
>      try:
>          try:
> diff --git a/repos/nodedevice/reset.py b/repos/nodedevice/reset.py
> index 40ba95b..fdb88de 100644
> --- a/repos/nodedevice/reset.py
> +++ b/repos/nodedevice/reset.py
> @@ -78,13 +78,13 @@ def reset(dicts):
>          (slot, func) = slot_func.split(".")
>          device_name = "pci_0000_%s_%s_%s" % (bus, slot, func)
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    nodeobj = nodedevAPI.NodedevAPI(virconn)
> +    nodeobj = nodedevAPI.NodedevAPI(conn)
>  
>      try:
>          try:
> diff --git a/repos/npiv/create_virtual_hba.py b/repos/npiv/create_virtual_hba.py
> index e86b85a..835d4d5 100644
> --- a/repos/npiv/create_virtual_hba.py
> +++ b/repos/npiv/create_virtual_hba.py
> @@ -90,13 +90,13 @@ def create_virtual_hba(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    nodedev = nodedevAPI.NodedevAPI(virconn)
> +    nodedev = nodedevAPI.NodedevAPI(conn)
>      scsi_list = nodedev.lists('scsi_host')
>  
>      for fc_name in scsi_list:
> diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
> index 82cf3d1..feadfda 100644
> --- a/repos/regression/multiple_thread_block_on_domain_create.py
> +++ b/repos/regression/multiple_thread_block_on_domain_create.py
> @@ -149,9 +149,9 @@ def multiple_thread_block_on_domain_create(params):
>  
>      auth = [[connectAPI.VIR_CRED_AUTHNAME, connectAPI.VIR_CRED_PASSPHRASE], request_credentials, None]
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.openAuth(uri, auth, 0)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.openAuth(auth, 0)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("the type of hypervisor is %s" % hypervisor)
>      logger.debug("the uri to connect is %s" % uri)
> diff --git a/repos/remoteAccess/tcp_setup.py b/repos/remoteAccess/tcp_setup.py
> index b3877f7..da670fc 100644
> --- a/repos/remoteAccess/tcp_setup.py
> +++ b/repos/remoteAccess/tcp_setup.py
> @@ -135,13 +135,13 @@ def hypervisor_connecting_test(uri, auth_tcp, username,
>      """ connect remote server """
>      ret = 1
>      try:
> -        conn = connectAPI.ConnectAPI()
> +        conn = connectAPI.ConnectAPI(uri)
>          if auth_tcp == 'none':
> -            virconn = conn.open(uri)
> +            conn.open()
>          elif auth_tcp == 'sasl':
>              user_data = [username, password]
>              auth = [[connectAPI.VIR_CRED_AUTHNAME, connectAPI.VIR_CRED_PASSPHRASE], request_credentials, user_data]
> -            virconn = conn.openAuth(uri, auth, 0)
> +            conn.openAuth(auth, 0)
>  
>          ret = 0
>          conn.close()
> diff --git a/repos/remoteAccess/tls_setup.py b/repos/remoteAccess/tls_setup.py
> index 27bb8a7..152e335 100644
> --- a/repos/remoteAccess/tls_setup.py
> +++ b/repos/remoteAccess/tls_setup.py
> @@ -345,13 +345,13 @@ def hypervisor_connecting_test(uri, auth_tls, username,
>      """ connect remote server """
>      ret = 0
>      try:
> -        conn = connectAPI.ConnectAPI()
> +        conn = connectAPI.ConnectAPI(uri)
>          if auth_tls == 'none':
> -            virconn = conn.open(uri)
> +            conn.open()
>          elif auth_tls == 'sasl':
>              user_data = [username, password]
>              auth = [[connectAPI.VIR_CRED_AUTHNAME, connectAPI.VIR_CRED_PASSPHRASE], request_credentials, user_data]
> -            virconn = conn.openAuth(uri, auth, 0)
> +            conn.openAuth(auth, 0)
>  
>      except LibvirtAPI, e:
>          logger.error("API error message: %s, error code is %s" % \
> diff --git a/repos/remoteAccess/unix_perm_sasl.py b/repos/remoteAccess/unix_perm_sasl.py
> index 5db758c..9f4b3c9 100644
> --- a/repos/remoteAccess/unix_perm_sasl.py
> +++ b/repos/remoteAccess/unix_perm_sasl.py
> @@ -153,24 +153,24 @@ def hypervisor_connecting_test(uri, auth_unix_ro, auth_unix_rw, logger):
>      os.seteuid(testing_user_id)
>  
>      try:
> -        conn = connectAPI.ConnectAPI()
> +        conn = connectAPI.ConnectAPI(uri)
>          if auth_unix_ro == 'none':
> -            virconn = conn.open_read_only(uri)
> +            conn.open_read_only()
>          elif auth_unix_ro == 'sasl':
>              user_data = [TESTING_USER, TESTING_USER]
>              auth = [[connectAPI.VIR_CRED_AUTHNAME, \
>                       connectAPI.VIR_CRED_PASSPHRASE],
>                      request_credentials, user_data]
> -            virconn = conn.openAuth(uri, auth, 0)
> +            conn.openAuth(auth, 0)
>  
>          if auth_unix_rw == 'none':
> -            virconn = conn.open(uri)
> +            conn.open()
>          elif auth_unix_rw == 'sasl':
>              user_data = [TESTING_USER, TESTING_USER]
>              auth = [[connectAPI.VIR_CRED_AUTHNAME, \
>                       connectAPI.VIR_CRED_PASSPHRASE],
>                      request_credentials, user_data]
> -            virconn = conn.openAuth(uri, auth, 0)
> +            conn.openAuth(auth, 0)
>          conn.close()
>      except LibvirtAPI, e:
>          logger.error("API error message: %s, error code is %s" % \
> diff --git a/repos/sVirt/domain_nfs_start.py b/repos/sVirt/domain_nfs_start.py
> index edaf2f2..6abe13c 100644
> --- a/repos/sVirt/domain_nfs_start.py
> +++ b/repos/sVirt/domain_nfs_start.py
> @@ -171,9 +171,9 @@ def domain_nfs_start(params):
>  
>      # Connect to local hypervisor connection URI
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("get the domain state")
>      try:
> @@ -219,9 +219,9 @@ def domain_nfs_start(params):
>          return return_close(conn, logger, 1)
>  
>      # reconnect
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      logger.info("begin to test start domain from nfs storage")
>      logger.info("First, start the domain without chown the img file to qemu")
> @@ -459,9 +459,9 @@ def domain_nfs_start_clean(params):
>  
>      # Connect to local hypervisor connection URI
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if domobj.get_state(guestname) != "shutoff":
>          domobj.destroy(guestname)
> diff --git a/repos/snapshot/delete.py b/repos/snapshot/delete.py
> index 98f82a5..f0a7662 100644
> --- a/repos/snapshot/delete.py
> +++ b/repos/snapshot/delete.py
> @@ -83,12 +83,12 @@ def delete(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> -    snap_obj = snapshotAPI.SnapshotAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
> +    snap_obj = snapshotAPI.SnapshotAPI(conn)
>  
>      logger.info("checking if the guest is poweroff")
>      if not check_domain_state(domobj, guestname, logger):
> diff --git a/repos/snapshot/file_flag.py b/repos/snapshot/file_flag.py
> index 5c5b2c7..46b7803 100644
> --- a/repos/snapshot/file_flag.py
> +++ b/repos/snapshot/file_flag.py
> @@ -89,11 +89,11 @@ def file_flag(params):
>      util = utils.Utils()
>      chk = check.Check()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if not check_domain_running(domobj, guestname, logger):
>          logger.error("need a running guest")
> diff --git a/repos/snapshot/flag_check.py b/repos/snapshot/flag_check.py
> index 70fb506..542a903 100644
> --- a/repos/snapshot/flag_check.py
> +++ b/repos/snapshot/flag_check.py
> @@ -79,11 +79,11 @@ def flag_check(params):
>      util = utils.Utils()
>      chk = check.Check()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
>  
>      if not check_domain_running(domobj, guestname, logger):
>          logger.error("need a running guest")
> diff --git a/repos/snapshot/internal_create.py b/repos/snapshot/internal_create.py
> index 7ec1d30..fe37fdb 100644
> --- a/repos/snapshot/internal_create.py
> +++ b/repos/snapshot/internal_create.py
> @@ -92,12 +92,12 @@ def internal_create(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> -    snap_obj = snapshotAPI.SnapshotAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
> +    snap_obj = snapshotAPI.SnapshotAPI(conn)
>  
>      logger.info("checking domain and the format of its disk")
>      if not check_domain_image(domobj, util, guestname, logger):
> diff --git a/repos/snapshot/revert.py b/repos/snapshot/revert.py
> index dafcf44..34bd78e 100644
> --- a/repos/snapshot/revert.py
> +++ b/repos/snapshot/revert.py
> @@ -66,12 +66,12 @@ def revert(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    domobj = domainAPI.DomainAPI(virconn)
> -    snap_obj = snapshotAPI.SnapshotAPI(virconn)
> +    domobj = domainAPI.DomainAPI(conn)
> +    snap_obj = snapshotAPI.SnapshotAPI(conn)
>  
>      logger.info("checking if the guest is poweroff")
>      if not check_domain_state(domobj, guestname, logger):
> diff --git a/repos/storage/activate_pool.py b/repos/storage/activate_pool.py
> index 2b27be6..32ff0b9 100644
> --- a/repos/storage/activate_pool.py
> +++ b/repos/storage/activate_pool.py
> @@ -90,10 +90,10 @@ def activate_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_inactive(stgobj, poolname, logger):
>          logger.error("%s storage pool isn't defined or inactive" % poolname)
> diff --git a/repos/storage/build_dir_pool.py b/repos/storage/build_dir_pool.py
> index 5765b36..0d121b6 100644
> --- a/repos/storage/build_dir_pool.py
> +++ b/repos/storage/build_dir_pool.py
> @@ -90,13 +90,13 @@ def build_dir_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_defined(stgobj, poolname):
>          logger.error("only have defined pool can be built")
> diff --git a/repos/storage/build_disk_pool.py b/repos/storage/build_disk_pool.py
> index be36ea8..a52f3e4 100644
> --- a/repos/storage/build_disk_pool.py
> +++ b/repos/storage/build_disk_pool.py
> @@ -122,10 +122,10 @@ def build_disk_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      logger.info("checking the state of given storage pool")
>      if not check_pool_inactive(stgobj, poolname):
> diff --git a/repos/storage/build_logical_pool.py b/repos/storage/build_logical_pool.py
> index f761fd1..05836f4 100644
> --- a/repos/storage/build_logical_pool.py
> +++ b/repos/storage/build_logical_pool.py
> @@ -102,13 +102,13 @@ def build_logical_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_build_pool(poolname):
>          logger.debug("%s storage pool is built" % poolname)
> diff --git a/repos/storage/build_netfs_pool.py b/repos/storage/build_netfs_pool.py
> index d0012ff..9d0280c 100644
> --- a/repos/storage/build_netfs_pool.py
> +++ b/repos/storage/build_netfs_pool.py
> @@ -89,13 +89,13 @@ def build_netfs_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_defined(stgobj, poolname):
>          logger.error("only have defined pool can be built")
> diff --git a/repos/storage/create_dir_pool.py b/repos/storage/create_dir_pool.py
> index d497fdb..86747cd 100644
> --- a/repos/storage/create_dir_pool.py
> +++ b/repos/storage/create_dir_pool.py
> @@ -92,11 +92,11 @@ def create_dir_pool(params):
>      util = utils.Utils()
>      uri  = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      caps = conn.get_caps()
>      logger.debug(caps)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_create(stgobj, poolname, logger):
>          logger.error("%s storage pool has already been created" % poolname)
> diff --git a/repos/storage/create_dir_volume.py b/repos/storage/create_dir_volume.py
> index 6022e7b..1ee6fa8 100644
> --- a/repos/storage/create_dir_volume.py
> +++ b/repos/storage/create_dir_volume.py
> @@ -140,10 +140,10 @@ def create_dir_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      storage_pool_list = stgobj.storage_pool_list()
>  
> diff --git a/repos/storage/create_fs_pool.py b/repos/storage/create_fs_pool.py
> index 887b91d..76bc5bd 100644
> --- a/repos/storage/create_fs_pool.py
> +++ b/repos/storage/create_fs_pool.py
> @@ -119,11 +119,11 @@ def create_fs_pool(params):
>      util = utils.Utils()
>      uri  = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      caps = conn.get_caps()
>      logger.debug(caps)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_exists(stgobj, poolname, logger):
>          logger.error("%s storage pool has already been created" % poolname)
> diff --git a/repos/storage/create_iscsi_pool.py b/repos/storage/create_iscsi_pool.py
> index d642ddd..58be00b 100644
> --- a/repos/storage/create_iscsi_pool.py
> +++ b/repos/storage/create_iscsi_pool.py
> @@ -99,11 +99,11 @@ def create_iscsi_pool(params):
>      util = utils.Utils()
>      uri  = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      caps = conn.get_caps()
>      logger.debug(caps)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_exists(stgobj, poolname, logger):
>          logger.error("%s storage pool has already been created" % poolname)
> diff --git a/repos/storage/create_logical_volume.py b/repos/storage/create_logical_volume.py
> index e41bede..aac4fd9 100644
> --- a/repos/storage/create_logical_volume.py
> +++ b/repos/storage/create_logical_volume.py
> @@ -135,13 +135,13 @@ def create_logical_volume(params):
>      caps_kbyte = dicts['capacity_byte']/1024
>  
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      # active pool can create volume
>      if not check_pool_active(stgobj, poolname):
> diff --git a/repos/storage/create_netfs_pool.py b/repos/storage/create_netfs_pool.py
> index 8ea781b..8830c60 100644
> --- a/repos/storage/create_netfs_pool.py
> +++ b/repos/storage/create_netfs_pool.py
> @@ -122,11 +122,11 @@ def create_netfs_pool(params):
>      util = utils.Utils()
>      uri  = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>      caps = conn.get_caps()
>      logger.debug(caps)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_create_libvirt(stgobj, poolname, logger):
>          logger.error("%s storage pool has already been created" % poolname)
> diff --git a/repos/storage/create_netfs_volume.py b/repos/storage/create_netfs_volume.py
> index 65d1215..d864f4f 100644
> --- a/repos/storage/create_netfs_volume.py
> +++ b/repos/storage/create_netfs_volume.py
> @@ -138,10 +138,10 @@ def create_netfs_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      storage_pool_list = stgobj.storage_pool_list()
>  
> diff --git a/repos/storage/create_partition_volume.py b/repos/storage/create_partition_volume.py
> index 4772ea6..8d71a6c 100644
> --- a/repos/storage/create_partition_volume.py
> +++ b/repos/storage/create_partition_volume.py
> @@ -121,10 +121,10 @@ def create_partition_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      storage_pool_list = stgobj.storage_pool_list()
>  
> diff --git a/repos/storage/define_dir_pool.py b/repos/storage/define_dir_pool.py
> index 03b15b7..cdb5fb2 100644
> --- a/repos/storage/define_dir_pool.py
> +++ b/repos/storage/define_dir_pool.py
> @@ -87,13 +87,13 @@ def define_dir_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname, logger):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/define_disk_pool.py b/repos/storage/define_disk_pool.py
> index 4b47814..cc29a8e 100644
> --- a/repos/storage/define_disk_pool.py
> +++ b/repos/storage/define_disk_pool.py
> @@ -105,10 +105,10 @@ def define_disk_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/define_iscsi_pool.py b/repos/storage/define_iscsi_pool.py
> index 5711159..b3bd97f 100644
> --- a/repos/storage/define_iscsi_pool.py
> +++ b/repos/storage/define_iscsi_pool.py
> @@ -100,13 +100,13 @@ def define_iscsi_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(stgobj, poolname, logger):
>          logger.error("%s storage pool is ALREADY defined" % poolname)
> diff --git a/repos/storage/define_logical_pool.py b/repos/storage/define_logical_pool.py
> index 71dbdeb..02e7b73 100644
> --- a/repos/storage/define_logical_pool.py
> +++ b/repos/storage/define_logical_pool.py
> @@ -78,13 +78,13 @@ def define_logical_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname, logger):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/define_mpath_pool.py b/repos/storage/define_mpath_pool.py
> index 89db5ef..d9d1caa 100644
> --- a/repos/storage/define_mpath_pool.py
> +++ b/repos/storage/define_mpath_pool.py
> @@ -99,10 +99,10 @@ def define_mpath_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/define_netfs_pool.py b/repos/storage/define_netfs_pool.py
> index 68d7c86..fceaab8 100644
> --- a/repos/storage/define_netfs_pool.py
> +++ b/repos/storage/define_netfs_pool.py
> @@ -79,13 +79,13 @@ def define_netfs_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname, logger):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/define_scsi_pool.py b/repos/storage/define_scsi_pool.py
> index 6afbe01..d0ef482 100644
> --- a/repos/storage/define_scsi_pool.py
> +++ b/repos/storage/define_scsi_pool.py
> @@ -103,10 +103,10 @@ def define_scsi_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_define(poolname):
>          logger.error("%s storage pool is defined" % poolname)
> diff --git a/repos/storage/delete_dir_volume.py b/repos/storage/delete_dir_volume.py
> index 7e6c714..8201e8f 100644
> --- a/repos/storage/delete_dir_volume.py
> +++ b/repos/storage/delete_dir_volume.py
> @@ -97,13 +97,13 @@ def delete_dir_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_active(stgobj, poolname):
>          logger.error("can't delete volume from inactive %s pool" % poolname)
> diff --git a/repos/storage/delete_logical_pool.py b/repos/storage/delete_logical_pool.py
> index c880aa3..c739b66 100644
> --- a/repos/storage/delete_logical_pool.py
> +++ b/repos/storage/delete_logical_pool.py
> @@ -97,13 +97,13 @@ def delete_logical_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_delete_pool(poolname):
>          logger.debug("%s storage pool is deleted" % poolname)
> diff --git a/repos/storage/delete_logical_volume.py b/repos/storage/delete_logical_volume.py
> index 3dc7036..7f0bc88 100644
> --- a/repos/storage/delete_logical_volume.py
> +++ b/repos/storage/delete_logical_volume.py
> @@ -117,13 +117,13 @@ def delete_logical_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>      if not check_pool_active(stgobj, poolname):
>          conn.close()
>          logger.info("closed hypervisor connection")
> diff --git a/repos/storage/delete_netfs_volume.py b/repos/storage/delete_netfs_volume.py
> index e719087..66b1a6e 100644
> --- a/repos/storage/delete_netfs_volume.py
> +++ b/repos/storage/delete_netfs_volume.py
> @@ -97,13 +97,13 @@ def delete_netfs_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_active(stgobj, poolname):
>          logger.error("can't delete volume from inactive %s pool" % poolname)
> diff --git a/repos/storage/delete_partition_volume.py b/repos/storage/delete_partition_volume.py
> index 65ef0b5..82ef18a 100644
> --- a/repos/storage/delete_partition_volume.py
> +++ b/repos/storage/delete_partition_volume.py
> @@ -108,10 +108,10 @@ def delete_partition_volume(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      storage_pool_list = stgobj.storage_pool_list()
>  
> diff --git a/repos/storage/destroy_pool.py b/repos/storage/destroy_pool.py
> index 9b99d74..e684891 100644
> --- a/repos/storage/destroy_pool.py
> +++ b/repos/storage/destroy_pool.py
> @@ -91,9 +91,9 @@ def destroy_pool(params):
>      poolname = params['poolname']
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if check_pool_existence(stgobj, poolname, logger):
>          # Make sure that the pool is active.
> diff --git a/repos/storage/pool_name.py b/repos/storage/pool_name.py
> index 15329c4..450020d 100644
> --- a/repos/storage/pool_name.py
> +++ b/repos/storage/pool_name.py
> @@ -74,11 +74,11 @@ def pool_name(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_exists(stgobj, poolname, logger):
>          logger.error("need a defined pool, may or may not be active")
> diff --git a/repos/storage/pool_uuid.py b/repos/storage/pool_uuid.py
> index ba92466..abe0706 100644
> --- a/repos/storage/pool_uuid.py
> +++ b/repos/storage/pool_uuid.py
> @@ -74,11 +74,11 @@ def pool_uuid(params):
>  
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      logger.info("the uri is %s" % uri)
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_storage_exists(stgobj, poolname, logger):
>          logger.error("need a defined pool, may or may not be active")
> diff --git a/repos/storage/undefine_pool.py b/repos/storage/undefine_pool.py
> index 8246926..7b55be8 100644
> --- a/repos/storage/undefine_pool.py
> +++ b/repos/storage/undefine_pool.py
> @@ -90,13 +90,13 @@ def undefine_pool(params):
>      util = utils.Utils()
>      uri = util.get_uri('127.0.0.1')
>  
> -    conn = connectAPI.ConnectAPI()
> -    virconn = conn.open(uri)
> +    conn = connectAPI.ConnectAPI(uri)
> +    conn.open()
>  
>      caps = conn.get_caps()
>      logger.debug(caps)
>  
> -    stgobj = storageAPI.StorageAPI(virconn)
> +    stgobj = storageAPI.StorageAPI(conn)
>  
>      if not check_pool_inactive(stgobj, poolname):
>          conn.close()

This doesn't apply on current HEAD, however it is just because of the
context part of the patch, so ACK for the same modifications when  resolved.

Martin


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