mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
conf: Move disk info validator to the domain conf validator
Since it will not be called from outside of conf we can unexport it too if we move it to the appropriate place. Test suite change is necessary since the error will be reported sooner now.
This commit is contained in:
parent
d071d292ca
commit
05eab1bf9a
@ -4573,8 +4573,29 @@ virDomainDefValidateDeviceIterator(virDomainDefPtr def,
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefValidateInternal(const virDomainDef *def ATTRIBUTE_UNUSED)
|
||||
virDomainDefCheckDuplicateDiskInfo(const virDomainDef *def)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
for (j = i + 1; j < def->ndisks; j++) {
|
||||
if (virDomainDiskDefCheckDuplicateInfo(def->disks[i],
|
||||
def->disks[j]) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefValidateInternal(const virDomainDef *def)
|
||||
{
|
||||
if (virDomainDefCheckDuplicateDiskInfo(def) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -24583,8 +24604,8 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
||||
|
||||
|
||||
int
|
||||
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
|
||||
virDomainDiskDefPtr b)
|
||||
virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
|
||||
const virDomainDiskDef *b)
|
||||
{
|
||||
if (STREQ(a->dst, b->dst)) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
@ -24613,24 +24634,6 @@ virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
for (j = i + 1; j < def->ndisks; j++) {
|
||||
if (virDomainDiskDefCheckDuplicateInfo(def->disks[i],
|
||||
def->disks[j]) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainDefHasMemballoon:
|
||||
* @def: domain definition
|
||||
|
@ -3067,11 +3067,9 @@ virDomainParseMemory(const char *xpath,
|
||||
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
|
||||
virDomainDiskDefPtr b)
|
||||
int virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
|
||||
const virDomainDiskDef *b)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
|
||||
int maplen,
|
||||
|
@ -207,7 +207,6 @@ virDomainDefAddController;
|
||||
virDomainDefAddImplicitDevices;
|
||||
virDomainDefAddUSBController;
|
||||
virDomainDefCheckABIStability;
|
||||
virDomainDefCheckDuplicateDiskInfo;
|
||||
virDomainDefClearCCWAddresses;
|
||||
virDomainDefClearDeviceAliases;
|
||||
virDomainDefClearPCIAddresses;
|
||||
|
@ -4303,14 +4303,9 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
|
||||
/* checks below should not be executed when starting a qemu process for a
|
||||
* VM that was running before (migration, snapshots, save). It's more
|
||||
* important to start such VM than keep the configuration clean */
|
||||
if ((flags & VIR_QEMU_PROCESS_START_NEW)) {
|
||||
if (virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
|
||||
return -1;
|
||||
|
||||
if (virDomainDefCheckDuplicateDiskInfo(vm->def) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((flags & VIR_QEMU_PROCESS_START_NEW) &&
|
||||
virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
|
||||
return -1;
|
||||
|
||||
if (vm->def->mem.min_guarantee) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
|
@ -876,9 +876,9 @@ mymain(void)
|
||||
DO_TEST("disk-drive-discard",
|
||||
QEMU_CAPS_DRIVE_DISCARD);
|
||||
DO_TEST("disk-snapshot", NONE);
|
||||
DO_TEST_FAILURE("disk-same-targets",
|
||||
QEMU_CAPS_SCSI_LSI,
|
||||
QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
|
||||
DO_TEST_PARSE_ERROR("disk-same-targets",
|
||||
QEMU_CAPS_SCSI_LSI,
|
||||
QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
|
||||
DO_TEST("event_idx",
|
||||
QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
|
||||
QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
|
||||
|
Loading…
Reference in New Issue
Block a user