return false;
}
-/* Return true if there's a duplicate disk[]->dst name for the same bus */
-bool
-virDomainDiskDefDstDuplicates(virDomainDefPtr def)
-{
- size_t i, j;
-
- /* optimization */
- if (def->ndisks <= 1)
- return false;
-
- for (i = 1; i < def->ndisks; i++) {
- for (j = 0; j < i; j++) {
- if (STREQ(def->disks[i]->dst, def->disks[j]->dst)) {
- virReportError(VIR_ERR_XML_ERROR,
- _("target '%s' duplicated for disk sources "
- "'%s' and '%s'"),
- def->disks[i]->dst,
- NULLSTR(virDomainDiskGetSource(def->disks[i])),
- NULLSTR(virDomainDiskGetSource(def->disks[j])));
- return true;
- }
- }
- }
- return false;
-}
int
virDomainDiskIndexByAddress(virDomainDefPtr def,
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
virDomainDiskDefPtr b)
{
+ if (STREQ(a->dst, b->dst)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("target '%s' duplicated for disk sources '%s' and '%s'"),
+ a->dst,
+ NULLSTR(virDomainDiskGetSource(a)),
+ NULLSTR(virDomainDiskGetSource(b)));
+ return -1;
+ }
+
if (a->wwn && b->wwn && STREQ(a->wwn, b->wwn)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have identical WWN"),
size_t j;
for (i = 0; i < def->ndisks; i++) {
- if (def->disks[i]->wwn || def->disks[i]->serial) {
- for (j = i + 1; j < def->ndisks; j++) {
- if (virDomainDiskDefCheckDuplicateInfo(def->disks[i],
- def->disks[j]) < 0)
- return -1;
- }
+ for (j = i + 1; j < def->ndisks; j++) {
+ if (virDomainDiskDefCheckDuplicateInfo(def->disks[i],
+ def->disks[j]) < 0)
+ return -1;
}
}
void virDomainRNGDefFree(virDomainRNGDefPtr def);
-bool virDomainDiskDefDstDuplicates(virDomainDefPtr def);
int virDomainDiskIndexByAddress(virDomainDefPtr def,
virDevicePCIAddressPtr pci_controller,
unsigned int bus, unsigned int target,
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator)))
goto cleanup;
+ if (qemuProcessStartValidate(def, qemuCaps, false, false) < 0)
+ goto cleanup;
+
/* Since we're just exporting args, we can't do bridge/network/direct
* setups, since libvirt will normally create TAP/macvtap devices
* directly. We convert those configs into generic 'ethernet'
case VIR_DOMAIN_DISK_DEVICE_DISK:
case VIR_DOMAIN_DISK_DEVICE_LUN:
for (i = 0; i < vm->def->ndisks; i++) {
- if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), disk->dst);
- goto cleanup;
- }
-
if (virDomainDiskDefCheckDuplicateInfo(vm->def->disks[i], disk) < 0)
goto cleanup;
}