mirror of https://gitee.com/openkylin/libvirt.git
conf: disk: Extract checking of removable status
This commit is contained in:
parent
2d3557b251
commit
3fa8125f25
|
@ -6941,6 +6941,13 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (def->removable != VIR_TRISTATE_SWITCH_ABSENT &&
|
||||
def->bus != VIR_DOMAIN_DISK_BUS_USB) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("removable is only valid for usb disks"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7423,12 +7430,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
_("unknown disk removable status '%s'"), removable);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (def->bus != VIR_DOMAIN_DISK_BUS_USB) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("removable is only valid for usb disks"));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (devaddr) {
|
||||
|
|
Loading…
Reference in New Issue