本文整理汇总了Python中tests.utils.test_create函数的典型用法代码示例。如果您正苦于以下问题:Python test_create函数的具体用法?Python test_create怎么用?Python test_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了test_create函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _convert_helper
def _convert_helper(self, infile, outfile, in_type, disk_format):
outbuf = StringIO.StringIO()
def print_cb(msg):
print >> outbuf, msg
converter = VirtConverter(conn, infile, print_cb=print_cb)
if converter.parser.name != in_type:
raise AssertionError("find_parser_by_file for '%s' returned "
"wrong parser type.\n"
"Expected: %s\n"
"Received: %s\n" %
(infile, in_type, converter.parser.name))
converter.convert_disks(disk_format, dry=True)
guest = converter.get_guest()
ignore, out_xml = guest.start_install(return_xml=True)
out_expect = out_xml
if outbuf.getvalue():
out_expect += ("\n\n" + outbuf.getvalue().replace(base_dir, ""))
if not conn.check_support(conn.SUPPORT_CONN_VMPORT):
self.skipTest("Not comparing XML because vmport isn't supported")
utils.diff_compare(out_expect, outfile)
utils.test_create(converter.conn, out_xml)
开发者ID:BryanQuigley,项目名称:virt-manager,代码行数:26,代码来源:virtconvtest.py
示例2: _clone_define
def _clone_define(self, filebase):
"""Take the valid output xml and attempt to define it on the
connection to ensure we don't get any errors"""
outfile = os.path.join(clonexml_dir, filebase + "-out.xml")
outxml = open(outfile).read()
conn = utils.URIs.open_testdriver_cached()
utils.test_create(conn, outxml)
开发者ID:virt-manager,项目名称:virt-manager,代码行数:7,代码来源:clonetest.py
示例3: _compare
def _compare(self, guest, filebase, do_install):
filename = os.path.join("tests/xmlconfig-xml", filebase + ".xml")
inst_xml, boot_xml = guest.start_install(return_xml=True, dry=True)
if do_install:
actualXML = inst_xml
else:
actualXML = boot_xml
utils.diff_compare(actualXML, filename)
utils.test_create(guest.conn, actualXML)
开发者ID:aenertia,项目名称:virt-manager,代码行数:11,代码来源:xmlconfig.py
示例4: testISCSIPool
def testISCSIPool(self):
basename = "pool-iscsi"
infile = "tests/storage-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
pool = virtinst.StoragePool(conn, parsexml=file(infile).read())
check = self._make_checker(pool)
check("host", "some.random.hostname", "my.host")
check("iqn", "foo.bar.baz.iqn", "my.iqn")
utils.diff_compare(pool.get_xml_config(), outfile)
utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML")
开发者ID:giuseppe,项目名称:virt-manager,代码行数:12,代码来源:xmlparse.py
示例5: testInterfaceVLAN
def testInterfaceVLAN(self):
basename = "test-vlan"
infile = "tests/interface-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/interface-%s-out.xml" % basename
iface = virtinst.Interface(conn, parsexml=file(infile).read())
check = self._make_checker(iface)
check("tag", 123, 456)
check("parent_interface", "eth2", "foonew")
utils.diff_compare(iface.get_xml_config(), outfile)
utils.test_create(conn, iface.get_xml_config(), "interfaceDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:12,代码来源:xmlparse.py
示例6: testNetMulti
def testNetMulti(self):
basename = "network-multi"
infile = "tests/xmlparse-xml/%s-in.xml" % basename
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
net = virtinst.Network(conn, parsexml=file(infile).read())
check = self._make_checker(net)
check("name", "ipv6_multirange", "new-foo")
check("uuid", "41b4afe4-87bb-8087-6724-5e208a2d483a",
"41b4afe4-87bb-8087-6724-5e208a2d1111")
check("bridge", "virbr3", "virbr3new")
check("stp", True, False)
check("delay", 0, 2)
check("domain_name", "net7", "newdom")
check("ipv6", None, True)
check("macaddr", None, "52:54:00:69:eb:FF")
check = self._make_checker(net.forward)
check("mode", "nat", "route")
check("dev", None, "eth22")
self.assertEqual(len(net.ips), 4)
check = self._make_checker(net.ips[0])
check("address", "192.168.7.1", "192.168.8.1")
check("netmask", "255.255.255.0", "255.255.254.0")
check("tftp", None, "/var/lib/tftproot")
check("bootp_file", None, "pxeboot.img")
check("bootp_server", None, "1.2.3.4")
check = self._make_checker(net.ips[0].ranges[0])
check("start", "192.168.7.128", "192.168.8.128")
check("end", "192.168.7.254", "192.168.8.254")
check = self._make_checker(net.ips[0].hosts[1])
check("macaddr", "52:54:00:69:eb:91", "52:54:00:69:eb:92")
check("name", "badbob", "newname")
check("ip", "192.168.7.3", "192.168.8.3")
check = self._make_checker(net.ips[1])
check("family", "ipv6", "ipv6")
check("prefix", 64, 63)
r = net.add_route()
r.family = "ipv4"
r.address = "192.168.8.0"
r.prefix = "24"
r.gateway = "192.168.8.10"
check = self._make_checker(r)
check("netmask", None, "foo", None)
utils.diff_compare(net.get_xml_config(), outfile)
utils.test_create(conn, net.get_xml_config(), "networkDefineXML")
开发者ID:giuseppe,项目名称:virt-manager,代码行数:52,代码来源:xmlparse.py
示例7: testInterfaceBondMii
def testInterfaceBondMii(self):
basename = "test-bond-mii"
infile = "tests/interface-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/interface-%s-out.xml" % basename
iface = virtinst.Interface(conn, parsexml=file(infile).read())
check = self._make_checker(iface)
check("mii_frequency", 123, 111)
check("mii_downdelay", 34, 22)
check("mii_updelay", 12, 33)
check("mii_carrier_mode", "netif", "ioctl")
utils.diff_compare(iface.get_xml_config(), outfile)
utils.test_create(conn, iface.get_xml_config(), "interfaceDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:14,代码来源:xmlparse.py
示例8: _compare
def _compare(self, guest, filebase, do_install, do_disk_boot=False,
do_create=True):
filename = filebase and build_xmlfile(filebase) or None
guest._prepare_install(progress.BaseMeter())
try:
actualXML = guest.get_xml_config(install=do_install,
disk_boot=do_disk_boot)
if filename:
utils.diff_compare(actualXML, filename)
if do_create:
utils.test_create(guest.conn, actualXML)
finally:
guest._cleanup_install()
开发者ID:aliceinwire,项目名称:virt-manager,代码行数:15,代码来源:xmlconfig.py
示例9: testGlusterPool
def testGlusterPool(self):
if not conn.check_support(conn.SUPPORT_CONN_POOL_GLUSTERFS):
raise unittest.SkipTest("Gluster pools not supported with this "
"libvirt version.")
basename = "pool-gluster"
infile = "tests/storage-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
pool = virtinst.StoragePool(conn, parsexml=file(infile).read())
check = self._make_checker(pool)
check("host", "some.random.hostname", "my.host")
check("source_dir", None, "/foo")
utils.diff_compare(pool.get_xml_config(), outfile)
utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML")
开发者ID:giuseppe,项目名称:virt-manager,代码行数:16,代码来源:xmlparse.py
示例10: testInterfaceBondArp
def testInterfaceBondArp(self):
basename = "test-bond-arp"
infile = "tests/interface-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/interface-%s-out.xml" % basename
iface = virtinst.Interface(conn, parsexml=file(infile).read())
check = self._make_checker(iface)
check("start_mode", "onboot", "hotplug")
check("macaddr", "AA:AA:AA:AA:AA:AA", "AA:AA:AA:11:AA:AA")
check("mtu", 1501, 1234)
check("bond_mode", None, "active-backup")
check("arp_interval", 100, 234)
check("arp_target", "192.168.100.200", "1.2.3.4")
check("arp_validate_mode", "backup", "active")
utils.diff_compare(iface.get_xml_config(), outfile)
utils.test_create(conn, iface.get_xml_config(), "interfaceDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:18,代码来源:xmlparse.py
示例11: testRBDPool
def testRBDPool(self):
basename = "pool-rbd"
infile = "tests/xmlparse-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
pool = virtinst.StoragePool(conn, parsexml=file(infile).read())
check = self._make_checker(pool.hosts[0])
check("name", "ceph-mon-1.example.com")
check("port", 6789, 1234)
check = self._make_checker(pool.hosts[1])
check("name", "ceph-mon-2.example.com", "foo.bar")
check("port", 6789)
check = self._make_checker(pool.hosts[2])
check("name", "ceph-mon-3.example.com")
check("port", 6789, 1000)
pool.add_host("frobber", "5555")
utils.diff_compare(pool.get_xml_config(), outfile)
utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:19,代码来源:xmlparse.py
示例12: _compare
def _compare(self, guest, filebase, do_install, do_disk_boot=False,
do_create=True):
filename = filebase and build_xmlfile(filebase) or None
cont_xml = None
inst_xml, boot_xml = guest.start_install(return_xml=True, dry=True)
if do_disk_boot:
cont_xml, boot_xml = guest.continue_install(return_xml=True,
dry=True)
if do_disk_boot:
actualXML = cont_xml
elif do_install:
actualXML = inst_xml
else:
actualXML = boot_xml
if filename:
utils.diff_compare(actualXML, filename)
if do_create:
utils.test_create(guest.conn, actualXML)
开发者ID:TelekomCloud,项目名称:virt-manager,代码行数:21,代码来源:xmlconfig.py
示例13: testFSPool
def testFSPool(self):
basename = "pool-fs"
infile = "tests/xmlparse-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
pool = virtinst.StoragePool(conn, parsexml=file(infile).read())
check = self._make_checker(pool)
check("type", "fs", "dir")
check("name", "pool-fs", "foo-new")
check("uuid", "10211510-2115-1021-1510-211510211510",
"10211510-2115-1021-1510-211510211999")
check("capacity", 984373075968, 200000)
check("allocation", 756681687040, 150000)
check("available", 227691388928, 50000)
check("format", "auto", "ext3")
check("source_path", "/some/source/path", "/dev/foo/bar")
check("target_path", "/some/target/path", "/mnt/my/foo")
check("source_name", None, "fooname")
utils.diff_compare(pool.get_xml_config(), outfile)
utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:22,代码来源:xmlparse.py
示例14: testInterfaceBridgeIP
def testInterfaceBridgeIP(self):
basename = "test-bridge-ip"
infile = "tests/interface-xml/%s.xml" % basename
outfile = "tests/xmlparse-xml/interface-%s-out.xml" % basename
iface = virtinst.Interface(conn, parsexml=file(infile).read())
self.assertEquals(len(iface.protocols), 2)
self.assertEquals(len(iface.interfaces), 3)
check = self._make_checker(iface)
check("type", "bridge", "foo", "bridge")
check("name", "test-bridge-ip", "foo-new")
check("stp", None, True)
check("delay", None, 2)
check = self._make_checker(iface.protocols[0])
check("family", "ipv4", "foo", "ipv4")
check("dhcp_peerdns", True, False)
check("gateway", "1.2.3.4", "5.5.5.5")
self.assertEquals(iface.protocols[0].ips[1].address, "255.255.255.0")
check = self._make_checker(iface.protocols[1])
check("dhcp", True, False)
check("autoconf", True, False)
check = self._make_checker(iface.protocols[1].ips[1])
check("address", "fe80::215:58ff:fe6e:5", "2002::")
check("prefix", 64, 38)
# Remove a child interface, verify it's data remains intact
child_iface = iface.interfaces[1]
iface.remove_interface(child_iface)
check = self._make_checker(child_iface)
check("name", "bond-brbond")
self.assertEquals(len(child_iface.interfaces), 2)
utils.diff_compare(iface.get_xml_config(), outfile)
utils.test_create(conn, iface.get_xml_config(), "interfaceDefineXML")
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:39,代码来源:xmlparse.py
示例15: _convert_helper
def _convert_helper(self, infile, outfile, in_type, disk_format):
outbuf = StringIO.StringIO()
def print_cb(msg):
print >> outbuf, msg
converter = VirtConverter(conn, infile, print_cb=print_cb)
if converter.parser.name != in_type:
raise AssertionError("find_parser_by_file for '%s' returned "
"wrong parser type.\n"
"Expected: %s\n"
"Received: %s\n" %
(infile, in_type, converter.parser.name))
converter.convert_disks(disk_format, dry=True)
guest = converter.get_guest()
ignore, out_xml = guest.start_install(return_xml=True)
out_expect = out_xml
if outbuf.getvalue():
out_expect += ("\n\n" + outbuf.getvalue())
utils.diff_compare(out_expect, outfile)
utils.test_create(converter.conn, out_xml)
开发者ID:aurex-linux,项目名称:virt-manager,代码行数:23,代码来源:virtconvtest.py
示例16: _clone_define
def _clone_define(self, filebase):
"""Take the valid output xml and attempt to define it on the
connection to ensure we don't get any errors"""
outfile = os.path.join(clonexml_dir, filebase + "-out.xml")
outxml = utils.read_file(outfile)
utils.test_create(conn, outxml)
开发者ID:DanLipsitt,项目名称:virt-manager,代码行数:6,代码来源:clonetest.py
示例17: _alter_compare
def _alter_compare(self, actualXML, outfile, support_check=None):
utils.diff_compare(actualXML, outfile)
if (support_check and not conn.check_support(support_check)):
return
utils.test_create(conn, actualXML)
开发者ID:alexander-manley,项目名称:virt-manager,代码行数:5,代码来源:xmlparse.py
示例18: _alter_compare
def _alter_compare(self, actualXML, outfile):
utils.test_create(conn, actualXML)
utils.diff_compare(actualXML, outfile)
开发者ID:yumingfei,项目名称:virt-manager,代码行数:3,代码来源:xmlparse.py
注:本文中的tests.utils.test_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论