Consolidate the checks for '<reservations/>' and viritio queues under
already existing blocks which have the same condition.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_validate.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 570279cd92..4d253599af 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -451,13 +451,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
"device='lun'"), disk->dst);
return -1;
}
- }
-
- if (disk->src->pr &&
- disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("<reservations/> allowed only for lun
devices"));
- return -1;
+ } else {
+ if (disk->src->pr) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("<reservations/> allowed only for lun
devices"));
+ return -1;
+ }
}
/* Reject disks with a bus type that is not compatible with the
@@ -474,13 +473,6 @@ virDomainDiskDefValidate(const virDomainDef *def,
return -1;
}
- if (disk->queues && disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("queues attribute in disk driver element is only "
- "supported by virtio-blk"));
- return -1;
- }
-
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
if (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO ||
disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
@@ -492,6 +484,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
return -1;
}
+ if (disk->queues) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("queues attribute in disk driver element is only
supported by virtio-blk"));
+ return -1;
+ }
+
if (virDomainCheckVirtioOptionsAreAbsent(disk->virtio) < 0)
return -1;
}
--
2.30.2