VirtualDisk: Don't try to force cdrom target=hdc

It was required a long long time ago, before qemu supported -drive
and possibly ancient xen. Nowadays it should be pointless, and contributes
to some issues like bz 905439
This commit is contained in:
Cole Robinson 2013-10-02 20:25:42 -04:00
parent e6cebd04ca
commit 0614e490c8
20 changed files with 23 additions and 40 deletions

View File

@ -28,7 +28,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0"/>
@ -77,7 +77,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0"/>
@ -126,7 +126,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0"/>

View File

@ -29,7 +29,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="none"/>
@ -70,7 +70,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="none"/>
@ -111,7 +111,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/tmp/__virtinst_cli_exist2.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="none"/>

View File

@ -27,7 +27,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/tmp/__virtinst_cli_exist1.img"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -27,7 +27,7 @@
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -24,7 +24,7 @@
<target dev="hda" bus="ide"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -24,7 +24,7 @@
<target dev="hda" bus="ide"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -34,7 +34,7 @@
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<interface type="network">

View File

@ -26,7 +26,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -26,7 +26,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -21,7 +21,7 @@
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="cdrom">
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -28,7 +28,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -28,7 +28,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -28,7 +28,7 @@
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -29,7 +29,7 @@
</disk>
<disk type="file" device="cdrom">
<source file="/dev/null"/>
<target dev="hdc" bus="ide"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -799,20 +799,10 @@ class VirtualDisk(VirtualDevice):
@returns generated target
@rtype C{str}
"""
# Only use these targets if there are no other options
except_targets = ["hdc"]
prefix, maxnode = self.get_target_prefix()
if prefix is None:
raise ValueError(_("Cannot determine device bus/type."))
# Special case: IDE cdrom should prefer hdc for back compat
if self.is_cdrom() and prefix == "hd":
if "hdc" not in skip_targets:
self.target = "hdc"
return self.target
if maxnode > (26 * 26 * 26):
raise RuntimeError("maxnode value is too high")
@ -839,17 +829,10 @@ class VirtualDisk(VirtualDevice):
seen_valid = True
gen_t += "%c" % (ord('a') + digit - 1)
if gen_t in except_targets:
continue
if gen_t not in skip_targets:
self.target = gen_t
return self.target
# Check except_targets for any options
for t in except_targets:
if t.startswith(prefix) and t not in skip_targets:
self.target = t
return self.target
raise ValueError(_("No more space for disks of type '%s'" % prefix))
VirtualDisk.register_type()