---
src/conf/domain_conf.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8ac308c..5fd8cc4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6925,6 +6925,14 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
}
}
+ if (def->tray_status != VIR_DOMAIN_DISK_TRAY_CLOSED &&
+ def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+ def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("tray is only valid for cdrom and floppy"));
+ return -1;
+ }
+
return 0;
}
@@ -7392,13 +7400,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
_("unknown disk tray status '%s'"), tray);
goto error;
}
-
- if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
- def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("tray is only valid for cdrom and floppy"));
- goto error;
- }
}
if (removable) {
--
2.8.1