goto error;
}
+ /*
+ * TODO: Refactor so that we generate this (and onther
+ * things) somewhere else then where we are building the
+ * command line.
+ */
+ if (channel->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
+ !channel->source.data.nix.path) {
+ if (virAsprintf(&channel->source.data.nix.path,
+ "%s/domain-%s/%s",
+ cfg->channelTargetDir, def->name,
+ channel->target.name ? channel->target.name
+ : "unknown.sock") < 0)
+ goto error;
+
+ channel->source.data.nix.listen = true;
+ }
+
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC) &&
channel->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
/* spicevmc was originally introduced via a -device
ARCH_IS_S390(def->os.arch))
dev->data.controller->model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
- /* auto generate unix socket path */
+ /* clear auto generated unix socket path */
if (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) {
- if (virAsprintf(&dev->data.chr->source.data.nix.path,
- "%s/domain-%s/%s",
- cfg->channelTargetDir, def->name,
- dev->data.chr->target.name ? dev->data.chr->target.name
- : "unknown.sock") < 0)
- goto cleanup;
-
- dev->data.chr->source.data.nix.listen = true;
+ 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);
}
/* forbid capabilities mode hostdev in this kind of hypervisor */
id=channel1 \
-chardev socket,id=charchannel2,path=/tmp/domain-QEMUGuest1/ble,server,nowait \
-device virtserialport,bus=virtio-serial0.0,nr=3,chardev=charchannel2,\
-id=channel2,name=ble
+id=channel2,name=ble \
+-chardev socket,id=charchannel3,path=/tmp/domain-QEMUGuest1/fdsa,server,nowait \
+-device virtserialport,bus=virtio-serial0.0,nr=4,chardev=charchannel3,\
+id=channel3,name=fdsa