mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-24 02:04:13 +03:00
Probe entire backing chain when checking if path is in use
This commit is contained in:
parent
330bcd9c8b
commit
b57a2094ff
@ -664,7 +664,7 @@ c.add_invalid("--disk path=%(NEWIMG1)s,format=qcow2,size=.0000001") # Unmanaged
|
||||
c.add_invalid("--disk path=%(MANAGEDDISKNEW1)s,format=raw,size=.0000001") # Managed disk using any format
|
||||
c.add_invalid("--disk %(NEWIMG1)s") # Not specifying path= and non existent storage w/ no size
|
||||
c.add_invalid("--disk %(COLLIDE)s") # Colliding storage without --force
|
||||
c.add_invalid("--disk /dev/default-pool/backing.img") # Colliding storage via backing store
|
||||
c.add_invalid("--disk /dev/default-pool/backingl3.img") # Colliding storage via backing store
|
||||
c.add_invalid("--disk %(DIR)s,device=cdrom") # Dir without floppy
|
||||
c.add_invalid("--disk %(EXISTIMG1)s,driver_name=foobar,driver_type=foobaz") # Unknown driver name and type options (as of 1.0.0)
|
||||
c.add_valid("--disk path=%(EXISTIMG1)s,startup_policy=optional") # Existing disk, startupPolicy
|
||||
|
@ -1316,13 +1316,35 @@ ba</description>
|
||||
<target/>
|
||||
</volume>
|
||||
<volume>
|
||||
<name>backing.img</name>
|
||||
<name>backingl3.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
<allocation>50000</allocation>
|
||||
<target>
|
||||
<format type='raw'/>
|
||||
</target>
|
||||
</volume>
|
||||
<volume>
|
||||
<name>backingl2.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
<allocation>50000</allocation>
|
||||
<target>
|
||||
<format type='qcow2'/>
|
||||
</target>
|
||||
<backingStore>
|
||||
<path>/dev/default-pool/backingl3.img</path>
|
||||
</backingStore>
|
||||
</volume>
|
||||
<volume>
|
||||
<name>backingl1.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
<allocation>50000</allocation>
|
||||
<target>
|
||||
<format type='qcow2'/>
|
||||
</target>
|
||||
<backingStore>
|
||||
<path>/dev/default-pool/backingl2.img</path>
|
||||
</backingStore>
|
||||
</volume>
|
||||
<volume>
|
||||
<name>overlay.img</name>
|
||||
<capacity>1000000</capacity>
|
||||
@ -1331,7 +1353,7 @@ ba</description>
|
||||
<format type='qcow2'/>
|
||||
</target>
|
||||
<backingStore>
|
||||
<path>/dev/default-pool/backing.img</path>
|
||||
<path>/dev/default-pool/backingl1.img</path>
|
||||
</backingStore>
|
||||
</volume>
|
||||
|
||||
|
@ -345,10 +345,17 @@ class VirtualDisk(VirtualDevice):
|
||||
if not path:
|
||||
return []
|
||||
|
||||
# Find all volumes that have 'path' somewhere in their backing chain
|
||||
vols = []
|
||||
for vol in conn.fetch_all_vols():
|
||||
if path == vol.backing_store:
|
||||
vols.append(vol.target_path)
|
||||
volmap = dict((vol.backing_store, vol)
|
||||
for vol in conn.fetch_all_vols() if vol.backing_store)
|
||||
backpath = path
|
||||
while backpath in volmap:
|
||||
vol = volmap[backpath]
|
||||
if vol in vols:
|
||||
break
|
||||
backpath = vol.target_path
|
||||
vols.append(backpath)
|
||||
|
||||
ret = []
|
||||
vms = conn.fetch_all_guests()
|
||||
|
Loading…
x
Reference in New Issue
Block a user