[libvirt] [PATCHv2 00/16] Introduce hvf domain type for Hypevisor.framework
by Roman Bolshakov
Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).
It's supported since macOS 10.10 on machines with Intel VT-x feature
set that includes Extended Page Tables (EPT) and Unrestricted Mode.
QEMU supports Hypervisor.framework since 2.12.
The patch series adds "hvf" domain that uses Hypevisor.framework.
v1: https://www.redhat.com/archives/libvir-list/2018-October/msg01090.html
Changes since v1:
- [x] Fixed unconditional addition of KVM CPU models into capabilities cache.
That fixed a "make check" issue in qemucapabilitiestest on Linux.
- [x] Fixed missing brace in virQEMUCapsFormatCPUModels in PATCH 6
- [x] Squashed patch 12 into the first patch (second one in the patch series)
- [x] Added hvf domain definition to docs/formatdomain.html.in into the first
patch (second in the patch series)
- [x] Removed redundant argument in virQEMUCapsProbeHVF (patch 3)
- [x] Added separate virQEMUCapsProbeHVF for non-apple platforms (patch 3)
- [x] Added macOS support page
- [x] Marked HVF support for all working domain elements
I wasn't able to resolve the issues below, but I think they should go
into separate patches/patch series:
- [ ] To make qemucapabilitiestests work regardless of OS, accelerator probing
should be done via QMP command.
So, there's a need to add a new generic
command to QEMU "query-accelerator accel=NAME"
- [ ] VIRT_TEST_PRELOAD doesn't work on macOS. There are a few
reasons:
* DYLD_INSERT_LIBRARIES should be used instead of LD_PRELOAD
*
-module flag shouldn't be added to LDFLAGS in tests/Makefile.am.
The flag instructs libtool to creates bundles (MH_BUNDLE) instead of
dynamic libraries (MH_DYLIB) and unlike dylibs they cannot be preloaded.
* Either symbol interposing or flat namespaces should be used to perform
overrides of the calls to the mocks.
I've tried both but neither worked for me, need to make a minimal
example.
I haven't completed the investigation as it looks like a separate work item.
- [ ] Can't retrieve qemucapsprobe replies for macOS because qemucapsprobemock
is not getting injected because of the issue with VIRT_TEST_PRELOAD
- [ ] Can't add to tests/qemuxml2argvtest.c to illustrate the hvf example
because qemucapsprobe doesn't work yet.
Roman Bolshakov (16):
qemu: Add KVM CPUs into cache only if KVM is present
conf: Add hvf domain type
qemu: Define hvf capability
qemu: Query hvf capability on macOS
qemu: Expose hvf domain type if hvf is supported
qemu: Rename kvmCPU to accelCPU
qemu: Introduce virQEMUCapsTypeIsAccelerated
qemu: Introduce virQEMUCapsHaveAccel
qemu: Introduce virQEMUCapsToVirtType
qemu: Introduce virQEMUCapsAccelStr
qemu: Make error message accel-agnostic
qemu: Correct CPU capabilities probing for hvf
news: Mention hvf domain type
docs: Add hvf on QEMU driver page
docs: Note hvf support for domain elements
docs: Add support page for libvirt on macOS
docs/docs.html.in | 3 +
docs/drvqemu.html.in | 49 +++++++-
docs/formatdomain.html.in | 141 ++++++++++++---------
docs/index.html.in | 4 +-
docs/macos.html.in | 229 ++++++++++++++++++++++++++++++++++
docs/news.xml | 12 ++
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 201 +++++++++++++++++++++--------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 4 +
12 files changed, 534 insertions(+), 116 deletions(-)
create mode 100644 docs/macos.html.in
--
2.19.1
5 years, 12 months
[libvirt] [PATCH v3] qemu: Add check for whether KVM nesting is enabled
by John Ferlan
Support for nested KVM is handled via a kernel module configuration
parameters values for kvm_intel, kvm_amd, kvm_hv (PPC), or kvm (s390).
While it's possible to fetch the kmod config values via virKModConfig,
unfortunately that is the static value and we need to get the
current/dynamic value from the kernel file system.
So this patch adds a new API virHostKVMSupportsNesting that will
search the 3 kernel modules to get the nesting value and check if
it is 'Y' (or 'y' just in case) or '1' to return a true/false whether
the KVM kernel supports nesting.
We need to do this in order to handle cases where adjustments to
the value are made after libvirtd is started to force a refetch of
the latest QEMU capabilities since the correct CPU settings need
to be made for a guest to add the "vmx=on" to/for the guest config.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
NB to be removed before push - I got data from:
(IBM Z) https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/...
(PPC slide 131) https://events.linuxfoundation.org/wp-content/uploads/2017/12/Taking-it-t...
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
v2: https://www.redhat.com/archives/libvir-list/2018-November/msg00955.html
Changes from code review...
- Rename variables/API's to KVMSupportsNested
- Movement of logic to check/set the 'nested' to inside locations that
ensure KVM was enabled (via capability).
- Change of logic to not use virKModConfig and instead look at the
running kernel value for /sys/module/*/parameters/nested where *
is kvm_intel, kvm_amd, kvm_hv, or kvm
src/qemu/qemu_capabilities.c | 54 ++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 20a1a0c201..bef92a679f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -558,6 +558,7 @@ struct _virQEMUCaps {
virObject parent;
bool usedQMP;
+ bool kvmSupportsNesting;
char *binary;
time_t ctime;
@@ -1530,6 +1531,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
return NULL;
ret->usedQMP = qemuCaps->usedQMP;
+ ret->kvmSupportsNesting = qemuCaps->kvmSupportsNesting;
if (VIR_STRDUP(ret->binary, qemuCaps->binary) < 0)
goto error;
@@ -3589,6 +3591,9 @@ virQEMUCapsLoadCache(virArch hostArch,
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
+ if (virXPathBoolean("boolean(./kvmSupportsNesting)", ctxt) > 0)
+ qemuCaps->kvmSupportsNesting = true;
+
ret = 0;
cleanup:
VIR_FREE(str);
@@ -3808,6 +3813,9 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
if (qemuCaps->sevCapabilities)
virQEMUCapsFormatSEVInfo(qemuCaps, &buf);
+ if (qemuCaps->kvmSupportsNesting)
+ virBufferAddLit(&buf, "<kvmSupportsNesting/>\n");
+
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</qemuCaps>\n");
@@ -3848,6 +3856,41 @@ virQEMUCapsSaveFile(void *data,
}
+/* Check the kernel module parameters 'nested' file to determine if enabled
+ *
+ * Intel: 'kvm_intel' uses 'Y'
+ * AMD: 'kvm_amd' uses '1'
+ * PPC64: 'kvm_hv' uses 'Y'
+ * S390: 'kvm' uses '1'
+ */
+static bool
+virQEMUCapsKVMSupportsNesting(void)
+{
+ static char const * const kmod[] = {"kvm_intel", "kvm_amd",
+ "kvm_hv", "kvm"};
+ VIR_AUTOFREE(char *) value = NULL;
+ int rc;
+ size_t i;
+
+ for (i = 0; i < ARRAY_CARDINALITY(kmod); i++) {
+ VIR_FREE(value);
+ rc = virFileReadValueString(&value, "/sys/module/%s/parameters/nested",
+ kmod[i]);
+ if (rc == -2)
+ continue;
+ if (rc < 0) {
+ virResetLastError();
+ return false;
+ }
+
+ if (value[0] == 'Y' || value[0] == 'y' || value[0] == '1')
+ return true;
+ }
+
+ return false;
+}
+
+
static bool
virQEMUCapsIsValid(void *data,
void *privData)
@@ -3856,6 +3899,7 @@ virQEMUCapsIsValid(void *data,
virQEMUCapsCachePrivPtr priv = privData;
bool kvmUsable;
struct stat sb;
+ bool kvmSupportsNesting;
if (!qemuCaps->binary)
return true;
@@ -3933,6 +3977,14 @@ virQEMUCapsIsValid(void *data,
qemuCaps->kernelVersion);
return false;
}
+
+ kvmSupportsNesting = virQEMUCapsKVMSupportsNesting();
+ if (kvmSupportsNesting != qemuCaps->kvmSupportsNesting) {
+ VIR_DEBUG("Outdated capabilities for '%s': kvm kernel nested "
+ "value changed from %d",
+ qemuCaps->binary, qemuCaps->kvmSupportsNesting);
+ return false;
+ }
}
return true;
@@ -4576,6 +4628,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
if (VIR_STRDUP(qemuCaps->kernelVersion, kernelVersion) < 0)
goto error;
+
+ qemuCaps->kvmSupportsNesting = virQEMUCapsKVMSupportsNesting();
}
cleanup:
--
2.17.2
6 years
[libvirt] [PATCH 0/2] qemu: fix misc noisy logs for optional sources
by Nikolay Shirokovskiy
Nikolay Shirokovskiy (2):
qemu: don't log error for missing optional sources on stats
qemu: don't log error for missing optional sources on start
src/qemu/qemu_driver.c | 5 +++++
src/qemu/qemu_process.c | 12 +++++++++++-
src/qemu/qemu_process.h | 2 ++
3 files changed, 18 insertions(+), 1 deletion(-)
--
1.8.3.1
6 years
[libvirt] [PATCH v3 0/2] lxc: Fix a bug related to IPv{4, 6} gateway persistent setting.
by Julio Faracco
This serie fixes a bug related to IPv{4,6} gateway settings when it is
defined and used with multiple network definitions. Basically, this data
is being carried on to the next network settings because the pointer is
not being cleaned up/initialized properly. The idea behind the fix was
create a new way to initialize the data without knowing the structure
attributes. The old way has a high probability to cause new bugs.
This serie add a new test case to cover this scenario too. It will be so
important to network index implemented on LXC 3.X.
v1-v2: Fixing tabs inside the code.
Julio Faracco (2):
lxc: Initializing IPv6 and IPv4 gateway to overwrite old settings.
tests: Adding test case to include multiple network definitions.
src/lxc/lxc_native.c | 27 ++++++-----
.../lxcconf2xml-miscnetwork-v3.config | 23 ++++++++++
.../lxcconf2xml-miscnetwork.config | 23 ++++++++++
.../lxcconf2xml-miscnetwork.xml | 45 +++++++++++++++++++
tests/lxcconf2xmltest.c | 2 +
5 files changed, 106 insertions(+), 14 deletions(-)
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-miscnetwork.xml
--
2.19.1
6 years
[libvirt] [PATCH] qemu: Don't use -mem-prealloc among with .prealloc=yes
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1624223
There are two ways to request memory preallocation on cmd line:
-mem-prealloc and .prealloc attribute to memory-backend-file.
However, as it turns out it's not safe to use both at the same
time. Prefer -mem-prealloc as it is more backward compatible
compared to switching to "-numa node,memdev= + -object
memory-backend-file".
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 37 +++++++++++++------
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_domain.h | 3 ++
src/qemu/qemu_hotplug.c | 3 +-
.../hugepages-numa-default-dimm.args | 2 +-
6 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e338d3172e..0294030f0e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3123,6 +3123,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* @def: domain definition object
* @mem: memory definition object
* @autoNodeset: fallback nodeset in case of automatic NUMA placement
+ * @forbidPrealloc: don't set prealloc attribute
* @force: forcibly use one of the backends
*
* Creates a configuration object that represents memory backend of given guest
@@ -3136,6 +3137,9 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
* Then, if one of the two memory-backend-* should be used, the @qemuCaps is
* consulted to check if qemu does support it.
*
+ * If @forbidPrealloc is true then 'prealloc' attribute of the backend is not
+ * set. This may come handy when global -mem-prealloc is already specified.
+ *
* Returns: 0 on success,
* 1 on success and if there's no need to use memory-backend-*
* -1 on error.
@@ -3148,6 +3152,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virDomainDefPtr def,
virDomainMemoryDefPtr mem,
virBitmapPtr autoNodeset,
+ bool forbidPrealloc,
bool force)
{
const char *backendType = "memory-backend-file";
@@ -3265,11 +3270,13 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
if (mem->nvdimmPath) {
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
goto cleanup;
- prealloc = true;
+ if (!forbidPrealloc)
+ prealloc = true;
} else if (useHugepage) {
if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
goto cleanup;
- prealloc = true;
+ if (!forbidPrealloc)
+ prealloc = true;
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
@@ -3398,7 +3405,8 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
mem.info.alias = alias;
if ((rc = qemuBuildMemoryBackendProps(&props, alias, cfg, priv->qemuCaps,
- def, &mem, priv->autoNodeset, false)) < 0)
+ def, &mem, priv->autoNodeset,
+ priv->memPrealloc, false)) < 0)
goto cleanup;
if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0)
@@ -3435,7 +3443,8 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
goto cleanup;
if (qemuBuildMemoryBackendProps(&props, alias, cfg, priv->qemuCaps,
- def, mem, priv->autoNodeset, true) < 0)
+ def, mem, priv->autoNodeset,
+ priv->memPrealloc, true) < 0)
goto cleanup;
if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0)
@@ -7443,7 +7452,8 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
static int
qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
- virCommandPtr cmd)
+ virCommandPtr cmd,
+ qemuDomainObjPrivatePtr priv)
{
const long system_page_size = virGetSystemPageSizeKB();
char *mem_path = NULL;
@@ -7465,8 +7475,10 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
return 0;
}
- if (def->mem.allocation != VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
+ if (def->mem.allocation != VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) {
virCommandAddArgList(cmd, "-mem-prealloc", NULL);
+ priv->memPrealloc = true;
+ }
virCommandAddArgList(cmd, "-mem-path", mem_path, NULL);
VIR_FREE(mem_path);
@@ -7479,7 +7491,8 @@ static int
qemuBuildMemCommandLine(virCommandPtr cmd,
virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ qemuDomainObjPrivatePtr priv)
{
if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
return -1;
@@ -7498,15 +7511,17 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
virDomainDefGetMemoryInitial(def) / 1024);
}
- if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
+ if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) {
virCommandAddArgList(cmd, "-mem-prealloc", NULL);
+ priv->memPrealloc = true;
+ }
/*
* Add '-mem-path' (and '-mem-prealloc') parameter here if
* the hugepages and no numa node is specified.
*/
if (!virDomainNumaGetNodeCount(def->numa) &&
- qemuBuildMemPathStr(cfg, def, cmd) < 0)
+ qemuBuildMemPathStr(cfg, def, cmd, priv) < 0)
return -1;
if (def->mem.locked && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_REALTIME_MLOCK)) {
@@ -7613,7 +7628,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
}
if (!needBackend &&
- qemuBuildMemPathStr(cfg, def, cmd) < 0)
+ qemuBuildMemPathStr(cfg, def, cmd, priv) < 0)
goto cleanup;
for (i = 0; i < ncells; i++) {
@@ -10250,7 +10265,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0)
goto error;
- if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps) < 0)
+ if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps, priv) < 0)
goto error;
if (qemuBuildSmpCommandLine(cmd, def) < 0)
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 98d4ac90b5..656479ac45 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -129,6 +129,7 @@ int qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virDomainDefPtr def,
virDomainMemoryDefPtr mem,
virBitmapPtr autoNodeset,
+ bool forbidPrealloc,
bool force);
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ba3fff607a..0307acfe6a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1944,6 +1944,8 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
VIR_FREE(priv->libDir);
VIR_FREE(priv->channelTargetDir);
+ priv->memPrealloc = false;
+
/* remove automatic pinning data */
virBitmapFree(priv->autoNodeset);
priv->autoNodeset = NULL;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 80bd4bde91..7ccbff8d26 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -370,6 +370,9 @@ struct _qemuDomainObjPrivate {
/* qemuProcessStartCPUs stores the reason for starting vCPUs here for the
* RESUME event handler to use it */
virDomainRunningReason runningReason;
+
+ /* true if global -mem-prealloc appears on cmd line */
+ bool memPrealloc;
};
# define QEMU_DOMAIN_PRIVATE(vm) \
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0a63741b9e..6ead926f09 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2458,7 +2458,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
goto cleanup;
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
- priv->qemuCaps, vm->def, mem, NULL, true) < 0)
+ priv->qemuCaps, vm->def, mem, NULL,
+ priv->memPrealloc, true) < 0)
goto cleanup;
if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
index 143d8b041f..df90f7aad9 100644
--- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
+++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-mem-prealloc \
-mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \
-numa node,nodeid=0,cpus=0-1,mem=1024 \
--object memory-backend-file,id=memdimm0,prealloc=yes,\
+-object memory-backend-file,id=memdimm0,\
mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,\
host-nodes=1-3,policy=bind \
-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
--
2.18.1
6 years
[libvirt] [PATCH v2] qemu: disable external snapshot of readonly disk
by Nikolay Shirokovskiy
Disable external snapshot of readonly disk for inactive domains
as this operation is not very useful. As to active domains
such snapshot was not possible before already but error message was
not helpful so now it will be better.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
Diff from v1 [1]
================
- move check to qemuDomainSnapshotPrepareDiskExternal
- disable such snapshot for inactive domain as well
[1] [PATCH] qemu: snapshot: better error for active external readonly disk
https://www.redhat.com/archives/libvir-list/2018-October/msg01322.html
continues in
https://www.redhat.com/archives/libvir-list/2018-November/msg00265.html
src/qemu/qemu_driver.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e249..e747a5b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14514,6 +14514,13 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
int ret = -1;
struct stat st;
+ if (disk->src->readonly) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external snapshot for readonly disk %s "
+ "is not supported"), disk->dst);
+ return -1;
+ }
+
if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0)
return -1;
--
1.8.3.1
6 years
[libvirt] [PATCH] qemu: Qemu process unexpectedly killed in repeated reboot
by Wang King
The issue occurs when I make repeated calls to virDomainReboot with
VIR_DOMAIN_REBOOT_DEFAULT flag. In the first call to reboot domain,
the qemu driver chose ACPI path, and set priv->fakeReboot to true.
Then in a second call, qemu driver chose agent to reboot which set
fakeReboot to false. But because the guest already responded to ACPI
shut down, libvirtd daemon will process a SHUTDOWN event in
qemuProcessShutdownOrReboot and checks priv->fakeReboot. Since the
fakeReboot flag is now false, qemu process is unexpectedly killed.
I have no idea how to fix it.
Signed-off-by: Wang King <king.wang(a)huawei.com>
--
2.8.3
6 years
[libvirt] [PATCH 0/3] libxl: add support for openvswitch
by Jim Fehlig
Patch1 adds support in the driver, patch2 adds support in the
config converter, and it ends with some news...
Jim Fehlig (3):
libxl: support openvswitch interfaces
xenconfig: add support for openvswitch configuration
news: Mention Xen support for openvswitch
docs/news.xml | 10 ++
src/libxl/libxl_conf.c | 47 +++++++-
src/xenconfig/xen_common.c | 113 +++++++++++++++++-
.../test-fullvirt-ovswitch-tagged.cfg | 25 ++++
.../test-fullvirt-ovswitch-tagged.xml | 50 ++++++++
.../test-fullvirt-ovswitch-trunked.cfg | 25 ++++
.../test-fullvirt-ovswitch-trunked.xml | 51 ++++++++
tests/xlconfigtest.c | 2 +
8 files changed, 317 insertions(+), 6 deletions(-)
create mode 100644 tests/xlconfigdata/test-fullvirt-ovswitch-tagged.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-ovswitch-tagged.xml
create mode 100644 tests/xlconfigdata/test-fullvirt-ovswitch-trunked.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-ovswitch-trunked.xml
--
2.18.0
6 years
[libvirt] [PATCH] version: Add ParseVersion and a Version struct
by W. Trevor King
Make it easier to convert version integers to the more human-readable
major.minor.release format.
---
connect.go | 8 ++++++++
version.go | 52 ++++++++++++++++++++++++++++++++++++++++++++++
version_test.go | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 124 insertions(+)
create mode 100644 version.go
create mode 100644 version_test.go
diff --git a/connect.go b/connect.go
index 8cc7cc7..fac45da 100644
--- a/connect.go
+++ b/connect.go
@@ -46,6 +46,7 @@ func init() {
}
const (
+ // VERSION_NUMBER is the version of the linked libvirt.
VERSION_NUMBER = uint32(C.LIBVIR_VERSION_NUMBER)
)
@@ -306,7 +307,9 @@ func releaseConnectionData(c *Connect) {
delete(connections, c.ptr)
}
+// GetVersion returns the version of the linked libvirt.
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
+// and ParseVersion.
func GetVersion() (uint32, error) {
var version C.ulong
var err C.virError
@@ -540,7 +543,10 @@ func (c *Connect) GetHostname() (string, error) {
return hostname, nil
}
+// GetLibVersion returns the version of libvirt used by the daemon
+// running on the connected host.
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersion
+// and ParseVersion.
func (c *Connect) GetLibVersion() (uint32, error) {
var version C.ulong
var err C.virError
@@ -2272,7 +2278,9 @@ func (c *Connect) GetDomainCapabilities(emulatorbin string, arch string, machine
return C.GoString(ret), nil
}
+// GetVersion returns the hypervisor version.
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion
+// and ParseVersion.
func (c *Connect) GetVersion() (uint32, error) {
var hvVer C.ulong
var err C.virError
diff --git a/version.go b/version.go
new file mode 100644
index 0000000..1a07fa3
--- /dev/null
+++ b/version.go
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ */
+
+package libvirt
+
+import (
+ "fmt"
+)
+
+// Version represents the libvirt version.
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
+type Version struct {
+ Major uint32
+ Minor uint32
+ Release uint32
+}
+
+// String returns the "major.minor.release" version string.
+func (v *Version) String() string {
+ return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Release)
+}
+
+// ParseVersion converts a version integer to a structured Version instance.
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
+func ParseVersion(version uint32) *Version {
+ return &Version{
+ Major: version / 1000000,
+ Minor: (version / 1000) % 1000,
+ Release: version % 1000,
+ }
+}
diff --git a/version_test.go b/version_test.go
new file mode 100644
index 0000000..ecafe5d
--- /dev/null
+++ b/version_test.go
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ */
+
+package libvirt
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestVersionString(t *testing.T) {
+ version := Version{
+ Major: 3,
+ Minor: 9,
+ Release: 0,
+ }
+ actual := version.String()
+ expected := "3.9.0"
+ if actual != expected {
+ t.Fatalf("%q != %q", actual, expected)
+ }
+}
+
+func TestParseVersion(t *testing.T) {
+ for _, testCase := range []struct{
+ input uint32
+ expected *Version
+ }{
+ {
+ input: 3009000,
+ expected: &Version{Major: 3, Minor: 9},
+ },
+ {
+ input: 4001002,
+ expected: &Version{Major: 4, Minor: 1, Release: 2},
+ },
+ } {
+ actual := ParseVersion(testCase.input)
+ if !reflect.DeepEqual(actual, testCase.expected) {
+ t.Fatalf("%v != %v", actual, testCase.expected)
+ }
+ }
+}
--
1.8.3.1
6 years
[libvirt] [PATCH 0/2] Fix a couple get all domain stats issues
by John Ferlan
One is longer term (patch1), while the other is sourced in this
release (4.10.0) when IOThread stats were added.
John Ferlan (2):
qemu: Save qemuDomainGetStats error
qemu: Don't fail stats collection due to IOThread capability
src/qemu/qemu_driver.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
--
2.17.2
6 years