提交 320825b4 编写于 作者: J John Ferlan

domain_conf: Change virDomainDiskDef 'rawio' to use virTristateBool

Adjust disk definition for 'rawio' to use the TristateBool logic
上级 8921d488
......@@ -5954,12 +5954,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (rawio) {
def->rawio_specified = true;
if (STREQ(rawio, "yes")) {
def->rawio = 1;
} else if (STREQ(rawio, "no")) {
def->rawio = 0;
} else {
if ((def->rawio = virTristateBoolTypeFromString(rawio)) <= 0) {
virReportError(VIR_ERR_XML_ERROR,
_("unknown disk rawio setting '%s'"),
rawio);
......@@ -15828,12 +15823,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(buf,
"<disk type='%s' device='%s'",
type, device);
if (def->rawio_specified) {
if (def->rawio == 1) {
virBufferAddLit(buf, " rawio='yes'");
} else if (def->rawio == 0) {
virBufferAddLit(buf, " rawio='no'");
}
if (def->rawio) {
virBufferAsprintf(buf, " rawio='%s'",
virTristateBoolTypeToString(def->rawio));
}
if (def->sgio)
......
......@@ -663,8 +663,7 @@ struct _virDomainDiskDef {
int startupPolicy; /* enum virDomainStartupPolicy */
bool transient;
virDomainDeviceInfo info;
bool rawio_specified;
int rawio; /* no = 0, yes = 1 */
int rawio; /* enum virTristateBool */
int sgio; /* enum virDomainDeviceSGIO */
int discard; /* enum virDomainDiskDiscard */
unsigned int iothread; /* unused = 0, > 0 specific thread # */
......
......@@ -1945,8 +1945,9 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
cfg->allowDiskFormatProbing)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_DISK_PROBING, logFD);
if (disk->rawio == 1)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES, logFD);
if (disk->rawio == VIR_TRISTATE_BOOL_YES)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,
logFD);
virObjectUnref(cfg);
}
......
......@@ -4357,7 +4357,7 @@ int qemuProcessStart(virConnectPtr conn,
virDomainDeviceDef dev;
virDomainDiskDefPtr disk = vm->def->disks[i];
if (vm->def->disks[i]->rawio == 1) {
if (vm->def->disks[i]->rawio == VIR_TRISTATE_BOOL_YES) {
#ifdef CAP_SYS_RAWIO
virCommandAllowCap(cmd, CAP_SYS_RAWIO);
#else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册