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".
then I go to the host and run the command:
" sudo lvchange -a n /dev/vg.vmms/lvm-v097222.sqa.cm4"
and then the volume could delete use vol.delete(0).
But it's not often occur, just once in nearly 8.
I know the delete function virStorageBackendLogicalDeleteVol as this:
{
{
const char *cmdargv[] = {
LVREMOVE, "-f",vol->target.path, NULL
};
virCheckFlags(0, -1);
virFileWaitForDevices();
if (virRun(cmdargv, NULL) < 0)
return -1;
return 0;
}
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;
________________________________
This email (including any attachments) is confidential and may be legally privileged. If
you received this email in error, please delete it immediately and do not copy it or use
it for any purpose or disclose its contents to any other person. Thank you.
本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。