[PATCH] bhyve: add virtio-console support
Bhyve supports virtio-console devices using the following syntax: -s 2:0,virtio-console,org.qemu.guest_agent.0=/path/to/unix/socket,other.port=/other/socket,... There are two details about that to consider. The first one is that only up to 16 ports per console is supported. This is different from the default (31), so update the code to manually add the virtio-serial controllers with 16 ports. For the existing controllers, make sure to set max ports to 16 or error out if ports count greater than 16 was specified. The second one is that bhyve does not clean up UNIX sockets for these devices. So update virBhyveProcessStop() to remove leftover sockets. Not adding capabilities probing as the virtio-console device is available on all supported FreeBSD versions and on all supported arches. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 42 +++++- src/bhyve/bhyve_device.c | 42 +++++- src/bhyve/bhyve_domain.c | 44 ++++++- src/bhyve/bhyve_process.c | 14 ++ ...exml2argv-2-virtio-console-mixed-addr.args | 10 ++ ...ml2argv-2-virtio-console-mixed-addr.ldargs | 4 + ...vexml2argv-2-virtio-console-mixed-addr.xml | 26 ++++ .../bhyvexml2argv-virtio-console-addr.args | 10 ++ .../bhyvexml2argv-virtio-console-addr.ldargs | 4 + .../bhyvexml2argv-virtio-console-addr.xml | 25 ++++ ...vexml2argv-virtio-console-controllers.args | 11 ++ ...xml2argv-virtio-console-controllers.ldargs | 4 + ...yvexml2argv-virtio-console-controllers.xml | 31 +++++ ...v-virtio-console-multiple-controllers.args | 11 ++ ...virtio-console-multiple-controllers.ldargs | 4 + ...gv-virtio-console-multiple-controllers.xml | 89 +++++++++++++ ...xml2argv-virtio-console-too-many-ports.xml | 25 ++++ .../x86_64/bhyvexml2argv-virtio-console.args | 10 ++ .../bhyvexml2argv-virtio-console.ldargs | 4 + .../x86_64/bhyvexml2argv-virtio-console.xml | 21 +++ tests/bhyvexml2argvtest.c | 6 + ...xml2xmlout-2-virtio-console-mixed-addr.xml | 40 ++++++ .../bhyvexml2xmlout-virtio-console-addr.xml | 35 +++++ ...exml2xmlout-virtio-console-controllers.xml | 43 ++++++ ...ut-virtio-console-multiple-controllers.xml | 123 ++++++++++++++++++ .../x86_64/bhyvexml2xmlout-virtio-console.xml | 35 +++++ tests/bhyvexml2xmltest.c | 6 + 27 files changed, 712 insertions(+), 7 deletions(-) create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.args create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.ldargs create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.args create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.ldargs create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.args create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.ldargs create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.args create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.ldargs create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-too-many-ports.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.args create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.ldargs create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.xml create mode 100644 tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-virtio-console-mixed-addr.xml create mode 100644 tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-addr.xml create mode 100644 tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-controllers.xml create mode 100644 tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-multiple-controllers.xml create mode 100644 tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console.xml diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 931d7dd551..8671644cc8 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -490,6 +490,43 @@ bhyveBuildNVMeControllerArgStr(const virDomainDef *def, return 0; } +static int +bhyveBuildVirtioSerialControllerArgStr(const virDomainDef *def, + virDomainControllerDef *controller, + struct _bhyveConn *driver G_GNUC_UNUSED, + virCommand *cmd) +{ + g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER; + size_t i; + + for (i = 0; i < def->nchannels; i++) { + virDomainChrDef *channel = def->channels[i]; + + if (channel->info.addr.vioserial.controller != controller->idx) + continue; + + if (channel->source->type != VIR_DOMAIN_CHR_TYPE_UNIX) + continue; + + if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) + continue; + + virBufferAsprintf(&opt, + ",%s=%s", + channel->target.name, + channel->source->data.nix.path); + } + + if (virBufferUse(&opt) > 0) { + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%d:0,virtio-console%s", + controller->info.addr.pci.slot, + virBufferContentAndReset(&opt)); + } + + return 0; +} + static int bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_GNUC_UNUSED, virDomainDiskDef *disk, @@ -606,9 +643,12 @@ bhyveBuildControllerArgStr(const virDomainDef *def, if (bhyveBuildNVMeControllerArgStr(def, controller, driver, cmd) < 0) return -1; break; + case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: + if (bhyveBuildVirtioSerialControllerArgStr(def, controller, driver, cmd) < 0) + return -1; + break; case VIR_DOMAIN_CONTROLLER_TYPE_IDE: case VIR_DOMAIN_CONTROLLER_TYPE_FDC: - case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_CONTROLLER_TYPE_CCID: case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: case VIR_DOMAIN_CONTROLLER_TYPE_LAST: diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 54511383bb..cf3a9fa4fb 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -31,6 +31,36 @@ VIR_LOG_INIT("bhyve.bhyve_device"); + +static int +bhyveDomainAssignVirtioSerialAddresses(virDomainDef *def) +{ + int ret = -1; + size_t i; + virDomainVirtioSerialAddrSet *addrs = NULL; + + if (!(addrs = virDomainVirtioSerialAddrSetCreateFromDomain(def))) + goto cleanup; + + VIR_DEBUG("Finished reserving existing ports"); + + for (i = 0; i < def->nchannels; i++) { + virDomainChrDef *chr = def->channels[i]; + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && + chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO && + !virDomainVirtioSerialAddrIsComplete(&chr->info) && + virDomainVirtioSerialAddrAutoAssignFromCache(def, addrs, + &chr->info, false) < 0) + goto cleanup; + } + + ret = 0; + + cleanup: + virDomainVirtioSerialAddrSetFree(addrs); + return ret; +} + static int bhyveCollectPCIAddress(virDomainDef *def G_GNUC_UNUSED, virDomainDeviceDef *device G_GNUC_UNUSED, @@ -39,7 +69,8 @@ bhyveCollectPCIAddress(virDomainDef *def G_GNUC_UNUSED, { virDomainPCIAddressSet *addrs = NULL; virPCIDeviceAddress *addr = NULL; - if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) + + if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) return 0; addrs = opaque; @@ -116,6 +147,7 @@ bhyveAssignDevicePCISlots(virDomainDef *def, (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) || (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_NVME) || (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) || + (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) || ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI)) || def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA) { @@ -242,5 +274,11 @@ int bhyveDomainAssignPCIAddresses(virDomainDef *def, int bhyveDomainAssignAddresses(virDomainDef *def, virDomainObj *obj) { - return bhyveDomainAssignPCIAddresses(def, obj); + if (bhyveDomainAssignVirtioSerialAddresses(def) < 0) + return -1; + + if (bhyveDomainAssignPCIAddresses(def, obj) < 0) + return -1; + + return 0; } diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 4594d7673f..e64be1f4a7 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -89,6 +89,9 @@ bhyveDomainDefPostParse(virDomainDef *def, { struct _bhyveConn *driver = opaque; g_autoptr(virCaps) caps = bhyveDriverGetCapabilities(driver); + size_t i, virtio_channels = 0; + size_t virtio_serial_controllers = 0, virtio_serial_existing_controllers = 0; + size_t virtio_serial_controllers_to_create = 0; if (!caps) return -1; @@ -141,6 +144,27 @@ bhyveDomainDefPostParse(virDomainDef *def, def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_ROM; } + for (i = 0; i < def->nchannels; i++) + if (def->channels[i]->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) + virtio_channels++; + + for (i = 0; i < def->ncontrollers; i++) + if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) + virtio_serial_existing_controllers++; + + /* bhyve supports 16 ports per virtio-console device */ + virtio_serial_controllers = (virtio_channels / 16) + (virtio_channels % 16 != 0); + if (virtio_serial_controllers > virtio_serial_existing_controllers) { + virtio_serial_controllers_to_create = virtio_serial_controllers - virtio_serial_existing_controllers; + + for (i = 0; i < virtio_serial_controllers_to_create; i++) { + virDomainControllerDef *cont; + + cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL, -1, -1); + cont->opts.vioserial.ports = 16; + } + } + return 0; } @@ -225,6 +249,10 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDef *dev, virReportError(VIR_ERR_XML_ERROR, "%s", _("pci-root and pcie-root controllers should have index 0")); return -1; + } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) { + /* bhyve supports 16 ports per controller */ + if (cont->opts.vioserial.ports == -1) + cont->opts.vioserial.ports = 16; } } @@ -287,13 +315,21 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, void *parseOpaque G_GNUC_UNUSED) { switch (dev->type) { - case VIR_DOMAIN_DEVICE_CONTROLLER: - if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA && - dev->data.controller->idx != 0) { + case VIR_DOMAIN_DEVICE_CONTROLLER: { + virDomainControllerDef *controller = dev->data.controller; + + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA && + controller->idx != 0) { return -1; + } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) { + if (controller->opts.vioserial.ports > 16) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Bhyve virtio-serial controller supports up to 16 ports")); + return -1; + } } break; - + } case VIR_DOMAIN_DEVICE_RNG: if (dev->data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO) { if (dev->data.rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM) { diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 1d436da609..711d1b66ea 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -473,6 +473,7 @@ virBhyveProcessStop(struct _bhyveConn *driver, virDomainObj *vm, virDomainShutoffReason reason) { + size_t i = 0; int ret = -1; g_autoptr(virCommand) cmd = NULL; bhyveDomainObjPrivate *priv = vm->privateData; @@ -512,6 +513,19 @@ virBhyveProcessStop(struct _bhyveConn *driver, } } + /* UNIX sockets cleanup */ + for (i = 0; i < vm->def->nchannels; i++) { + virDomainChrDef *channel = vm->def->channels[i]; + + if (channel->source->type != VIR_DOMAIN_CHR_TYPE_UNIX) + continue; + if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) + continue; + + if (virFileExists(channel->source->data.nix.path)) + virFileRemove(channel->source->data.nix.path, 0, 0); + } + ret = 0; virCloseCallbacksDomainRemove(vm, NULL, bhyveProcessAutoDestroy); diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.args new file mode 100644 index 0000000000..0942e75c1e --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.args @@ -0,0 +1,10 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,virtio-console,org.qemu.guest_agent.0=/var/run/libvirt/bhyve/bhyve.agent,org.qemu.guest_agent.1=/var/run/libvirt/bhyve/bhyve.agent-2 \ +-s 3:0,ahci,hd:/tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.ldargs b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.xml new file mode 100644 index 0000000000..7df574916e --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-virtio-console-mixed-addr.xml @@ -0,0 +1,26 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.args new file mode 100644 index 0000000000..b44c7b44c6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.args @@ -0,0 +1,10 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 1:0,ahci,hd:/tmp/freebsd.img \ +-s 2:0,virtio-console,org.qemu.guest_agent.0=/var/run/libvirt/bhyve/bhyve.agent \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.ldargs b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.xml new file mode 100644 index 0000000000..519fec6b85 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-addr.xml @@ -0,0 +1,25 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.args new file mode 100644 index 0000000000..939e5d6a86 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.args @@ -0,0 +1,11 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,virtio-console,org.qemu.guest_agent.1=/var/run/libvirt/bhyve/bhyve.agent-1 \ +-s 3:0,virtio-console,org.qemu.guest_agent.2=/var/run/libvirt/bhyve/bhyve.agent-2 \ +-s 4:0,ahci,hd:/tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.ldargs b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.xml new file mode 100644 index 0000000000..2d82addb12 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-controllers.xml @@ -0,0 +1,31 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='virtio-serial' index='0' ports='4'> + </controller> + <controller type='virtio-serial' index='1'> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-1'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.2'/> + <address type='virtio-serial' controller='1' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.args new file mode 100644 index 0000000000..e3d6b6d4a7 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.args @@ -0,0 +1,11 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,virtio-console,org.qemu.guest_agent.1=/var/run/libvirt/bhyve/bhyve.agent-1,org.qemu.guest_agent.2=/var/run/libvirt/bhyve/bhyve.agent-2,org.qemu.guest_agent.3=/var/run/libvirt/bhyve/bhyve.agent-3,org.qemu.guest_agent.4=/var/run/libvirt/bhyve/bhyve.agent-4,org.qemu.guest_agent.5=/var/run/libvirt/bhyve/bhyve.agent-5,org.qemu.guest_agent.6=/var/run/libvirt/bhyve/bhyve.agent-6,org.qemu.guest_agent.7=/var/run/libvirt/bhyve/bhyve.agent-7,org.qemu.guest_agent.8=/var/run/libvirt/bhyve/bhyve.agent-8,org.qemu.guest_agent.9=/var/run/libvirt/bhyve/bhyve.agent-9,org.qemu.guest_agent.10=/var/run/libvirt/bhyve/bhyve.agent-10,org.qemu.guest_agent.11=/var/run/libvirt/bhyve/bhyve.agent-11,org.qemu.guest_agent.12=/var/run/libvirt/bhyve/bhyve.agent-12,org.qemu.guest_agent.13=/var/run/libvirt/bhyve/bhyve.agent-13,org.qemu.guest_agent.14=/var/run/libvirt/bhyve/bhyve.agent-14,org.qemu.guest_agent.15=/var/run/libvirt/bhyve/bhyve.agent-15 \ +-s 3:0,virtio-console,org.qemu.guest_agent.16=/var/run/libvirt/bhyve/bhyve.agent-16,org.qemu.guest_agent.17=/var/run/libvirt/bhyve/bhyve.agent-17,org.qemu.guest_agent.18=/var/run/libvirt/bhyve/bhyve.agent-18 \ +-s 4:0,ahci,hd:/tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.ldargs b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.xml new file mode 100644 index 0000000000..b8dc39ed83 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-multiple-controllers.xml @@ -0,0 +1,89 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-1'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.2'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-3'/> + <target type='virtio' name='org.qemu.guest_agent.3'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-4'/> + <target type='virtio' name='org.qemu.guest_agent.4'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-5'/> + <target type='virtio' name='org.qemu.guest_agent.5'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-6'/> + <target type='virtio' name='org.qemu.guest_agent.6'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-7'/> + <target type='virtio' name='org.qemu.guest_agent.7'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-8'/> + <target type='virtio' name='org.qemu.guest_agent.8'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-9'/> + <target type='virtio' name='org.qemu.guest_agent.9'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-10'/> + <target type='virtio' name='org.qemu.guest_agent.10'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-11'/> + <target type='virtio' name='org.qemu.guest_agent.11'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-12'/> + <target type='virtio' name='org.qemu.guest_agent.12'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-13'/> + <target type='virtio' name='org.qemu.guest_agent.13'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-14'/> + <target type='virtio' name='org.qemu.guest_agent.14'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-15'/> + <target type='virtio' name='org.qemu.guest_agent.15'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-16'/> + <target type='virtio' name='org.qemu.guest_agent.16'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-17'/> + <target type='virtio' name='org.qemu.guest_agent.17'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-18'/> + <target type='virtio' name='org.qemu.guest_agent.18'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-too-many-ports.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-too-many-ports.xml new file mode 100644 index 0000000000..04ec8abc43 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console-too-many-ports.xml @@ -0,0 +1,25 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='virtio-serial' index='0' ports='17'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.args new file mode 100644 index 0000000000..66f4905f65 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.args @@ -0,0 +1,10 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,virtio-console,org.qemu.guest_agent.0=/var/run/libvirt/bhyve/bhyve.agent \ +-s 3:0,ahci,hd:/tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.ldargs b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.ldargs new file mode 100644 index 0000000000..5905f4b3e6 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.ldargs @@ -0,0 +1,4 @@ +bhyveload \ +-m 214 \ +-d /tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.xml new file mode 100644 index 0000000000..f7178849b9 --- /dev/null +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-virtio-console.xml @@ -0,0 +1,21 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index b7749fec6f..a01c88d8bc 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -289,6 +289,12 @@ mymain(void) DO_TEST_FAILURE("slirp-ip"); DO_TEST("virtio-scsi"); DO_TEST("vcpupin"); + DO_TEST("virtio-console"); + DO_TEST("virtio-console-addr"); + DO_TEST("2-virtio-console-mixed-addr"); + DO_TEST("virtio-console-multiple-controllers"); + DO_TEST("virtio-console-controllers"); + DO_TEST_FAILURE("virtio-console-too-many-ports"); /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-virtio-console-mixed-addr.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-virtio-console-mixed-addr.xml new file mode 100644 index 0000000000..7243d95d0a --- /dev/null +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-virtio-console-mixed-addr.xml @@ -0,0 +1,40 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='pci' index='0' model='pci-root'/> + <controller type='virtio-serial' index='0' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + <address type='virtio-serial' controller='0' bus='0' port='2'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-addr.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-addr.xml new file mode 100644 index 0000000000..08735831b1 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-addr.xml @@ -0,0 +1,35 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <controller type='virtio-serial' index='0' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-controllers.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-controllers.xml new file mode 100644 index 0000000000..1fd1e1dfb1 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-controllers.xml @@ -0,0 +1,43 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='virtio-serial' index='0' ports='4'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-1'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.2'/> + <address type='virtio-serial' controller='1' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-multiple-controllers.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-multiple-controllers.xml new file mode 100644 index 0000000000..241828ef0c --- /dev/null +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console-multiple-controllers.xml @@ -0,0 +1,123 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='pci' index='0' model='pci-root'/> + <controller type='virtio-serial' index='0' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-1'/> + <target type='virtio' name='org.qemu.guest_agent.1'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-2'/> + <target type='virtio' name='org.qemu.guest_agent.2'/> + <address type='virtio-serial' controller='0' bus='0' port='2'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-3'/> + <target type='virtio' name='org.qemu.guest_agent.3'/> + <address type='virtio-serial' controller='0' bus='0' port='3'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-4'/> + <target type='virtio' name='org.qemu.guest_agent.4'/> + <address type='virtio-serial' controller='0' bus='0' port='4'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-5'/> + <target type='virtio' name='org.qemu.guest_agent.5'/> + <address type='virtio-serial' controller='0' bus='0' port='5'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-6'/> + <target type='virtio' name='org.qemu.guest_agent.6'/> + <address type='virtio-serial' controller='0' bus='0' port='6'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-7'/> + <target type='virtio' name='org.qemu.guest_agent.7'/> + <address type='virtio-serial' controller='0' bus='0' port='7'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-8'/> + <target type='virtio' name='org.qemu.guest_agent.8'/> + <address type='virtio-serial' controller='0' bus='0' port='8'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-9'/> + <target type='virtio' name='org.qemu.guest_agent.9'/> + <address type='virtio-serial' controller='0' bus='0' port='9'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-10'/> + <target type='virtio' name='org.qemu.guest_agent.10'/> + <address type='virtio-serial' controller='0' bus='0' port='10'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-11'/> + <target type='virtio' name='org.qemu.guest_agent.11'/> + <address type='virtio-serial' controller='0' bus='0' port='11'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-12'/> + <target type='virtio' name='org.qemu.guest_agent.12'/> + <address type='virtio-serial' controller='0' bus='0' port='12'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-13'/> + <target type='virtio' name='org.qemu.guest_agent.13'/> + <address type='virtio-serial' controller='0' bus='0' port='13'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-14'/> + <target type='virtio' name='org.qemu.guest_agent.14'/> + <address type='virtio-serial' controller='0' bus='0' port='14'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-15'/> + <target type='virtio' name='org.qemu.guest_agent.15'/> + <address type='virtio-serial' controller='0' bus='0' port='15'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-16'/> + <target type='virtio' name='org.qemu.guest_agent.16'/> + <address type='virtio-serial' controller='1' bus='0' port='1'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-17'/> + <target type='virtio' name='org.qemu.guest_agent.17'/> + <address type='virtio-serial' controller='1' bus='0' port='2'/> + </channel> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent-18'/> + <target type='virtio' name='org.qemu.guest_agent.18'/> + <address type='virtio-serial' controller='1' bus='0' port='3'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console.xml new file mode 100644 index 0000000000..ec82054df7 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-virtio-console.xml @@ -0,0 +1,35 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <driver name='file' type='raw'/> + <source file='/tmp/freebsd.img'/> + <target dev='hda' bus='sata'/> + <address type='drive' controller='0' bus='0' target='2' unit='0'/> + </disk> + <controller type='pci' index='0' model='pci-root'/> + <controller type='virtio-serial' index='0' ports='16'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <channel type='unix'> + <source mode='bind' path='/var/run/libvirt/bhyve/bhyve.agent'/> + <target type='virtio' name='org.qemu.guest_agent.0'/> + <address type='virtio-serial' controller='0' bus='0' port='1'/> + </channel> + </devices> +</domain> diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 950aaea672..bcbd808679 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -133,6 +133,12 @@ mymain(void) DO_TEST_DIFFERENT("slirp"); DO_TEST_DIFFERENT("virtio-scsi"); DO_TEST_DIFFERENT("numa"); + DO_TEST_DIFFERENT("virtio-console"); + DO_TEST_DIFFERENT("virtio-console-addr"); + DO_TEST_DIFFERENT("2-virtio-console-mixed-addr"); + DO_TEST_DIFFERENT("virtio-console-multiple-controllers"); + DO_TEST_DIFFERENT("virtio-console-controllers"); + DO_TEST_FAILURE("virtio-console-too-many-ports"); /* Address allocation tests */ DO_TEST_DIFFERENT("addr-single-sata-disk"); -- 2.52.0
participants (1)
-
Roman Bogorodskiy