Skip to content

Commit 7e2b55e

Browse files
committed
Import patch from Helgi.
Signed-off-by: Chris Lalancette <[email protected]>
1 parent 3453c08 commit 7e2b55e

29 files changed

+1258
-87
lines changed

oz/Guest.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,28 +685,33 @@ def generate_diskimage(self, size=10, force=False):
685685
"""
686686
return self._internal_generate_diskimage(size, force, False)
687687

688-
def _get_disks_and_interfaces(self, libvirt_dom):
688+
def _get_disks_and_interfaces(self, libvirt_xml):
689689
"""
690690
Method to figure out the disks and interfaces attached to a domain.
691691
The method returns two lists: the first is a list of disk devices (like
692692
hda, hdb, etc), and the second is a list of network devices (like vnet0,
693693
vnet1, etc).
694694
"""
695-
doc = lxml.etree.fromstring(libvirt_dom.XMLDesc(0))
695+
doc = lxml.etree.fromstring(libvirt_xml)
696696
disktargets = doc.xpath("/domain/devices/disk/target")
697+
697698
if len(disktargets) < 1:
698699
raise oz.OzException.OzException("Could not find disk target")
699700
disks = []
700701
for target in disktargets:
701-
disks.append(target.get('dev'))
702+
dev = target.get('dev')
703+
if dev:
704+
disks.append(dev)
702705
if not disks:
703706
raise oz.OzException.OzException("Could not find disk target device")
704707
inttargets = doc.xpath("/domain/devices/interface/target")
705708
if len(inttargets) < 1:
706709
raise oz.OzException.OzException("Could not find interface target")
707710
interfaces = []
708711
for target in inttargets:
709-
interfaces.append(target.get('dev'))
712+
dev = target.get('dev')
713+
if dev:
714+
interfaces.append(dev)
710715
if not interfaces:
711716
raise oz.OzException.OzException("Could not find interface target device")
712717

@@ -779,7 +784,7 @@ def _wait_for_install_finish(self, libvirt_dom, count):
779784
point it is assumed the install failed and raise an exception).
780785
"""
781786

782-
disks, interfaces = self._get_disks_and_interfaces(libvirt_dom)
787+
disks, interfaces = self._get_disks_and_interfaces(libvirt_dom.XMLDesc(0))
783788

784789
last_disk_activity = 0
785790
last_network_activity = 0
@@ -1198,8 +1203,7 @@ def _modify_libvirt_xml_for_serial(self, libvirt_xml):
11981203
self.log.debug("Generated XML:\n%s", xml)
11991204
return xml
12001205

1201-
def _modify_libvirt_xml_diskimage(self, libvirt_xml, new_diskimage,
1202-
image_type):
1206+
def _modify_libvirt_xml_diskimage(self, libvirt_xml, new_diskimage, image_type):
12031207
"""
12041208
Internal method to take input libvirt XML and replace the existing disk
12051209
image details with a new disk image file and, potentially, disk image

oz/Ubuntu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def _gzip_file(self, inputfile, outputmode):
553553
# there is a bit of asymmetry here in that OSs that support cpio
554554
# archives have the initial initrdfname copied in the higher level
555555
# function, but we delete it here. OSs that don't support cpio,
556-
# though, get the initrd created right here. C'est le vie
556+
# though, get the initrd created right here. C'est la vie
557557
os.unlink(self.initrdfname)
558558
raise
559559

tests/factory/test_factory.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ def default_route():
9090
route = default_route()
9191

9292
def runtest(args):
93-
global route
94-
9593
(distro, version, arch, installtype) = args
9694
print("Testing %s-%s-%s-%s..." % (distro, version, arch, installtype), end=' ')
9795

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<domain type="qemu">
3+
<name>tester</name>
4+
<memory>1048576</memory>
5+
<currentMemory>1048576</currentMemory>
6+
<uuid>%s</uuid>
7+
<clock offset="utc"/>
8+
<vcpu>1</vcpu>
9+
<features>
10+
<acpi/>
11+
<apic/>
12+
<pae/>
13+
</features>
14+
<os>
15+
<type>hvm</type>
16+
<boot dev="hd"/>
17+
</os>
18+
<on_poweroff>destroy</on_poweroff>
19+
<on_reboot>destroy</on_reboot>
20+
<on_crash>destroy</on_crash>
21+
<devices>
22+
<graphics port="-1" type="vnc"/>
23+
<interface type="bridge">
24+
<source bridge="%s"/>
25+
<target dev="vnet7"/>
26+
<mac address="52:54:00:04:cc:a6"/>
27+
<model type="virtio"/>
28+
</interface>
29+
<input bus="ps2" type="mouse"/>
30+
<serial type="pty">
31+
<target port="0"/>
32+
</serial>
33+
<serial type="tcp">
34+
<source mode="bind" host="127.0.0.1" service="%s"/>
35+
<protocol type="raw"/>
36+
<target port="1"/>
37+
</serial>
38+
<disk device="disk" type="file">
39+
<target dev="vda" bus="virtio"/>
40+
<source file="%s"/>
41+
<driver name="qemu" type="raw"/>
42+
</disk>
43+
</devices>
44+
</domain>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0"?>
2+
<domain type="qemu">
3+
<name>tester</name>
4+
<memory>1048576</memory>
5+
<currentMemory>1048576</currentMemory>
6+
<uuid>%s</uuid>
7+
<clock offset="utc"/>
8+
<vcpu>1</vcpu>
9+
<features>
10+
<acpi/>
11+
<apic/>
12+
<pae/>
13+
</features>
14+
<os>
15+
<type>hvm</type>
16+
<boot dev="hd"/>
17+
</os>
18+
<on_poweroff>destroy</on_poweroff>
19+
<on_reboot>destroy</on_reboot>
20+
<on_crash>destroy</on_crash>
21+
<devices>
22+
<graphics port="-1" type="vnc"/>
23+
<interface type="bridge">
24+
<source bridge="%s"/>
25+
<target dev="vnet7"/>
26+
<mac address="52:54:00:04:cc:a6"/>
27+
<model type="virtio"/>
28+
</interface>
29+
<input bus="ps2" type="mouse"/>
30+
<serial type="pty">
31+
<target port="0"/>
32+
</serial>
33+
<serial type="tcp">
34+
<source mode="bind" host="127.0.0.1" service="%s"/>
35+
<protocol type="raw"/>
36+
<target port="1"/>
37+
</serial>
38+
<disk device="disk" type="file">
39+
<source file="%s"/>
40+
<driver name="qemu" type="raw"/>
41+
</disk>
42+
</devices>
43+
</domain>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<domain type="qemu">
3+
<name>tester</name>
4+
<memory>1048576</memory>
5+
<currentMemory>1048576</currentMemory>
6+
<uuid>%s</uuid>
7+
<clock offset="utc"/>
8+
<vcpu>1</vcpu>
9+
<features>
10+
<acpi/>
11+
<apic/>
12+
<pae/>
13+
</features>
14+
<os>
15+
<type>hvm</type>
16+
<boot dev="hd"/>
17+
</os>
18+
<on_poweroff>destroy</on_poweroff>
19+
<on_reboot>destroy</on_reboot>
20+
<on_crash>destroy</on_crash>
21+
<devices>
22+
<graphics port="-1" type="vnc"/>
23+
<interface type="bridge">
24+
<source bridge="%s"/>
25+
<target dev="vnet7"/>
26+
<mac address="52:54:00:04:cc:a6"/>
27+
<model type="virtio"/>
28+
</interface>
29+
<input bus="ps2" type="mouse"/>
30+
<serial type="pty">
31+
<target port="0"/>
32+
</serial>
33+
<serial type="tcp">
34+
<source mode="bind" host="127.0.0.1" service="%s"/>
35+
<protocol type="raw"/>
36+
<target port="1"/>
37+
</serial>
38+
<disk device="disk" type="file">
39+
<target bus="virtio"/>
40+
<source file="%s"/>
41+
<driver name="qemu" type="raw"/>
42+
</disk>
43+
</devices>
44+
</domain>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0"?>
2+
<domain type="qemu">
3+
<name>tester</name>
4+
<memory>1048576</memory>
5+
<currentMemory>1048576</currentMemory>
6+
<uuid>%s</uuid>
7+
<clock offset="utc"/>
8+
<vcpu>1</vcpu>
9+
<features>
10+
<acpi/>
11+
<apic/>
12+
<pae/>
13+
</features>
14+
<os>
15+
<type>hvm</type>
16+
<boot dev="hd"/>
17+
</os>
18+
<on_poweroff>destroy</on_poweroff>
19+
<on_reboot>destroy</on_reboot>
20+
<on_crash>destroy</on_crash>
21+
<devices>
22+
<graphics port="-1" type="vnc"/>
23+
<interface type="bridge">
24+
<source bridge="%s"/>
25+
<mac address="52:54:00:04:cc:a6"/>
26+
<model type="virtio"/>
27+
</interface>
28+
<input bus="ps2" type="mouse"/>
29+
<serial type="pty">
30+
<target port="0"/>
31+
</serial>
32+
<serial type="tcp">
33+
<source mode="bind" host="127.0.0.1" service="%s"/>
34+
<protocol type="raw"/>
35+
<target port="1"/>
36+
</serial>
37+
<disk device="disk" type="file">
38+
<target dev="vda" bus="virtio"/>
39+
<source file="%s"/>
40+
<driver name="qemu" type="raw"/>
41+
</disk>
42+
</devices>
43+
</domain>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<domain type="qemu">
3+
<name>tester</name>
4+
<memory>1048576</memory>
5+
<currentMemory>1048576</currentMemory>
6+
<uuid>%s</uuid>
7+
<clock offset="utc"/>
8+
<vcpu>1</vcpu>
9+
<features>
10+
<acpi/>
11+
<apic/>
12+
<pae/>
13+
</features>
14+
<os>
15+
<type>hvm</type>
16+
<boot dev="hd"/>
17+
</os>
18+
<on_poweroff>destroy</on_poweroff>
19+
<on_reboot>destroy</on_reboot>
20+
<on_crash>destroy</on_crash>
21+
<devices>
22+
<graphics port="-1" type="vnc"/>
23+
<interface type="bridge">
24+
<source bridge="%s"/>
25+
<target/>
26+
<mac address="52:54:00:04:cc:a6"/>
27+
<model type="virtio"/>
28+
</interface>
29+
<input bus="ps2" type="mouse"/>
30+
<serial type="pty">
31+
<target port="0"/>
32+
</serial>
33+
<serial type="tcp">
34+
<source mode="bind" host="127.0.0.1" service="%s"/>
35+
<protocol type="raw"/>
36+
<target port="1"/>
37+
</serial>
38+
<disk device="disk" type="file">
39+
<target dev="vda" bus="virtio"/>
40+
<source file="%s"/>
41+
<driver name="qemu" type="raw"/>
42+
</disk>
43+
</devices>
44+
</domain>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<domain type="qemu">
2+
<name>tester</name>
3+
<memory>1048576</memory>
4+
<currentMemory>1048576</currentMemory>
5+
<uuid>%s</uuid>
6+
<clock offset="utc"/>
7+
<vcpu>1</vcpu>
8+
<features>
9+
<acpi/>
10+
<apic/>
11+
<pae/>
12+
</features>
13+
<os>
14+
<type>hvm</type>
15+
<boot dev="hd"/>
16+
</os>
17+
<on_poweroff>destroy</on_poweroff>
18+
<on_reboot>destroy</on_reboot>
19+
<on_crash>destroy</on_crash>
20+
<devices>
21+
<graphics port="-1" type="vnc"/>
22+
<interface type="bridge">
23+
<source bridge="%s"/>
24+
<target dev="vnet7"/>
25+
<mac address="52:54:00:04:cc:a6"/>
26+
<model type="virtio"/>
27+
</interface>
28+
<input bus="ps2" type="mouse"/>
29+
<serial type="pty">
30+
<target port="0"/>
31+
</serial>
32+
<serial type="tcp">
33+
<source mode="bind" host="127.0.0.1" service="%s"/>
34+
<protocol type="raw"/>
35+
<target port="1"/>
36+
</serial>
37+
<disk device="disk" type="file">
38+
<target dev="vda" bus="virtio"/>
39+
<source file="%s"/>
40+
<driver name="qemu" type="raw"/>
41+
</disk>
42+
</devices>
43+
</domain>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<domain type="qemu">
2+
<name>tester</name>
3+
<memory>1048576</memory>
4+
<currentMemory>1048576</currentMemory>
5+
<uuid>%s</uuid>
6+
<clock offset="utc"/>
7+
<vcpu>1</vcpu>
8+
<features>
9+
<acpi/>
10+
<apic/>
11+
<pae/>
12+
</features>
13+
<os>
14+
<type>hvm</type>
15+
<boot dev="hd"/>
16+
</os>
17+
<on_poweroff>destroy</on_poweroff>
18+
<on_reboot>destroy</on_reboot>
19+
<on_crash>destroy</on_crash>
20+
<devices>
21+
<graphics port="-1" type="vnc"/>
22+
<interface type="bridge">
23+
<source bridge="%s"/>
24+
<target dev="vnet7"/>
25+
<mac address="52:54:00:04:cc:a6"/>
26+
<model type="virtio"/>
27+
</interface>
28+
<input bus="ps2" type="mouse"/>
29+
<serial type="pty">
30+
<target port="0"/>
31+
</serial>
32+
<serial type="tcp">
33+
<source mode="bind" host="127.0.0.1" service="%s"/>
34+
<protocol type="raw"/>
35+
<target port="1"/>
36+
</serial>
37+
<disk device="disk" type="file">
38+
<target dev="vda" bus="virtio"/>
39+
<source file="%s"/>
40+
<driver name="qemu" type="qcow2"/>
41+
</disk>
42+
</devices>
43+
</domain>

0 commit comments

Comments
 (0)