[virt-tools-list] [virt-manager] Disk target generation for new machines
Martin Kletzander
mkletzan at redhat.com
Tue Jul 9 10:18:11 UTC 2013
Hi,
I'm trying to fix one problem in VMM and after several hours, I came to
a conclusion that I'll ask on a list for hints. When creating new
machine, we create a disk without bus/target and thus there is a
conflict in case user adds one more disk with the default bus. The
problem is that the new disk gets generates target like 'vda' (neither
target nor bus are known for the default disk, so the targets that
should be skipped contain only '[None, None]').
I managed to "fix" it simply by the following patch (which should be
applied anyway, since it fixes one apparent problem itself), but the
problem with the approach is that the default disk gets generated after
all the other disks ('vdb' if you add one disk). Removing all the
targets is obviously not a choice.
But when the additional disk gets added, all the data for the default
disk is already visible in the guest XML. So I'm wondering where the
problem is. Either we should be calling redefine_cached() somewhere to
get the data back into structures or something. I can't seem to find
where the disk gets its 'bus' property set.
Thanks for any hints,
Martin
The patch mentioned:
diff --git a/virtinst/Guest.py b/virtinst/Guest.py
index ffcddca..8a3cf3d 100644
--- a/virtinst/Guest.py
+++ b/virtinst/Guest.py
@@ -1351,6 +1351,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
# Generate disk targets, and set preferred disk bus
used_targets = []
+ to_generate = []
for disk in devlist_func(VirtualDevice.VIRTUAL_DEV_DISK):
if not disk.bus:
if disk.device == disk.DEVICE_FLOPPY:
@@ -1367,7 +1368,10 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
if disk.target:
used_targets.append(disk.target)
else:
- used_targets.append(disk.generate_target(used_targets))
+ to_generate.append(disk)
+
+ for disk in to_generate:
+ used_targets.append(disk.generate_target(used_targets))
# Set sound device model
sound_model = self._lookup_device_param(soundtype, "model")
More information about the virt-tools-list
mailing list