Re: delete lvm problem: exited with non-zero status 5 and signal 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/27/2011 01:21 AM, lingjiao.lc wrote:
hi,
  I use the libvirt-python to manage my virtual machine. When I delete a
volume use vol.delete(0), sometimes it note me that has occur the error:

                 libvirtError: internal error '/sbin/lvremove
                 -f /dev/vg.vmms/lvm-v097222.sqa.cm4' exited with
                 non-zero status 5 and signal 0:   Can't remove open
                 logical volume "lvm-v097222.sqa.cm4".



Could I change it like this: ?
         if (virRun(cmdargv, NULL)<  0)
         const char *changeCmdarg[] = {
          LVCHANGE, "-a", "n", vol->target.path, NULL
         };
         if(virRun(changeCmdarg, NULL)<  0)
             return -1;
         else
             if(virRun(cmdargv,NULL)<  0)
                 return -1;

Changing it like that won't work - virRun fails with -1 if the command exits with non-zero status when the second argument is NULL. But if you pass a pointer to an int on the first call, to capture (and ignore) the exit status of the first command, then you could get to the second call.

That said, does calling the change command twice, with no sleep in between, actually improve the situation? The problem is that there is an inherent race in LVM operations, so we have to have a reliable way to tell when the race window is passed.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux