提交 1b6f13bb 编写于 作者: H Hu Tao 提交者: Eric Blake

Fall back to QEMUD_SAVE_FORMAT_RAW if compression method fails.

When dumping a domain, it's reasonable to save dump-file in raw format
if dump format is misconfigured or the corresponding compress program
is not available rather then fail dumping.
上级 78290527
......@@ -136,6 +136,7 @@ Patches have also been contributed by:
Osier Yang <jyang@redhat.com>
Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Wen Congyang <wency@cn.fujitsu.com>
Hu Tao <hutao@cn.fujitsu.com>
[....send patches to get your name here....]
......
......@@ -6057,36 +6057,46 @@ cleanup:
return ret;
}
static int qemudDomainCoreDump(virDomainPtr dom,
const char *path,
int flags ATTRIBUTE_UNUSED) {
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
int resume = 0, paused = 0;
int ret = -1, fd = -1;
virDomainEventPtr event = NULL;
int compress;
qemuDomainObjPrivatePtr priv;
static enum qemud_save_formats
getCompressionType(struct qemud_driver *driver)
{
int compress = QEMUD_SAVE_FORMAT_RAW;
/*
* We reuse "save" flag for "dump" here. Then, we can support the same
* format in "save" and "dump".
*/
compress = QEMUD_SAVE_FORMAT_RAW;
if (driver->dumpImageFormat) {
compress = qemudSaveCompressionTypeFromString(driver->dumpImageFormat);
if (compress < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Invalid dump image format specified in "
"configuration file"));
return -1;
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Invalid dump image format specified in "
"configuration file, using raw"));
return QEMUD_SAVE_FORMAT_RAW;
}
if (!qemudCompressProgramAvailable(compress)) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Compression program for dump image format "
"in configuration file isn't available"));
return -1;
"in configuration file isn't available, "
"using raw"));
return QEMUD_SAVE_FORMAT_RAW;
}
}
return compress;
}
static int qemudDomainCoreDump(virDomainPtr dom,
const char *path,
int flags ATTRIBUTE_UNUSED) {
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
int resume = 0, paused = 0;
int ret = -1, fd = -1;
virDomainEventPtr event = NULL;
enum qemud_save_formats compress;
qemuDomainObjPrivatePtr priv;
compress = getCompressionType(driver);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册