* bhyve_domain.c: bhyve domain private state
*
* Copyright (C) 2014 Roman Bogorodskiy
+ * Copyright (C) 2025 The FreeBSD Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
return -1;
}
+ if (dev->type == VIR_DOMAIN_DEVICE_RNG) {
+ if (dev->data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO) {
+ if (dev->data.rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM) {
+ if (STRNEQ(dev->data.rng->source.file, "/dev/random")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only /dev/random source is supported"));
+ return -1;
+ }
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only 'random' backend model is supported"));
+ return -1;
+ }
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only 'virio' RNG device model is supported"));
+ return -1;
+ }
+ }
+
return 0;
}
--- /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>
+ <interface type='bridge'>
+ <mac address='52:54:00:b9:94:02'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <rng model='virtio'>
+ <backend model='builtin'/>
+ </rng>
+ </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>
+ <interface type='bridge'>
+ <mac address='52:54:00:b9:94:02'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <rng model='virtio'>
+ <backend model='random'>/random/dev</backend>
+ </rng>
+ </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>
+ <interface type='bridge'>
+ <mac address='52:54:00:b9:94:02'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <rng model='virtio-transitional'>
+ <backend model='random'/>
+ </rng>
+ </devices>
+</domain>
driver.bhyvecaps &= ~BHYVE_CAP_VIRTIO_9P;
DO_TEST_FAILURE("fs-9p");
DO_TEST("virtio-rnd");
+ DO_TEST_FAILURE("virtio-rnd-backend-random-non-default-file");
+ DO_TEST_FAILURE("virtio-rnd-backend-builtin");
+ DO_TEST_FAILURE("virtio-rnd-transitional");
driver.bhyvecaps &= ~BHYVE_CAP_VIRTIO_RND;
DO_TEST_FAILURE("virtio-rnd");