From 3fa8125f25a117dba84bde10c2754009c7f03d5e Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 20 Apr 2016 17:19:04 +0200 Subject: [PATCH] conf: disk: Extract checking of removable status --- src/conf/domain_conf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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) { -- GitLab