mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 11:35:19 +00:00
storage: lvm: use correct lv* command parameters
lvcreate want's the parent pool's name, not the pool path lvchange and lvremove want lv specified as $vgname/$lvname This largely worked before because these commands strip off a starting /dev. But https://bugzilla.redhat.com/show_bug.cgi?id=714986 is from a user using a 'nested VG' that was having problems. I couldn't find any info on nested LVM and the reporter never responded, but I reproduced with XML that specified a valid source name, and set target path to a symlink.
This commit is contained in:
parent
455d222457
commit
61544d310e
@ -672,7 +672,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
|
|||||||
char size[100];
|
char size[100];
|
||||||
const char *cmdargvnew[] = {
|
const char *cmdargvnew[] = {
|
||||||
LVCREATE, "--name", vol->name, "-L", size,
|
LVCREATE, "--name", vol->name, "-L", size,
|
||||||
pool->def->target.path, NULL
|
pool->def->source.name, NULL
|
||||||
};
|
};
|
||||||
const char *cmdargvsnap[] = {
|
const char *cmdargvsnap[] = {
|
||||||
LVCREATE, "--name", vol->name, "-L", size,
|
LVCREATE, "--name", vol->name, "-L", size,
|
||||||
@ -778,23 +778,23 @@ virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
char *volpath = NULL;
|
||||||
|
|
||||||
virCommandPtr lvchange_cmd = NULL;
|
virCommandPtr lvchange_cmd = NULL;
|
||||||
virCommandPtr lvremove_cmd = NULL;
|
virCommandPtr lvremove_cmd = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
|
if (virAsprintf(&volpath, "%s/%s",
|
||||||
|
pool->def->source.name, vol->name) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
virFileWaitForDevices();
|
virFileWaitForDevices();
|
||||||
|
|
||||||
lvchange_cmd = virCommandNewArgList(LVCHANGE,
|
lvchange_cmd = virCommandNewArgList(LVCHANGE, "-aln", volpath, NULL);
|
||||||
"-aln",
|
lvremove_cmd = virCommandNewArgList(LVREMOVE, "-f", volpath, NULL);
|
||||||
vol->target.path,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
lvremove_cmd = virCommandNewArgList(LVREMOVE,
|
|
||||||
"-f",
|
|
||||||
vol->target.path,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (virCommandRun(lvremove_cmd, NULL) < 0) {
|
if (virCommandRun(lvremove_cmd, NULL) < 0) {
|
||||||
if (virCommandRun(lvchange_cmd, NULL) < 0) {
|
if (virCommandRun(lvchange_cmd, NULL) < 0) {
|
||||||
@ -807,6 +807,7 @@ virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(volpath);
|
||||||
virCommandFree(lvchange_cmd);
|
virCommandFree(lvchange_cmd);
|
||||||
virCommandFree(lvremove_cmd);
|
virCommandFree(lvremove_cmd);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user