mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 14:07:16 +00:00
virDomainDiskDefValidate: Consolidate conditions
Consolidate the checks for '<reservations/>' and viritio queues under already existing blocks which have the same condition. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
91d9ff75e6
commit
ceca89d43d
@ -451,13 +451,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
|||||||
"device='lun'"), disk->dst);
|
"device='lun'"), disk->dst);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
if (disk->src->pr) {
|
||||||
if (disk->src->pr &&
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
|
_("<reservations/> allowed only for lun devices"));
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
return -1;
|
||||||
_("<reservations/> allowed only for lun devices"));
|
}
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reject disks with a bus type that is not compatible with the
|
/* Reject disks with a bus type that is not compatible with the
|
||||||
@ -474,13 +473,6 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
|||||||
return -1;
|
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->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||||
if (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO ||
|
if (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO ||
|
||||||
disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
|
disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
|
||||||
@ -492,6 +484,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
|||||||
return -1;
|
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)
|
if (virDomainCheckVirtioOptionsAreAbsent(disk->virtio) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user