Re: [test-API PATCH 3/5] test-API: Substitute utils.Utils with utils

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

 



On 04/10/2012 03:34 PM, Osier Yang wrote:
$ for i in $(find . -type f -name "*.py"); do \
       sed -i -e 's/utils\.Utils()/utils/g' $i; \
   done
---
  repos/domain/cpu_affinity.py |    2 +-
  utils/xmlgenerator.py        |   12 ++++++------
  2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
index b4e6386..6acf260 100644
--- a/repos/domain/cpu_affinity.py
+++ b/repos/domain/cpu_affinity.py
@@ -152,7 +152,7 @@ def vcpu_affinity_check(domain_name, vcpu, expected_pinned_cpu, hypervisor):
      """check the task in the process of the running virtual machine
         grep Cpus_allowed_list /proc/PID/task/*/status
      """
-    host_kernel_version = utils.Utils().get_host_kernel_version()
+    host_kernel_version = utils.get_host_kernel_version()
      if 'qemu' in hypervisor:
          get_pid_cmd = "cat /var/run/libvirt/qemu/%s.pid" % domain_name
          status, pid = commands.getstatusoutput(get_pid_cmd)
diff --git a/utils/xmlgenerator.py b/utils/xmlgenerator.py
index 408324f..aca0062 100644
--- a/utils/xmlgenerator.py
+++ b/utils/xmlgenerator.py
@@ -208,7 +208,7 @@ def domain_xml(params, install = False):
      devices_element = domain.createElement('devices')
  #    if params['guesttype'] == 'xenfv':
  #        emulator_element = domain.createElement('emulator')
-#        host_arch = utils.Utils().get_host_arch()
+#        host_arch = utils.get_host_arch()
  #        if host_arch == 'i386' or host_arch == 'ia64':
  #            emulator_node = domain.createTextNode('/usr/lib/xen/bin/qemu-dm')
  #        elif host_arch == 'x86_64':
@@ -307,7 +307,7 @@ def disk_xml(params, cdrom = False):
          sys.exit(1)

      ### Get image path ###
-    hypertype = utils.Utils().get_hypervisor()
+    hypertype = utils.get_hypervisor()
      if not params.has_key('fullimagepath'):
          if hypertype == 'kvm':
              params['imagepath'] = '/var/lib/libvirt/images'
@@ -431,7 +431,7 @@ def interface_xml(params):
      #<model>
      # Network device model: ne2k_isa i82551 i82557b i82559er ne2k_pci
      # pcnet rtl8139 e1000 virtio
-    host_release = utils.Utils().get_host_kernel_version()
+    host_release = utils.get_host_kernel_version()
      if 'el6' in host_release:
          if params.has_key('nicmodel'):
              model_element = interface.createElement('model')
@@ -439,7 +439,7 @@ def interface_xml(params):
              interface_element.appendChild(model_element)

      #<mac>
-    MacAddr = utils.Utils().get_rand_mac()
+    MacAddr = utils.get_rand_mac()
      if params.has_key('macaddr'):
          mac_element = interface.createElement('mac')
          mac_element.setAttribute('address', params['macaddr'])
@@ -556,9 +556,9 @@ def pool_xml(params):
      ### Get image path ###
      if not params.has_key('targetpath'):
          if params['pooltype'] == 'netfs' or params['pooltype'] == 'dir':
-            if utils.Utils().get_hypervisor() == 'kvm':
+            if utils.get_hypervisor() == 'kvm':
                  params['targetpath'] = '/var/lib/libvirt/images'
-            elif utils.Utils().get_hypervisor() == 'xen':
+            elif utils.get_hypervisor() == 'xen':
                  params['targetpath'] = '/var/lib/xen/images'
              else:
                  print 'NOT supported hypervisor.'

      Thanks for the catch.
      pushed.

      Guannan Ren

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