[PATCH v2 00/13] Introduce virtio-mem <memory/> model
by Michal Privoznik
v2 of:
https://listman.redhat.com/archives/libvir-list/2021-January/msg00965.html
diff to v1:
- Rebased onto current master
- Introduced new MEMORY_DEVICE_SIZE_CHANGE event
- Forbade using virtio-mem among with memballoon
- Wrote kbase article
- Hopefully, worked in all Peter's review suggestions
New patches in this series: 02, 03, 09, 13. The rest was more or less
okay. Daniel ACKed it. I will amend his tag to respective commit message
before pushing.
Michal Prívozník (13):
virhostmem: Introduce virHostMemGetTHPSize()
qemu_process: Deduplicate code in qemuProcessNeedHugepagesPath()
qemu_process: Drop needless check in
qemuProcessNeedMemoryBackingPath()
qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI
conf: Introduce virtio-mem <memory/> model
qemu: Build command line for virtio-mem
qemu: Wire up <memory/> live update
qemu: Wire up MEMORY_DEVICE_SIZE_CHANGE event
Introduce MEMORY_DEVICE_SIZE_CHANGE event
qemu: Refresh the actual size of virtio-mem on monitor reconnect
virsh: Introduce update-memory command
news: document recent virtio memory addition
kbase: Document virtio-mem
NEWS.rst | 7 +
docs/formatdomain.rst | 58 ++++-
docs/kbase/index.rst | 4 +
docs/kbase/memorydevices.rst | 160 ++++++++++++++
docs/kbase/meson.build | 1 +
docs/manpages/virsh.rst | 30 +++
docs/schemas/domaincommon.rng | 16 ++
examples/c/misc/event-test.c | 17 ++
include/libvirt/libvirt-domain.h | 23 ++
src/conf/domain_conf.c | 115 +++++++++-
src/conf/domain_conf.h | 15 ++
src/conf/domain_event.c | 84 +++++++
src/conf/domain_event.h | 10 +
src/conf/domain_validate.c | 39 ++++
src/libvirt_private.syms | 5 +
src/qemu/qemu_alias.c | 10 +-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 13 +-
src/qemu/qemu_domain.c | 67 +++++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_domain_address.c | 38 +++-
src/qemu/qemu_driver.c | 209 +++++++++++++++++-
src/qemu/qemu_hotplug.c | 18 ++
src/qemu/qemu_hotplug.h | 5 +
src/qemu/qemu_monitor.c | 37 ++++
src/qemu/qemu_monitor.h | 27 +++
src/qemu/qemu_monitor_json.c | 95 ++++++--
src/qemu/qemu_monitor_json.h | 5 +
src/qemu/qemu_process.c | 101 +++++++--
src/qemu/qemu_validate.c | 22 +-
src/remote/remote_daemon_dispatch.c | 30 +++
src/remote/remote_driver.c | 32 +++
src/remote/remote_protocol.x | 15 +-
src/remote_protocol-structs | 7 +
src/security/security_apparmor.c | 1 +
src/security/security_dac.c | 2 +
src/security/security_selinux.c | 2 +
src/util/virhostmem.c | 63 ++++++
src/util/virhostmem.h | 3 +
tests/domaincapsmock.c | 9 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
...mory-hotplug-virtio-mem.x86_64-latest.args | 48 ++++
.../memory-hotplug-virtio-mem.xml | 64 ++++++
tests/qemuxml2argvtest.c | 1 +
...emory-hotplug-virtio-mem.x86_64-latest.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
tools/virsh-domain.c | 170 ++++++++++++++
50 files changed, 1619 insertions(+), 68 deletions(-)
create mode 100644 docs/kbase/memorydevices.rst
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
create mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-virtio-mem.x86_64-latest.xml
--
2.26.2
3 years, 9 months
[PATCH 0/4] tests: qemu: Update test data after dropping old machine types
by Peter Krempa
qemu dropped pc-1.0/pc-1.1/pc-1.2 for the upcoming release, fix some
tests and update the data.
The two other disk test updates bump the oldest qemu machine type in the
_LATEST tests to 2.9, which should be okay for some time.
Peter Krempa (4):
qemuxml2argvdata: disk-cdrom-network: Remove specific machine type
qemuxml2argvdata: disk-cache: Remove specific machine type
qemuxml2argvdata: luks-disks-source-qcow2: Remove specific machine
type
qemucapabilitiesdata: Update 6.0.0 x86_64 capability test data
.../caps_6.0.0.x86_64.replies | 2485 +++++++++--------
.../caps_6.0.0.x86_64.xml | 10 +-
.../disk-cache.x86_64-2.12.0.args | 2 +-
.../disk-cache.x86_64-2.6.0.args | 2 +-
.../disk-cache.x86_64-2.7.0.args | 2 +-
.../disk-cache.x86_64-latest.args | 3 +-
tests/qemuxml2argvdata/disk-cache.xml | 2 +-
.../qemuxml2argvdata/disk-cdrom-network.args | 2 +-
.../disk-cdrom-network.x86_64-2.12.0.args | 2 +-
.../disk-cdrom-network.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/disk-cdrom-network.xml | 2 +-
.../luks-disks-source-qcow2.args | 2 +-
...luks-disks-source-qcow2.x86_64-latest.args | 3 +-
.../luks-disks-source-qcow2.xml | 2 +-
.../disk-cache.x86_64-2.12.0.xml | 2 +-
.../disk-cache.x86_64-2.6.0.xml | 2 +-
.../disk-cache.x86_64-2.7.0.xml | 2 +-
.../disk-cache.x86_64-latest.xml | 2 +-
.../luks-disks-source-qcow2.x86_64-latest.xml | 2 +-
19 files changed, 1281 insertions(+), 1250 deletions(-)
--
2.29.2
3 years, 9 months
[libvirt PATCH] gitlab: Fix build container dependencies for build jobs
by Andrea Bolognani
A couple of these were wrong, resulting in the build job not
waiting for the correct container to be built before starting.
Fixes: 77296c807b18d22286be4b0ba5595d13103910a1
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
"How did this get past review?" O:-)
Pushed as trivial.
.gitlab-ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5221e8b5b6..5779b1b8b2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -486,7 +486,7 @@ mipsel-debian-10:
s390x-debian-sid:
extends: .cross_build_job
needs:
- - s390x-debian-10-container
+ - s390x-debian-sid-container
variables:
NAME: debian-sid
CROSS: s390x
@@ -502,7 +502,7 @@ i686-debian-sid:
ppc64le-debian-sid:
extends: .cross_build_job
needs:
- - ppc64le-debian-10-container
+ - ppc64le-debian-sid-container
variables:
NAME: debian-sid
CROSS: ppc64le
--
2.26.2
3 years, 9 months
[PATCH] rpc: avoid crash when system time jump back
by BiaoxiangYe
From: BiaoXiang Ye <yebiaoxiang(a)huawei.com>
Setting the system time backward would lead to a
multiplication overflow in function virKeepAliveStart.
FunctionvirKeepAliveTimerInternal got the same bug too.
Backtrace below:
#0 0x0000ffffae898470 in raise () from /usr/lib64/libc.so.6
#1 0x0000ffffae89981c in abort () from /usr/lib64/libc.so.6
#2 0x0000ffffaf9a36a8 in __mulvsi3 () from /usr/lib64/libvirt.so.0
#3 0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=0xaaaaf954ce10, interval=interval@entry=0,
count=count@entry=0) at ../../src/rpc/virkeepalive.c:283
#4 0x0000ffffaf908560 in virNetServerClientStartKeepAlive (client=0xaaaaf954cbe0)
at ../../src/rpc/virnetserverclient.c:1628
#5 0x0000aaaac57eb6dc in remoteDispatchConnectSupportsFeature (server=0xaaaaf95309d0,
msg=0xaaaaf9549d90, ret=0xffff8c007fc0, args=0xffff8c002e70, rerr=0xffff9ea054a0,
client=0xaaaaf954cbe0) at ../../src/remote/remote_daemon_dispatch.c:5063
#6 remoteDispatchConnectSupportsFeatureHelper (server=0xaaaaf95309d0, client=0xaaaaf954cbe0,
msg=0xaaaaf9549d90, rerr=0xffff9ea054a0, args=0xffff8c002e70, ret=0xffff8c007fc0)
at ./remote/remote_daemon_dispatch_stubs.h:3503
#7 0x0000ffffaf9053a4 in virNetServerProgramDispatchCall(msg=0xaaaaf9549d90, client=0xaaaaf954cbe0,
server=0x0, prog=0xaaaaf953a170) at ../../src/rpc/virnetserverprogram.c:451
#8 virNetServerProgramDispatch (prog=0xaaaaf953a170, server=0x0, server@entry=0xaaaaf95309d0,
client=0xaaaaf954cbe0, msg=0xaaaaf9549d90) at ../../src/rpc/virnetserverprogram.c:306
#9 0x0000ffffaf90a6bc in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>,
client=<optimized out>, srv=0xaaaaf95309d0) at ../../src/rpc/virnetserver.c:137
#10 virNetServerHandleJob (jobOpaque=0xaaaaf950df80, opaque=0xaaaaf95309d0)
at ../../src/rpc/virnetserver.c:154
#11 0x0000ffffaf812e14 in virThreadPoolWorker (opaque=<optimized out>)
at ../../src/util/virthreadpool.c:163
#12 0x0000ffffaf81237c in virThreadHelper (data=<optimized out>) at ../../src/util/virthread.c:246
#13 0x0000ffffaea327ac in ?? () from /usr/lib64/libpthread.so.0
#14 0x0000ffffae93747c in ?? () from /usr/lib64/libc.so.6
(gdb) frame 3
#3 0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=0xaaaaf954ce10, interval=interval@entry=0,
count=count@entry=0) at ../../src/rpc/virkeepalive.c:283
283 timeout = ka->interval - delay;
(gdb) list
278 now = time(NULL);
279 delay = now - ka->lastPacketReceived; <='delay' got a negative value
280 if (delay > ka->interval)
281 timeout = 0;
282 else
283 timeout = ka->interval - delay;
284 ka->intervalStart = now - (ka->interval - timeout);
285 ka->timer = virEventAddTimeout(timeout * 1000, virKeepAliveTimer, <= multiplication overflow
286 ka, virObjectFreeCallback);
287 if (ka->timer < 0)
(gdb) p now
$2 = 18288001
(gdb) p ka->lastPacketReceived
$3 = 1609430405
Signed-off-by: BiaoXiang Ye <yebiaoxiang(a)huawei.com>
---
src/rpc/virkeepalive.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 860b91b6b1..e662484ea6 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -119,12 +119,25 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka,
if (ka->interval <= 0 || ka->intervalStart == 0)
return false;
+ if (now < ka->intervalStart) {
+ VIR_WARN("system time jump back detected. now=%ld,"
+ " intervalStart=%ld",
+ now, ka->intervalStart);
+ ka->intervalStart = now;
+ }
+
if (now - ka->intervalStart < ka->interval) {
timeval = ka->interval - (now - ka->intervalStart);
virEventUpdateTimeout(ka->timer, timeval * 1000);
return false;
}
+ if (now < ka->lastPacketReceived) {
+ VIR_WARN("system time jump back detected. now=%ld,"
+ " lastPacketReceived=%ld",
+ now, ka->lastPacketReceived);
+ ka->lastPacketReceived = now;
+ }
timeval = now - ka->lastPacketReceived;
PROBE(RPC_KEEPALIVE_TIMEOUT,
"ka=%p client=%p countToDeath=%d idle=%d",
@@ -271,6 +284,13 @@ virKeepAliveStart(virKeepAlivePtr ka,
ka, ka->client, interval, count);
now = time(NULL);
+ if (now < ka->lastPacketReceived) {
+ VIR_WARN("system time jump back detected. now=%ld,"
+ " lastPacketReceived=%ld",
+ now, ka->lastPacketReceived);
+ ka->lastPacketReceived = now;
+ }
+
delay = now - ka->lastPacketReceived;
if (delay > ka->interval)
timeout = 0;
--
2.23.0
3 years, 9 months
[PATCH] qemu: Release <memory/> device address on failed hotplug
by Michal Privoznik
A few commits back I've introduced new 'virtio-pmem' <memory/>
device. Since it's virtio it goes onto PCI bus. Therefore, on
hotplug new PCI address is generated (or provided one is
reserved). However, if hotplug fails (for whatever reason) the
address needs to be released. This is different to 'dimm' type of
address because for that type we don't keep a map of used slots
rather generate one on each address assign request. The map is
then thrown away. But for PCI addresses we keep internal state
and thus has to keep it updated. Therefore, this new
qemuDomainReleaseMemoryDeviceSlot() function is NOP for those
models which use 'dimm' address type ('dimm' and 'nvdimm').
While I'm at it, let's release the address in case of hot unplug.
Not that is supported (any such attempt fails with the following
error:
"virtio based memory devices cannot be unplugged"
But if QEMU ever implements hot unplug then we don't have to
remember to fix our code.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain_address.c | 23 +++++++++++++++++++++++
src/qemu/qemu_domain_address.h | 3 +++
src/qemu/qemu_hotplug.c | 6 ++++++
3 files changed, 32 insertions(+)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1171dc5b14..68dbf9e95b 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -3122,6 +3122,29 @@ qemuDomainAssignMemoryDeviceSlot(virQEMUDriverPtr driver,
}
+void
+qemuDomainReleaseMemoryDeviceSlot(virDomainObjPtr vm,
+ virDomainMemoryDefPtr mem)
+{
+ switch (mem->model) {
+ case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+ case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+ /* We don't need to release anything. Slot map is not
+ * kept around. It's constructed every time when
+ * assigning new slot. */
+ break;
+
+ case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
+ qemuDomainReleaseDeviceAddress(vm, &mem->info);
+ break;
+
+ case VIR_DOMAIN_MEMORY_MODEL_NONE:
+ case VIR_DOMAIN_MEMORY_MODEL_LAST:
+ break;
+ }
+}
+
+
static int
qemuDomainAssignMemorySlots(virDomainDefPtr def)
{
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 20a46160d5..bfd56e163e 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -60,6 +60,9 @@ int qemuDomainAssignMemoryDeviceSlot(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainMemoryDefPtr mem);
+void qemuDomainReleaseMemoryDeviceSlot(virDomainObjPtr vm,
+ virDomainMemoryDefPtr mem);
+
int qemuDomainEnsureVirtioAddress(bool *releaseAddr,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 94c3df6368..dc2b46057c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2400,6 +2400,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
g_autofree char *devstr = NULL;
g_autofree char *objalias = NULL;
bool objAdded = false;
+ bool releaseaddr = false;
bool teardownlabel = false;
bool teardowncgroup = false;
bool teardowndevice = false;
@@ -2416,6 +2417,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
if (qemuDomainAssignMemoryDeviceSlot(driver, vm, mem) < 0)
goto cleanup;
+ releaseaddr = true;
/* in cases where we are using a VM with aliases generated according to the
* index of the memory device we need to keep continue using that scheme */
@@ -2492,6 +2494,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
if (teardowndevice &&
qemuDomainNamespaceTeardownMemory(vm, mem) < 0)
VIR_WARN("Unable to remove memory device from /dev");
+ if (releaseaddr)
+ qemuDomainReleaseMemoryDeviceSlot(vm, mem);
}
virJSONValueFree(props);
@@ -4457,6 +4461,8 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
if (qemuProcessDestroyMemoryBackingPath(driver, vm, mem) < 0)
VIR_WARN("Unable to destroy memory backing path");
+ qemuDomainReleaseMemoryDeviceSlot(vm, mem);
+
virDomainMemoryDefFree(mem);
/* fix the balloon size */
--
2.26.2
3 years, 9 months
[libvirt PATCH] conf: allow virtio driver attributes for vhostuser disk
by Pavel Hrdina
All of these options are actually supported by vhostuser disk so
we should allow them to be usable.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_validate.c | 20 -------------------
.../disk-vhostuser.x86_64-latest.args | 4 ++--
tests/qemuxml2argvdata/disk-vhostuser.xml | 2 +-
.../disk-vhostuser.x86_64-latest.xml | 2 +-
4 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 222a9386f6..6b3e892332 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -322,26 +322,6 @@ virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
/* Unsupported driver elements */
- if (disk->virtio) {
- if (disk->virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("iommu is not supported with vhostuser disk"));
- return -1;
- }
-
- if (disk->virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("ats is not supported with vhostuser disk"));
- return -1;
- }
-
- if (disk->virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("packed is not supported with vhostuser disk"));
- return -1;
- }
- }
-
if (disk->src->metadataCacheMaxSize > 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("metadata_cache is not supported with vhostuser disk"));
diff --git a/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args b/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args
index b24b2c0b4f..30acd7c78b 100644
--- a/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args
@@ -33,8 +33,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device vhost-user-blk-pci,bus=pci.0,addr=0x2,chardev=chr-vu-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-chardev socket,id=chr-vu-virtio-disk1,path=/tmp/vhost1.sock,reconnect=10 \
--device vhost-user-blk-pci,bus=pci.0,addr=0x3,chardev=chr-vu-virtio-disk1,\
-id=virtio-disk1 \
+-device vhost-user-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,\
+addr=0x3,chardev=chr-vu-virtio-disk1,id=virtio-disk1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/disk-vhostuser.xml b/tests/qemuxml2argvdata/disk-vhostuser.xml
index c96ef9119c..cbe2804e39 100644
--- a/tests/qemuxml2argvdata/disk-vhostuser.xml
+++ b/tests/qemuxml2argvdata/disk-vhostuser.xml
@@ -20,7 +20,7 @@
<boot order='1'/>
</disk>
<disk type='vhostuser' device='disk'>
- <driver name='qemu' type='raw'/>
+ <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/>
<source type='unix' path='/tmp/vhost1.sock'>
<reconnect enabled='yes' timeout='10'/>
</source>
diff --git a/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml
index 9712dc0b12..87f5ec46ac 100644
--- a/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml
@@ -28,7 +28,7 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<disk type='vhostuser' device='disk' snapshot='no'>
- <driver name='qemu' type='raw'/>
+ <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/>
<source type='unix' path='/tmp/vhost1.sock'>
<reconnect enabled='yes' timeout='10'/>
</source>
--
2.29.2
3 years, 9 months
[PATCH] bhyve: auto allocate nmdm console paths
by Roman Bogorodskiy
Currently, nmdm console device requires user to specify master and slave
path attributes (such as /dev/nmdm0A and /dev/nmdm0B respectively).
However, making user find a non-occupied device name might be not
convenient, especially for the remote connections.
Update the logic to make these attributes optional. In case if not
specified, use /dev/nmdm$UUID[AB], where $UUID is a domain's UUID.
With this schema it's unlikely nmdm device will clash with other domains
or even other non-bhyve nmdm devices.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
src/bhyve/bhyve_domain.c | 14 ++++++
src/conf/domain_validate.c | 15 +++----
...gv-console-master-slave-not-specified.args | 11 +++++
...-console-master-slave-not-specified.ldargs | 3 ++
...rgv-console-master-slave-not-specified.xml | 24 ++++++++++
tests/bhyvexml2argvtest.c | 1 +
...out-console-master-slave-not-specified.xml | 44 +++++++++++++++++++
tests/bhyvexml2xmltest.c | 1 +
8 files changed, 104 insertions(+), 9 deletions(-)
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.xml
create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console-master-slave-not-specified.xml
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 1d99ba6c96..8fbc554a0a 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -170,6 +170,20 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_GOP;
}
+ if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
+ dev->data.chr->source->type == VIR_DOMAIN_CHR_TYPE_NMDM) {
+ virDomainChrDefPtr chr = dev->data.chr;
+
+ if (!chr->source->data.nmdm.master) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ virUUIDFormat(def->uuid, uuidstr);
+
+ chr->source->data.nmdm.master = g_strdup_printf("/dev/nmdm%sA", uuidstr);
+ chr->source->data.nmdm.slave = g_strdup_printf("/dev/nmdm%sB", uuidstr);
+ }
+ }
+
return 0;
}
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 222a9386f6..de3661fa3d 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -579,17 +579,14 @@ virDomainChrSourceDefValidate(const virDomainChrSourceDef *src_def,
break;
case VIR_DOMAIN_CHR_TYPE_NMDM:
- if (!src_def->data.nmdm.master) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing master path attribute for nmdm device"));
- return -1;
+ if ((src_def->data.nmdm.master && !src_def->data.nmdm.slave) ||
+ (!src_def->data.nmdm.master && src_def->data.nmdm.slave)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Should define both master and slave "
+ "path attributes for nmdm device"));
+ return -1;
}
- if (!src_def->data.nmdm.slave) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing slave path attribute for nmdm device"));
- return -1;
- }
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.args b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.args
new file mode 100644
index 0000000000..b24918e7eb
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.args
@@ -0,0 +1,11 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-s 1:0,lpc \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:b1:42:eb \
+-l com1,/dev/nmdmdf3be7e7-a104-11e3-aeb0-50e5492bd3dcA bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.ldargs
new file mode 100644
index 0000000000..32538b558e
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.xml
new file mode 100644
index 0000000000..6e198a49d1
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-console-master-slave-not-specified.xml
@@ -0,0 +1,24 @@
+<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:b1:42:eb'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <console type='nmdm'/>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index be816e554f..197334f9c4 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -177,6 +177,7 @@ mymain(void)
DO_TEST("macaddr");
DO_TEST("serial");
DO_TEST("console");
+ DO_TEST("console-master-slave-not-specified");
DO_TEST("grub-defaults");
DO_TEST("grub-bootorder");
DO_TEST("grub-bootorder2");
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console-master-slave-not-specified.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console-master-slave-not-specified.xml
new file mode 100644
index 0000000000..6a2f58a947
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-console-master-slave-not-specified.xml
@@ -0,0 +1,44 @@
+<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='isa' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <interface type='bridge'>
+ <mac address='52:54:00:b1:42:eb'/>
+ <source bridge='virbr0'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <serial type='nmdm'>
+ <source master='/dev/nmdmdf3be7e7-a104-11e3-aeb0-50e5492bd3dcA' slave='/dev/nmdmdf3be7e7-a104-11e3-aeb0-50e5492bd3dcB'/>
+ <target port='0'/>
+ </serial>
+ <console type='nmdm'>
+ <source master='/dev/nmdmdf3be7e7-a104-11e3-aeb0-50e5492bd3dcA' slave='/dev/nmdmdf3be7e7-a104-11e3-aeb0-50e5492bd3dcB'/>
+ <target type='serial' port='0'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index eb9b108704..428f1b47bb 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -88,6 +88,7 @@ mymain(void)
DO_TEST_DIFFERENT("bhyveload-bootorder4");
DO_TEST_DIFFERENT("bhyveload-explicitargs");
DO_TEST_DIFFERENT("console");
+ DO_TEST_DIFFERENT("console-master-slave-not-specified");
DO_TEST_DIFFERENT("custom-loader");
DO_TEST_DIFFERENT("disk-cdrom");
DO_TEST_DIFFERENT("disk-cdrom-grub");
--
2.30.0
3 years, 9 months
[libvirt PATCH 0/3] cpu: Fix build on some aarch64 platforms
by Andrea Bolognani
The current code was written under the assumption that any
platform that supports aarch64 will have either getauxval()
or elf_aux_info(), but that's not always true.
Andrea Bolognani (3):
cpu: Only include <sys/auxv.h> if available
cpu: Only retrieve AT_HWCAP once
cpu: Fix build on some aarch64 platforms
meson.build | 1 +
src/cpu/cpu_arm.c | 26 ++++++++++++--------------
2 files changed, 13 insertions(+), 14 deletions(-)
--
2.26.2
3 years, 9 months
[PATCH 0/4] Remove the deprecated pc-1.x machine types and related stuff
by Thomas Huth
The pc-1.x machine types have been deprecated since QEMU v5.0 already, and
nobody complained, so they can now be removed. While we're at it, also
remove some compatibility switches and related code that are now not
necessary anymore after these machine types have been removed.
(We could maybe even remove more stuff like the various host_features
switches in the virtio devices, but they still might be useful in certain
cases, so I decided not to remove them yet)
Thomas Huth (4):
hw/i386: Remove the deprecated pc-1.x machine types
hw/block/fdc: Remove the check_media_rate property
hw/virtio/virtio-balloon: Remove the "class" property
hw/usb/bus: Remove the "full-path" property
docs/system/deprecated.rst | 6 --
docs/system/removed-features.rst | 6 ++
hw/block/fdc.c | 17 +-----
hw/i386/pc_piix.c | 94 --------------------------------
hw/usb/bus.c | 7 +--
hw/virtio/virtio-balloon-pci.c | 11 +---
include/hw/usb.h | 2 +-
tests/qemu-iotests/172.out | 35 ------------
8 files changed, 11 insertions(+), 167 deletions(-)
--
2.27.0
3 years, 9 months
[PATCH] bhyve: relax emulator binary value check
by Roman Bogorodskiy
Currently, requesting domain capabilities fails when the specified
emulator binary does not equal to "/usr/sbin/bhyve". Relax this check
to allow any path with basename "bhyve", as it's a common case when
binary is specified without an absolute path.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
I'm not sure how useful is this check in general: at this point we don't
use the user specified emulator value anyway, just use BHYVE constant.
Probably it would be better to just drop the entire "else" block?
src/bhyve/bhyve_driver.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 78c3241293..277be8dbb0 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1647,11 +1647,14 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn,
if (emulatorbin == NULL) {
emulatorbin = "/usr/sbin/bhyve";
- } else if (STRNEQ(emulatorbin, "/usr/sbin/bhyve")) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("unknown emulator binary: %s"),
- emulatorbin);
- goto cleanup;
+ } else {
+ g_autofree char *emulatorbasename = g_path_get_basename(emulatorbin);
+ if (STRNEQ(emulatorbasename, "bhyve")) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown emulator binary: %s"),
+ emulatorbin);
+ goto cleanup;
+ }
}
if (!(caps = virBhyveDomainCapsBuild(conn->privateData, emulatorbin,
--
2.30.0
3 years, 9 months