On 04/19/2012 10:25 AM, Osier Yang wrote:
We use foo_bar across the project (except the main program), though
it might be not good to use "foo_bar" as the module name in Python,
but let's unify it first.
---
.../en-US/Understanding_libvirt-test-API.xml | 4 +-
.../en-US/Writing_a_test_case.xml | 8 ++--
libvirt-test-api | 8 ++--
repos/domain/attach_disk.py | 4 +-
repos/domain/attach_interface.py | 4 +-
repos/domain/create.py | 4 +-
repos/domain/define.py | 4 +-
repos/domain/detach_disk.py | 4 +-
repos/domain/detach_interface.py | 4 +-
repos/domain/install_image.py | 4 +-
repos/domain/install_linux_cdrom.py | 6 +-
repos/domain/install_linux_net.py | 6 +-
repos/domain/install_windows_cdrom.py | 6 +-
repos/domain/migrate.py | 2 +-
repos/domain/update_devflag.py | 6 +-
repos/interface/create.py | 2 +-
repos/interface/define.py | 4 +-
repos/interface/destroy.py | 2 +-
repos/interface/undefine.py | 2 +-
repos/network/create.py | 4 +-
repos/network/define.py | 4 +-
repos/npiv/create_virtual_hba.py | 4 +-
.../multiple_thread_block_on_domain_create.py | 4 +-
repos/snapshot/internal_create.py | 4 +-
repos/storage/activate_pool.py | 2 +-
repos/storage/create_dir_pool.py | 4 +-
repos/storage/create_dir_volume.py | 4 +-
repos/storage/create_fs_pool.py | 8 ++--
repos/storage/create_iscsi_pool.py | 4 +-
repos/storage/create_logical_volume.py | 4 +-
repos/storage/create_netfs_pool.py | 8 ++--
repos/storage/create_netfs_volume.py | 4 +-
repos/storage/create_partition_volume.py | 4 +-
repos/storage/define_dir_pool.py | 4 +-
repos/storage/define_disk_pool.py | 4 +-
repos/storage/define_iscsi_pool.py | 4 +-
repos/storage/define_logical_pool.py | 4 +-
repos/storage/define_mpath_pool.py | 4 +-
repos/storage/define_netfs_pool.py | 4 +-
repos/storage/define_scsi_pool.py | 4 +-
repos/storage/delete_partition_volume.py | 2 +-
repos/storage/destroy_pool.py | 2 +-
src/logxmlparser.py | 2 +-
utils/{xmlbuilder.py => xml_builder.py} | 44 ++++++++++----------
utils/{xmlgenerator.py => xml_generator.py} | 2 +-
utils/{XMLParser.py => xml_parser.py} | 8 ++--
46 files changed, 117 insertions(+), 117 deletions(-)
rename utils/{xmlbuilder.py => xml_builder.py} (91%)
rename utils/{xmlgenerator.py => xml_generator.py} (99%)
rename utils/{XMLParser.py => xml_parser.py} (96%)
diff --git
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
index 7fe1e97..88c1b76 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
@@ -197,10 +197,10 @@ repos
<para><filename>/utils</filename> is a directory which
contains various scripts to assist in creating and verifying test cases.</para>
<!--<itemizedlist>
<listitem>
-<para><filename>xmlgenerator.py</filename>XML generator.</para>
+<para><filename>xml_generator.py</filename>XML
generator.</para>
</listitem>
<listitem>
-<para><filename>xmlbuilder.py</filename> builds a virtual machine
from an XML file.</para>
+<para><filename>xml_builder.py</filename> builds a virtual machine
from an XML file.</para>
</listitem>
<listitem>
<para>Random MAC address generator. Useful when installing a guest
machine.</para>
diff --git a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 21c4ac6..2a74518 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -142,7 +142,7 @@ import exception
from lib import connectAPI
from lib import storageAPI
from utils import env_parser
-from utils import xmlbuilder
+from utils import xml_builder
envfile = 'env.ini'
@@ -154,7 +154,7 @@ def initialize_storage(dict):
dict['sourcepath'] = envparser.get_value('storage',
'sourcepath')
logger.info('prepare create storage pool')
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(dict)
logger.debug('dump create storage pool xml:\n%s' %poolxml)
@@ -201,7 +201,7 @@ import exception
from lib import connectAPI
from lib import domainAPI
from utils import env_parser
-from utils import xmlbuilder
+from utils import xml_builder
envfile = 'env.ini'
@@ -246,7 +246,7 @@ def install_guest(dict):
logger.info('prepare installation booting cdrom')
prepare_cdrom(url, dict['kickstart'], gname, logger)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
guestinstxml = xmlobj.build_domain_install(dict)
logger.debug('dump installation guest xml:\n%s' %guestinstxml)
diff --git a/libvirt-test-api b/libvirt-test-api
index 7eaaf21..62e18f6 100755
--- a/libvirt-test-api
+++ b/libvirt-test-api
@@ -28,7 +28,7 @@ from src import generator
from src import env_clear
from src import process
from utils import log
-from src.logxmlparser import LogXMLParser
+from src.logxmlparser import Logxml_parser
from src.activityfilter import Filter
from src.casecfgcheck import CaseCfgCheck
@@ -93,7 +93,7 @@ class Main(object):
testrunid = time.strftime("%Y%m%d%H%M%S")
os.makedirs('log/%s' %testrunid)
- log_xml_parser = LogXMLParser(self.logxml)
+ log_xml_parser = Logxml_parser(self.logxml)
# If the specified log xmlfile exists, then append the testrun
# item of this time to the file, if not, create a new log xmlfile
@@ -256,7 +256,7 @@ class Main(object):
def remove_log(self, testrunid, testid = None):
""" to remove log item in the log xmlfile """
- log_xml_parser = LogXMLParser(self.logxml)
+ log_xml_parser = Logxml_parser(self.logxml)
# remove a test in a testrun
if testrunid and testid:
@@ -289,7 +289,7 @@ class Main(object):
def merge_logxmls(self, logxml_two):
""" to merge two log xml files of log into
one"""
- log_xml_parser = LogXMLParser(self.logxml)
+ log_xml_parser = Logxml_parser(self.logxml)
log_xml_parser.merge_xmlfiles(logxml_two)
print "Merge the second log xml file %s to %s successfully " % \
(logxml_two, self.logxml)
diff --git a/repos/domain/attach_disk.py b/repos/domain/attach_disk.py
index fc0e611..4711ad1 100644
--- a/repos/domain/attach_disk.py
+++ b/repos/domain/attach_disk.py
@@ -12,7 +12,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname',
'virt_type',
@@ -68,7 +68,7 @@ def attach_disk(params):
domobj = conn.lookupByName(guestname)
# Generate disk xml
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.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 5c9c507..4d605f9 100644
--- a/repos/domain/attach_interface.py
+++ b/repos/domain/attach_interface.py
@@ -10,7 +10,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'ifacetype', 'source',)
optional_params = ('hdmodel',)
@@ -40,7 +40,7 @@ def attach_interface(params):
domobj = conn.lookupByName(guestname)
# Generate interface xml
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
interfacexml = xmlobj.build_interface(params)
logger.debug("interface xml:\n%s" %interfacexml)
diff --git a/repos/domain/create.py b/repos/domain/create.py
index 9f2f5e1..ed96b36 100644
--- a/repos/domain/create.py
+++ b/repos/domain/create.py
@@ -11,7 +11,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
NONE = 0
START_PAUSED = 1
@@ -43,7 +43,7 @@ def create(params):
conn = sharedmod.libvirtobj['conn']
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
domain = xmlobj.add_domain(params)
xmlobj.add_disk(params, domain)
xmlobj.add_interface(params, domain)
diff --git a/repos/domain/define.py b/repos/domain/define.py
index dae1062..92a98f6 100644
--- a/repos/domain/define.py
+++ b/repos/domain/define.py
@@ -12,7 +12,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'virt_type',)
optional_params = ('uuid',
@@ -70,7 +70,7 @@ def define(params):
logger.info("define domain on %s" % uri)
# Generate damain xml
- xml_obj = xmlbuilder.XmlBuilder()
+ xml_obj = xml_builder.XmlBuilder()
domain = xml_obj.add_domain(params)
xml_obj.add_disk(params, domain)
xml_obj.add_interface(params, domain)
diff --git a/repos/domain/detach_disk.py b/repos/domain/detach_disk.py
index da25c8f..d723474 100644
--- a/repos/domain/detach_disk.py
+++ b/repos/domain/detach_disk.py
@@ -11,7 +11,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'virt_type', 'imagename',
'hdmodel',)
optional_params = ()
@@ -45,7 +45,7 @@ def detach_disk(params):
domobj = conn.lookupByName(guestname)
# Detach disk
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.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 c444b68..82deffb 100644
--- a/repos/domain/detach_interface.py
+++ b/repos/domain/detach_interface.py
@@ -11,7 +11,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'ifacetype', 'source',
'nicmodel',)
optional_params = ()
@@ -47,7 +47,7 @@ def detach_interface(params):
conn = sharedmod.libvirtobj['conn']
domobj = conn.lookupByName(guestname)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
ifacexml = xmlobj.build_interface(params)
logger.debug("interface xml:\n%s" % ifacexml)
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index 2ab97a0..be36b03 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -13,7 +13,7 @@ from libvirt import libvirtError
from src import sharedmod
from src import env_parser
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
HOME_PATH = os.getcwd()
@@ -72,7 +72,7 @@ def install_image(params):
conn = sharedmod.libvirtobj['conn']
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
domain = xmlobj.add_domain(params)
xmlobj.add_disk(params, domain)
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 235f587..ee3c397 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -16,7 +16,7 @@ from libvirt import libvirtError
from src import sharedmod
from src import env_parser
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'virt_type', 'guestos',
'guestarch',)
optional_params = ('uuid',
@@ -93,7 +93,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
guestname = params['guestname']
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
domain = xmlobj.add_domain(params)
xmlobj.add_disk(params, domain)
@@ -258,7 +258,7 @@ def install_linux_cdrom(params):
logger.error("unknown virt type: %s" % virt_type)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
guestxml = xmlobj.build_domain_install(params)
logger.debug('dump installation guest xml:\n%s' % guestxml)
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index 9841eed..105c0ea 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -16,7 +16,7 @@ from libvirt import libvirtError
from src import sharedmod
from src import env_parser
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'virt_type', 'guestos',
'guestarch','netmethod',)
optional_params = ('uuid',
@@ -50,7 +50,7 @@ def prepare_boot_guest(domobj, dict, logger, installtype):
guestname = params['guestname']
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
domain = xmlobj.add_domain(params)
xmlobj.add_disk(params, domain)
@@ -240,7 +240,7 @@ def install_linux_net(params):
logger.error("unknown virt type %s" % virt_type)
# Prepare guest installation xml
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
guestxml = xmlobj.build_domain_install(params)
logger.debug('dump installation guest xml:\n%s' % guestxml)
diff --git a/repos/domain/install_windows_cdrom.py
b/repos/domain/install_windows_cdrom.py
index 6cec08a..825aa29 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -15,7 +15,7 @@ from libvirt import libvirtError
from src import sharedmod
from src import env_parser
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
VIRSH_QUIET_LIST = "virsh --quiet list --all|awk '{print $2}'|grep
\"^%s$\""
VM_STAT = "virsh --quiet list --all| grep \"\\b%s\\b\"|grep off"
@@ -152,7 +152,7 @@ def prepare_boot_guest(domobj, dict, installtype):
guestname = params['guestname']
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
domain = xmlobj.add_domain(params)
xmlobj.add_disk(params, domain)
@@ -285,7 +285,7 @@ def install_windows_cdrom(params):
return 1
params['floppysource'] = FLOOPY_IMG
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
guestxml = xmlobj.build_domain_install_win(params)
logger.debug('dump installation guest xml:\n%s' % guestxml)
diff --git a/repos/domain/migrate.py b/repos/domain/migrate.py
index 2e6b40d..7a38a29 100644
--- a/repos/domain/migrate.py
+++ b/repos/domain/migrate.py
@@ -11,7 +11,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('transport',
'target_machine',
diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
index 9286918..6c75fd6 100644
--- a/repos/domain/update_devflag.py
+++ b/repos/domain/update_devflag.py
@@ -12,7 +12,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname', 'devtype', 'username',
'password',)
optional_params = ()
@@ -192,7 +192,7 @@ def update_devflag(params):
guestobj = minidom.parseString(guestxml)
# Generat device XML for original use
- origxmlobj = xmlbuilder.XmlBuilder()
+ origxmlobj = xml_builder.XmlBuilder()
if devtype == 'cdrom':
origxmlobj.add_cdrom(xmlargs, guestobj)
@@ -217,7 +217,7 @@ def update_devflag(params):
return 1
# Generate device XML for updating
- newxmlobj = xmlbuilder.XmlBuilder()
+ newxmlobj = xml_builder.XmlBuilder()
if devtype == 'cdrom':
xmlargs['bootcd'] = '/var/lib/libvirt/boot/cdrom-new.img'
diff --git a/repos/interface/create.py b/repos/interface/create.py
index 9df3464..3afcafb 100644
--- a/repos/interface/create.py
+++ b/repos/interface/create.py
@@ -10,7 +10,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('ifacename',)
optional_params = ()
diff --git a/repos/interface/define.py b/repos/interface/define.py
index 630ae45..4d39e6a 100644
--- a/repos/interface/define.py
+++ b/repos/interface/define.py
@@ -8,7 +8,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('ifacename', 'ifacetype',)
optional_params = ()
@@ -37,7 +37,7 @@ def define(params):
logger.error("interface %s have been defined" % ifacename)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
iface_xml = xmlobj.build_host_interface(params)
logger.debug("interface xml:\n%s" %iface_xml)
diff --git a/repos/interface/destroy.py b/repos/interface/destroy.py
index 7dc0320..4dcfc73 100644
--- a/repos/interface/destroy.py
+++ b/repos/interface/destroy.py
@@ -10,7 +10,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('ifacename',)
optional_params = ()
diff --git a/repos/interface/undefine.py b/repos/interface/undefine.py
index 757d3f9..85d4489 100644
--- a/repos/interface/undefine.py
+++ b/repos/interface/undefine.py
@@ -8,7 +8,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('ifacename',)
optional_params = ()
diff --git a/repos/network/create.py b/repos/network/create.py
index d50c84d..8fc87a2 100644
--- a/repos/network/create.py
+++ b/repos/network/create.py
@@ -10,7 +10,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('networkname',
'bridgename',
@@ -46,7 +46,7 @@ def create(params):
logger.error("the %s network is running" % networkname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
netxml = xmlobj.build_network(params)
logger.debug("%s network xml:\n%s" % (networkname, netxml))
diff --git a/repos/network/define.py b/repos/network/define.py
index 8c02d2a..beafe1d 100644
--- a/repos/network/define.py
+++ b/repos/network/define.py
@@ -10,7 +10,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('networkname',
'bridgename',
@@ -49,7 +49,7 @@ def define(params):
logger.error("%s network is defined" % networkname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
netxml = xmlobj.build_network(params)
logger.debug("network xml:\n%s" % netxml)
diff --git a/repos/npiv/create_virtual_hba.py b/repos/npiv/create_virtual_hba.py
index a558fbc..a5005ca 100644
--- a/repos/npiv/create_virtual_hba.py
+++ b/repos/npiv/create_virtual_hba.py
@@ -6,7 +6,7 @@ import sys
import re
import commands
import xml.dom.minidom
-from utils import xmlbuilder
+from utils import xml_builder
import libvirt
from libvirt import libvirtError
@@ -70,7 +70,7 @@ def create_virtual_hba(params):
else:
logger.info("No NPIV capabilities on '%s'" % fc_name)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
nodedev_xml = xmlobj.build_nodedev(params)
logger.debug("node device xml:\n%s" % nodedev_xml)
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py
b/repos/regression/multiple_thread_block_on_domain_create.py
index a72fdaf..1c85706 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -16,7 +16,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
from utils import env_parser
-from utils import xmlbuilder
+from utils import xml_builder
IMAG_PATH = "/var/lib/libvirt/images/"
DISK_DD = "dd if=/dev/zero of=%s bs=1 count=1 seek=6G"
@@ -76,7 +76,7 @@ class guest_install(Thread):
else:
self.logger.info("creating disk images file is successful.")
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
guestxml = xmlobj.build_domain_install(guest_params)
self.logger.debug("guestxml is %s" % guestxml)
self.logger.info('create guest %sfrom xml description' % self.name)
diff --git a/repos/snapshot/internal_create.py b/repos/snapshot/internal_create.py
index d0f3906..6ddf350 100644
--- a/repos/snapshot/internal_create.py
+++ b/repos/snapshot/internal_create.py
@@ -11,7 +11,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('guestname',)
optional_params = ('snapshotname',)
@@ -63,7 +63,7 @@ def internal_create(params):
logger.error("checking failed")
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
snapshot_xml = xmlobj.build_domain_snapshot(params)
logger.debug("%s snapshot xml:\n%s" % (guestname, snapshot_xml))
diff --git a/repos/storage/activate_pool.py b/repos/storage/activate_pool.py
index 3954457..51aa7fc 100644
--- a/repos/storage/activate_pool.py
+++ b/repos/storage/activate_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname',)
optional_params = ()
diff --git a/repos/storage/create_dir_pool.py b/repos/storage/create_dir_pool.py
index 067ae92..5747585 100644
--- a/repos/storage/create_dir_pool.py
+++ b/repos/storage/create_dir_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype',)
optional_params = ()
@@ -45,7 +45,7 @@ def create_dir_pool(params):
logger.error("%s storage pool has already been created" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/create_dir_volume.py b/repos/storage/create_dir_volume.py
index 155eb3b..41fb270 100644
--- a/repos/storage/create_dir_volume.py
+++ b/repos/storage/create_dir_volume.py
@@ -11,7 +11,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'volname', 'volformat',
'capacity',)
optional_params = ()
@@ -112,7 +112,7 @@ def create_dir_volume(params):
the volume information in the pool %s" % poolname)
virsh_vol_list(poolname)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
volumexml = xmlobj.build_volume(params)
logger.debug("volume xml:\n%s" % volumexml)
diff --git a/repos/storage/create_fs_pool.py b/repos/storage/create_fs_pool.py
index 7daf5f6..9bff2c7 100644
--- a/repos/storage/create_fs_pool.py
+++ b/repos/storage/create_fs_pool.py
@@ -9,8 +9,8 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
-from utils import XMLParser
+from utils import xml_builder
+from utils import xml_parser
required_params = ('poolname', 'sourcepath', 'pooltype',)
optional_params = ('sourceformat',)
@@ -30,7 +30,7 @@ def check_pool_create_libvirt(conn, poolname, logger):
def check_pool_create_OS(poolobj, logger):
"""Check the result of create storage pool on OS level.
"""
poolxml = poolobj.XMLDesc(0)
- out = XMLParser.XMLParser().parse(poolxml)
+ out = xml_parser.xml_parser().parse(poolxml)
src_path =
out["source"]["device"]["attr"]["path"]
dest_path = out["target"]["path"]
logger.info("src path: %s tgt path: %s" % (src_path, dest_path))
@@ -64,7 +64,7 @@ def create_fs_pool(params):
logger.error("%s storage pool has already been created" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/create_iscsi_pool.py b/repos/storage/create_iscsi_pool.py
index f108a59..85428cd 100644
--- a/repos/storage/create_iscsi_pool.py
+++ b/repos/storage/create_iscsi_pool.py
@@ -8,7 +8,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'sourcename', 'sourcepath',
'pooltype',)
optional_params = ()
@@ -44,7 +44,7 @@ def create_iscsi_pool(params):
logger.error("%s storage pool has already been created" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/create_logical_volume.py
b/repos/storage/create_logical_volume.py
index 714480c..294ac73 100644
--- a/repos/storage/create_logical_volume.py
+++ b/repos/storage/create_logical_volume.py
@@ -12,7 +12,7 @@ from libvirt import libvirtError
from src import sharedmod
from utils import utils
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'volname',
'capacity',)
optional_params = ()
@@ -101,7 +101,7 @@ def create_logical_volume(params):
params['volpath'] = "%s/%s" % (poolpath, volname)
logger.debug("volume target path: %s" % params['volpath'])
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
volxml = xmlobj.build_volume(params)
logger.debug("storage volume xml:\n%s" % volxml)
diff --git a/repos/storage/create_netfs_pool.py b/repos/storage/create_netfs_pool.py
index 2a0cd23..e16ea63 100644
--- a/repos/storage/create_netfs_pool.py
+++ b/repos/storage/create_netfs_pool.py
@@ -9,8 +9,8 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
-from utils import XMLParser
+from utils import xml_builder
+from utils import xml_parser
required_params = ('poolname', 'sourcename', 'sourcepath',
'pooltype',)
optional_params = ('targetpath',)
@@ -36,7 +36,7 @@ def check_pool_create_OS(conn, poolname, logger):
poolobj = conn.storagePoolLookupByName(poolname)
poolxml = poolobj.XMLDesc(0)
# parse the xml to see where this is mounted...
- out = XMLParser.XMLParser().parse(poolxml)
+ out = xml_parser.xml_parser().parse(poolxml)
dest_path = out["target"]["path"]
src_host =
out["source"]["host"]["attr"]["name"]
src_path =
out["source"]["dir"]["attr"]["path"]
@@ -71,7 +71,7 @@ def create_netfs_pool(params):
logger.error("%s storage pool has already been created" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/create_netfs_volume.py b/repos/storage/create_netfs_volume.py
index e5f711a..da96f53 100644
--- a/repos/storage/create_netfs_volume.py
+++ b/repos/storage/create_netfs_volume.py
@@ -11,7 +11,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'volname', 'volformat',
'capacity',)
optional_params = ()
@@ -112,7 +112,7 @@ def create_netfs_volume(params):
ouput the volume information in the pool %s" % poolname)
virsh_vol_list(poolname)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
volumexml = xmlobj.build_volume(params)
logger.debug("volume xml:\n%s" % volumexml)
diff --git a/repos/storage/create_partition_volume.py
b/repos/storage/create_partition_volume.py
index 3ba802b..317697e 100644
--- a/repos/storage/create_partition_volume.py
+++ b/repos/storage/create_partition_volume.py
@@ -10,7 +10,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'volname', 'volformat',
'capacity',)
optional_params = ()
@@ -82,7 +82,7 @@ def create_partition_volume(params):
ouput the volume information in the pool %s" % poolname)
virsh_vol_list(poolname)
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
volumexml = xmlobj.build_volume(params)
logger.debug("volume xml:\n%s" % volumexml)
diff --git a/repos/storage/define_dir_pool.py b/repos/storage/define_dir_pool.py
index b45767d..0c8dbb7 100644
--- a/repos/storage/define_dir_pool.py
+++ b/repos/storage/define_dir_pool.py
@@ -10,7 +10,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
VIRSH_POOLLIST = "virsh --quiet pool-list --all|awk '{print $1}'|grep
\"^%s$\""
POOL_STAT = "virsh --quiet pool-list --all|grep \"^%s\\b\" |grep
\"inactive\""
@@ -53,7 +53,7 @@ def define_dir_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_disk_pool.py b/repos/storage/define_disk_pool.py
index 619292f..56a2f09 100644
--- a/repos/storage/define_disk_pool.py
+++ b/repos/storage/define_disk_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'sourcepath',)
optional_params = ('sourceformat', 'targetpath',)
@@ -54,7 +54,7 @@ def define_disk_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_iscsi_pool.py b/repos/storage/define_iscsi_pool.py
index fdb09a2..1a1e247 100644
--- a/repos/storage/define_iscsi_pool.py
+++ b/repos/storage/define_iscsi_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'sourcename',
'sourcepath',)
optional_params = ()
@@ -57,7 +57,7 @@ def define_iscsi_pool(params):
logger.error("%s storage pool is ALREADY defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_logical_pool.py b/repos/storage/define_logical_pool.py
index ebbdc76..869f2c5 100644
--- a/repos/storage/define_logical_pool.py
+++ b/repos/storage/define_logical_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'sourcename',
'sourcepath',)
optional_params = ()
@@ -42,7 +42,7 @@ def define_logical_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_mpath_pool.py b/repos/storage/define_mpath_pool.py
index 930f9b8..0780706 100644
--- a/repos/storage/define_mpath_pool.py
+++ b/repos/storage/define_mpath_pool.py
@@ -8,7 +8,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype',)
optional_params = ('targetpath',)
@@ -50,7 +50,7 @@ def define_mpath_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_netfs_pool.py b/repos/storage/define_netfs_pool.py
index e607da2..d0fdf12 100644
--- a/repos/storage/define_netfs_pool.py
+++ b/repos/storage/define_netfs_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'sourcename',
'sourcepath',)
optional_params = ('targetpath',)
@@ -42,7 +42,7 @@ def define_netfs_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/define_scsi_pool.py b/repos/storage/define_scsi_pool.py
index 8be591a..c486a95 100644
--- a/repos/storage/define_scsi_pool.py
+++ b/repos/storage/define_scsi_pool.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'pooltype', 'sourcename',)
optional_params = ('targetpath',)
@@ -54,7 +54,7 @@ def define_scsi_pool(params):
logger.error("%s storage pool is defined" % poolname)
return 1
- xmlobj = xmlbuilder.XmlBuilder()
+ xmlobj = xml_builder.XmlBuilder()
poolxml = xmlobj.build_pool(params)
logger.debug("storage pool xml:\n%s" % poolxml)
diff --git a/repos/storage/delete_partition_volume.py
b/repos/storage/delete_partition_volume.py
index b70ff45..17a4cd9 100644
--- a/repos/storage/delete_partition_volume.py
+++ b/repos/storage/delete_partition_volume.py
@@ -9,7 +9,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname', 'volname',)
optional_params = ()
diff --git a/repos/storage/destroy_pool.py b/repos/storage/destroy_pool.py
index 304f1bb..8566a84 100644
--- a/repos/storage/destroy_pool.py
+++ b/repos/storage/destroy_pool.py
@@ -8,7 +8,7 @@ import libvirt
from libvirt import libvirtError
from src import sharedmod
-from utils import xmlbuilder
+from utils import xml_builder
required_params = ('poolname',)
optional_params = ()
diff --git a/src/logxmlparser.py b/src/logxmlparser.py
index 3b377ce..36d743e 100644
--- a/src/logxmlparser.py
+++ b/src/logxmlparser.py
@@ -24,7 +24,7 @@ from xml.dom.minidom import Document
from src import exception
-class LogXMLParser(object):
+class Logxml_parser(object):
""" Generate and parser log xml file
"""
def __init__(self, logxml):
diff --git a/utils/xmlbuilder.py b/utils/xml_builder.py
similarity index 91%
rename from utils/xmlbuilder.py
rename to utils/xml_builder.py
index 85cda03..435aa84 100644
--- a/utils/xmlbuilder.py
+++ b/utils/xml_builder.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# xmlbuilder.py: Class for building XML for libvirt objects.
+# xml_builder.py: Class for building XML for libvirt objects.
#
# Copyright (C) 2010-2012 Red Hat, Inc.
#
@@ -21,7 +21,7 @@ __DEBUG__ = False
import os, sys
import xml.dom.minidom
-import xmlgenerator
+import xml_generator
class XmlBuilder:
"""Operation for building domain xml"""
@@ -29,43 +29,43 @@ class XmlBuilder:
print doc.toprettyxml()
def add_domain(self, params):
- domain = xmlgenerator.domain_xml(params)
+ domain = xml_generator.domain_xml(params)
return domain
def add_disk(self, params, domain):
- disk = xmlgenerator.disk_xml(params)
+ disk = xml_generator.disk_xml(params)
disk_node = domain.importNode(disk.childNodes[0], True)
domain.getElementsByTagName("devices")[0].insertBefore(
disk_node, domain.getElementsByTagName("console")[0])
def add_floppy(self, params, domain):
- floppy = xmlgenerator.floppy_xml(params)
+ floppy = xml_generator.floppy_xml(params)
floppy_node = domain.importNode(floppy.childNodes[0], True)
domain.getElementsByTagName("devices")[0].insertBefore(
floppy_node, domain.getElementsByTagName("console")[0])
def add_cdrom(self, params, domain):
- cdrom = xmlgenerator.disk_xml(params, True)
+ cdrom = xml_generator.disk_xml(params, True)
cdrom_node = domain.importNode(cdrom.childNodes[0], True)
domain.getElementsByTagName("devices")[0].insertBefore(
cdrom_node, domain.getElementsByTagName("console")[0])
def add_interface(self, params, domain):
- interface = xmlgenerator.interface_xml(params)
+ interface = xml_generator.interface_xml(params)
interface_node = domain.importNode(interface.childNodes[0], True)
domain.getElementsByTagName("devices")[0].insertBefore(
interface_node, domain.getElementsByTagName("console")[0])
return interface
def add_hostdev(self, params, domain):
- hostdev = xmlgenerator.hostdev_xml(params)
+ hostdev = xml_generator.hostdev_xml(params)
hostdev_node = domain.importNode(hostdev.childNodes[0], True)
domain.getElementsByTagName("devices")[0].insertBefore(
hostdev_node, domain.getElementsByTagName("console")[0])
return hostdev
def build_domain_install(self, params):
- domain = xmlgenerator.domain_xml(params, True)
+ domain = xml_generator.domain_xml(params, True)
self.add_disk(params, domain)
if params['virt_type'] != 'xenpv':
if params.has_key('bootcd'):
@@ -76,7 +76,7 @@ class XmlBuilder:
return domain.toxml()
def build_domain_install_win(self, params):
- domain = xmlgenerator.domain_xml(params, True)
+ domain = xml_generator.domain_xml(params, True)
self.add_disk(params, domain)
self.add_floppy(params, domain)
if params.has_key('bootcd'):
@@ -102,7 +102,7 @@ class XmlBuilder:
else:
print 'Wrong harddisk model.'
- disk = xmlgenerator.disk_xml(params)
+ disk = xml_generator.disk_xml(params)
if params['virt_type'] == 'xenpv':
disk.getElementsByTagName("target")[0].setAttribute("dev",
"xvdb")
else:
@@ -123,7 +123,7 @@ class XmlBuilder:
else:
print 'Wrong cdrom model.'
- cdrom = xmlgenerator.disk_xml(params, True)
+ cdrom = xml_generator.disk_xml(params, True)
if params['virt_type'] == 'xenpv':
cdrom.getElementsByTagName("target")[0].setAttribute("dev",
"xvdc")
else:
@@ -134,61 +134,61 @@ class XmlBuilder:
return cdrom.toxml()
def build_floppy(self, params):
- floppy = xmlgenerator.floppy_xml(params)
+ floppy = xml_generator.floppy_xml(params)
if __DEBUG__:
self.write_toxml(floppy)
return floppy.toxml()
def build_interface(self, params):
- interface = xmlgenerator.interface_xml(params)
+ interface = xml_generator.interface_xml(params)
if __DEBUG__:
self.write_toxml(interface)
return interface.toxml()
def build_hostdev(self, params):
- hostdev = xmlgenerator.hostdev_xml(params)
+ hostdev = xml_generator.hostdev_xml(params)
if __DEBUG__:
self.write_toxml(hostdev)
return hostdev.toxml()
def build_pool(self, params):
- pool = xmlgenerator.pool_xml(params)
+ pool = xml_generator.pool_xml(params)
if __DEBUG__:
self.write_toxml(pool)
return pool.toxml()
def build_volume(self, params):
- volume = xmlgenerator.volume_xml(params)
+ volume = xml_generator.volume_xml(params)
if __DEBUG__:
self.write_toxml(volume)
return volume.toxml()
def build_network(self, params):
- network = xmlgenerator.network_xml(params)
+ network = xml_generator.network_xml(params)
if __DEBUG__:
self.write_toxml(network)
return network.toxml()
def build_host_interface(self, params):
- interface = xmlgenerator.host_iface_xml(params)
+ interface = xml_generator.host_iface_xml(params)
if __DEBUG__:
self.write_toxml(interface)
return interface.toxml()
def build_domain_snapshot(self, params):
- snapshot = xmlgenerator.snapshot_xml(params)
+ snapshot = xml_generator.snapshot_xml(params)
if __DEBUG__:
self.write_toxml(snapshot)
return snapshot.toxml()
def build_secret(self, params):
- secret = xmlgenerator.secret_xml(params)
+ secret = xml_generator.secret_xml(params)
if __DEBUG__:
self.write_toxml(secret)
return secret.toxml()
def build_nodedev(self, params):
- nodedev = xmlgenerator.nodedev_xml(params)
+ nodedev = xml_generator.nodedev_xml(params)
if __DEBUG__:
self.write_toxml(nodedev)
return nodedev.toxml()
diff --git a/utils/xmlgenerator.py b/utils/xml_generator.py
similarity index 99%
rename from utils/xmlgenerator.py
rename to utils/xml_generator.py
index c2bdec5..e173543 100644
--- a/utils/xmlgenerator.py
+++ b/utils/xml_generator.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# xmlgenerator.py: Generate XML for libvirt objects.
+# xml_generator.py: Generate XML for libvirt objects.
#
# Copyright (C) 2010-2012 Red Hat, Inc.
#
diff --git a/utils/XMLParser.py b/utils/xml_parser.py
similarity index 96%
rename from utils/XMLParser.py
rename to utils/xml_parser.py
index 20a376e..04e7501 100644
--- a/utils/XMLParser.py
+++ b/utils/xml_parser.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# XMLParser.py: Parse XML document, the result is a python dict.
+# xml_parser.py: Parse XML document, the result is a python dict.
#
# Copyright (C) 2010-2012 Red Hat, Inc.
#
@@ -21,8 +21,8 @@ import os
from xml.dom import minidom
import StringIO
-class XMLParser(object):
- """Class XMLParser. It parses and xml document into a python
dictionary.
+class xml_parser(object):
+ """Class xml_parser. It parses and xml document into a python
dictionary.
The elements of the xml documents will be python dictionary keys. For
example, the xml document:
<firstel>firstdata</firstel>
@@ -32,7 +32,7 @@ class XMLParser(object):
will be parsed into the python dictionary:
{ "firstel":"firstdata" ,
"secondel":{"subsinsecond":"seconddata"} }
Then the data can be retrieve as:
- out = XMLParser.XMLParser().parse(xml)
+ out = xml_parser.xml_parser().parse(xml)
out["firstel"] (this will be firstdata )
out["secondel"]["subinsecond"] (this will be seconddata)
ACK
Guannan Ren