[pve-devel] add_unused_volume bug with multiple disks delete ?

Alexandre DERUMIER aderumier at odiso.com
Wed Dec 28 09:54:03 CET 2011


I was working on the hotplug code to add/remove multiple devices in the same command line,

and I think I found a bug:

I'm try to remove 2 disks at the the same time

qm set xxx --delete virtio1,virtio0

so normally, the 2 disks must go to unused0 and unused1

but I have only unused0 with the second disk.

So I check the code

sub add_unused_volume {
    my ($config, $res, $volid) = @_;

If I understand, we loop on the unusedX from config file to find next free unusedX.

But the config file is not yet update/write after the first disk delete, so the second disk delete go to unused0.

Don't have tested with add/remove disk from unusedX at the same time, but it can be really tricky.
maybe writing the config file after each unused change ? or keep an array of unusedx in memory and pass it to add_unused_volume ?

- Alexandre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aderumier.vcf
Type: text/x-vcard
Size: 183 bytes
Desc: not available
URL: <http://pve.proxmox.com/cgi-bin/mailman/private/pve-devel/attachments/20111228/abac269c/attachment.vcf>

More information about the pve-devel mailing list