From: Peter Krempa Date: Wed, 20 Apr 2016 15:19:04 +0000 (+0200) Subject: conf: disk: Extract checking of removable status X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3fa8125f25a117dba84bde10c2754009c7f03d5e;p=libvirt.git conf: disk: Extract checking of removable status --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f76a8b7f87..bcd19d8419 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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) {