mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: check compression program availability of virsh save and dump
This commit is contained in:
parent
95a17abda7
commit
f69ce3feb0
@ -5742,6 +5742,22 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns true if a compression program is available in PATH */
|
||||||
|
static bool qemudCompressProgramAvailable(enum qemud_save_formats compress)
|
||||||
|
{
|
||||||
|
const char *prog;
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
if (compress == QEMUD_SAVE_FORMAT_RAW)
|
||||||
|
return true;
|
||||||
|
prog = qemudSaveCompressionTypeToString(compress);
|
||||||
|
c = virFindFileInPath(prog);
|
||||||
|
if (!c)
|
||||||
|
return false;
|
||||||
|
VIR_FREE(c);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int qemudDomainSave(virDomainPtr dom, const char *path)
|
static int qemudDomainSave(virDomainPtr dom, const char *path)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
@ -5761,6 +5777,12 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
|
|||||||
"in configuration file"));
|
"in configuration file"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (!qemudCompressProgramAvailable(compressed)) {
|
||||||
|
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
|
"%s", _("Compression program for image format "
|
||||||
|
"in configuration file isn't available"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
@ -5924,6 +5946,12 @@ static int qemudDomainCoreDump(virDomainPtr dom,
|
|||||||
"configuration file"));
|
"configuration file"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (!qemudCompressProgramAvailable(compress)) {
|
||||||
|
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
|
"%s", _("Compression program for dump image format "
|
||||||
|
"in configuration file isn't available"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuDriverLock(driver);
|
qemuDriverLock(driver);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user