return "rtl8139";
}
+
+/*
+ * Clear auto generated unix socket path, i.e., the one which starts with our
+ * channel directory.
+ */
+static void
+qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
+ virQEMUDriverPtr driver)
+{
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
+ chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
+ chr->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
+ chr->source.data.nix.path &&
+ STRPREFIX(chr->source.data.nix.path, cfg->channelTargetDir)) {
+ VIR_FREE(chr->source.data.nix.path);
+ }
+
+ virObjectUnref(cfg);
+}
+
+
static int
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
/* clear auto generated unix socket path for inactive definitions */
if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
- dev->type == VIR_DOMAIN_DEVICE_CHR &&
- dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
- dev->data.chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
- dev->data.chr->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
- dev->data.chr->source.data.nix.path &&
- STRPREFIX(dev->data.chr->source.data.nix.path, cfg->channelTargetDir)) {
- /*
- * If the address is generated by us (starts with our
- * channel dir), we should not keep it in the persistent
- * XML. If libvirt is the one who generated it, users
- * shouldn't care about that. If they do, they are
- * supposed to set it themselves.
- */
- VIR_FREE(dev->data.chr->source.data.nix.path);
- }
+ dev->type == VIR_DOMAIN_DEVICE_CHR)
+ qemuDomainChrDefDropDefaultPath(dev->data.chr, driver);
/* forbid capabilities mode hostdev in this kind of hypervisor */
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
virDomainControllerDefFree(usb);
}
-
+ for (i = 0; i < def->nchannels; i++)
+ qemuDomainChrDefDropDefaultPath(def->channels[i], driver);
}
format: