Fix /vm/uuid xenstore leak on tapdisk2 device cleanup

While doing block-detach blktap2 disk, tap2 device info is not cleared from
xenstore /vm/uuid/xxx. The reason is in xen-hotplug-cleanup script: when $vm_dev
does not exist, $(xenstore-read "$vm_dev" 2>/dev/null) is also "", won't enter
the block. So, change to use cmd return value to check existence.

Signed-off-by Chunyan Liu <cyliu@novell.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
Chunyan Liu committed 2010-12-13 17:39:27 +00:00
1 parent 999241f7aa
commit f662bb114a
1 file changed
+6 -4
+6 -4
View File
@@ -21,10 +21,12 @@ if [ "$vm" != "" ]; then
# if the vm path does not exist and the device class is 'vbd' then we may have
# a tap2 device
if [ "$(xenstore-read "$vm_dev" 2>/dev/null)" != "" ] \
&& [ "${path_array[1]}" = "vbd" ]; then
vm_dev="$vm/device/tap2/${path_array[3]}"
fi
  $(xenstore-read "$vm_dev" 2>/dev/null) || \
  {
     if [ "${path_array[1]}" = "vbd" ]; then
        vm_dev="$vm/device/tap2/${path_array[3]}"
     fi
  }
else
vm_dev=
fi
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.