From: Peter Krempa Date: Wed, 20 Apr 2016 15:11:52 +0000 (+0200) Subject: conf: disk: Move validation of disk bus vs disk type X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2d3557b251994c820fd693d164ee4216f93a31fb;p=libvirt.git conf: disk: Move validation of disk bus vs disk type --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8ac308ccc2..f76a8b7f87 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6925,6 +6925,22 @@ virDomainDiskDefValidate(const virDomainDiskDef *def) } } + if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && + def->bus != VIR_DOMAIN_DISK_BUS_FDC) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid bus type '%s' for floppy disk"), + virDomainDiskBusTypeToString(def->bus)); + return -1; + } + + if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && + def->bus == VIR_DOMAIN_DISK_BUS_FDC) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid bus type '%s' for disk"), + virDomainDiskBusTypeToString(def->bus)); + return -1; + } + return 0; } @@ -7415,19 +7431,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, } } - if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && - def->bus != VIR_DOMAIN_DISK_BUS_FDC) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid bus type '%s' for floppy disk"), bus); - goto error; - } - if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && - def->bus == VIR_DOMAIN_DISK_BUS_FDC) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid bus type '%s' for disk"), bus); - goto error; - } - if (devaddr) { if (virDomainParseLegacyDeviceAddress(devaddr, &def->info.addr.pci) < 0) {