mirror of https://gitee.com/openkylin/libvirt.git
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
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24583,8 +24604,8 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
|
virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
|
||||||
virDomainDiskDefPtr b)
|
const virDomainDiskDef *b)
|
||||||
{
|
{
|
||||||
if (STREQ(a->dst, b->dst)) {
|
if (STREQ(a->dst, b->dst)) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
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:
|
* virDomainDefHasMemballoon:
|
||||||
* @def: domain definition
|
* @def: domain definition
|
||||||
|
|
|
@ -3067,11 +3067,9 @@ virDomainParseMemory(const char *xpath,
|
||||||
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
int virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
|
int virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
|
||||||
virDomainDiskDefPtr b)
|
const virDomainDiskDef *b)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
|
|
||||||
ATTRIBUTE_NONNULL(1);
|
|
||||||
|
|
||||||
int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
|
int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
|
||||||
int maplen,
|
int maplen,
|
||||||
|
|
|
@ -207,7 +207,6 @@ virDomainDefAddController;
|
||||||
virDomainDefAddImplicitDevices;
|
virDomainDefAddImplicitDevices;
|
||||||
virDomainDefAddUSBController;
|
virDomainDefAddUSBController;
|
||||||
virDomainDefCheckABIStability;
|
virDomainDefCheckABIStability;
|
||||||
virDomainDefCheckDuplicateDiskInfo;
|
|
||||||
virDomainDefClearCCWAddresses;
|
virDomainDefClearCCWAddresses;
|
||||||
virDomainDefClearDeviceAliases;
|
virDomainDefClearDeviceAliases;
|
||||||
virDomainDefClearPCIAddresses;
|
virDomainDefClearPCIAddresses;
|
||||||
|
|
|
@ -4303,15 +4303,10 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
|
||||||
/* checks below should not be executed when starting a qemu process for a
|
/* checks below should not be executed when starting a qemu process for a
|
||||||
* VM that was running before (migration, snapshots, save). It's more
|
* VM that was running before (migration, snapshots, save). It's more
|
||||||
* important to start such VM than keep the configuration clean */
|
* important to start such VM than keep the configuration clean */
|
||||||
if ((flags & VIR_QEMU_PROCESS_START_NEW)) {
|
if ((flags & VIR_QEMU_PROCESS_START_NEW) &&
|
||||||
if (virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
|
virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virDomainDefCheckDuplicateDiskInfo(vm->def) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (vm->def->mem.min_guarantee) {
|
if (vm->def->mem.min_guarantee) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Parameter 'min_guarantee' "
|
_("Parameter 'min_guarantee' "
|
||||||
|
|
|
@ -876,7 +876,7 @@ mymain(void)
|
||||||
DO_TEST("disk-drive-discard",
|
DO_TEST("disk-drive-discard",
|
||||||
QEMU_CAPS_DRIVE_DISCARD);
|
QEMU_CAPS_DRIVE_DISCARD);
|
||||||
DO_TEST("disk-snapshot", NONE);
|
DO_TEST("disk-snapshot", NONE);
|
||||||
DO_TEST_FAILURE("disk-same-targets",
|
DO_TEST_PARSE_ERROR("disk-same-targets",
|
||||||
QEMU_CAPS_SCSI_LSI,
|
QEMU_CAPS_SCSI_LSI,
|
||||||
QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
|
QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
|
||||||
DO_TEST("event_idx",
|
DO_TEST("event_idx",
|
||||||
|
|
Loading…
Reference in New Issue