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,
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:
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,
{
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;
(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) {
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;
}
#include "viralloc.h"
#include "virfile.h"
#include "virlog.h"
+#include "virstring.h"
#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_BHYVE
{
struct _bhyveConn *driver = opaque;
g_autoptr(virCaps) caps = bhyveDriverGetCapabilities(driver);
+ size_t i;
+ size_t virtio_channels = 0;
+ size_t virtio_serial_controllers = 0;
+ size_t virtio_serial_existing_controllers = 0;
+ size_t virtio_serial_controllers_to_create = 0;
if (!caps)
return -1;
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;
}
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;
}
}
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) {
}
break;
- case VIR_DOMAIN_DEVICE_CHR:
- if (dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
- virDomainChrDef *chr = dev->data.chr;
+ case VIR_DOMAIN_DEVICE_CHR: {
+ virDomainChrDef *chr = dev->data.chr;
+ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
if (chr->source->type != VIR_DOMAIN_CHR_TYPE_NMDM &&
chr->source->type != VIR_DOMAIN_CHR_TYPE_TCP) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
return -1;
}
}
+ } else 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) {
+ if (virStringHasChars(chr->target.name, ",")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Commas (',') are not allowed in channel names"));
+ return -1;
+ }
+ if (chr->source->data.nix.path) {
+ if (virStringHasChars(chr->source->data.nix.path, ",")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Commas (',') are not allowed in UNIX socket paths"));
+ return -1;
+ }
+ }
}
break;
-
+ }
case VIR_DOMAIN_DEVICE_DISK: {
virDomainDiskDef *disk = dev->data.disk;
virDomainShutoffReason reason)
{
int ret = 0;
+ size_t i = 0;
g_autoptr(virCommand) cmd = NULL;
bhyveDomainObjPrivate *priv = vm->privateData;
}
}
+ /* 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);
+ }
+
virCloseCallbacksDomainRemove(vm, NULL, bhyveProcessAutoDestroy);
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
--- /dev/null
+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
--- /dev/null
+bhyveload \
+-m 214 \
+-d /tmp/freebsd.img \
+bhyve
--- /dev/null
+<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>
--- /dev/null
+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
--- /dev/null
+bhyveload \
+-m 214 \
+-d /tmp/freebsd.img \
+bhyve
--- /dev/null
+<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>
--- /dev/null
+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
--- /dev/null
+bhyveload \
+-m 214 \
+-d /tmp/freebsd.img \
+bhyve
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+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
--- /dev/null
+bhyveload \
+-m 214 \
+-d /tmp/freebsd.img \
+bhyve
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+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
--- /dev/null
+bhyveload \
+-m 214 \
+-d /tmp/freebsd.img \
+bhyve
--- /dev/null
+<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>
DO_TEST_FAILURE("blkiotune-invalid-device");
DO_TEST_FAILURE("blkiotune-multiple-devices");
DO_TEST_FAILURE("blkiotune-weight");
+ 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");
+ DO_TEST_FAILURE("virtio-console-invalid-name");
+ DO_TEST_FAILURE("virtio-console-invalid-path");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
DO_TEST_FAILURE("blkiotune-invalid-device");
DO_TEST_FAILURE("blkiotune-weight");
DO_TEST_FAILURE("blkiotune-multiple-devices");
+ 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");
+ DO_TEST_FAILURE("virtio-console-invalid-name");
+ DO_TEST_FAILURE("virtio-console-invalid-path");
/* Address allocation tests */
DO_TEST_DIFFERENT("addr-single-sata-disk");