[libvirt] [PATCH 0/6] networkStartNetworkVirtual: Cleanup error labels
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (6):
networkStartNetworkVirtual: s/err5/error
networkStartNetworkVirtual: Dissolve 'err4' label in 'error'
networkStartNetworkVirtual: Dissolve 'err3' label in 'error'
networkStartNetworkVirtual: Dissolve 'err2' label in 'error'
networkStartNetworkVirtual: Dissolve 'err1' label in 'error'
networkStartNetworkVirtual: Dissolve 'err0' label in 'error'
src/network/bridge_driver.c | 73 +++++++++++++++++--------------------
1 file changed, 33 insertions(+), 40 deletions(-)
--
2.21.0
5 years, 7 months
[libvirt] [PATCH] Revert "qemu: Do not override config XML in case of snapshot revert"
by Michal Privoznik
This reverts commit dfd70ca1ebc623fcda788c414a472107b37b2bb8.
Pushed by a mistake, sorry. There's still some discussion going
on upstream.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
/me needs to learn to clean branches before pushing some stuff. Sorry
for the noise. Pushed now.
src/qemu/qemu_driver.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 06d8cb2471..9c0796b0a4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16243,7 +16243,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuDomainObjPrivatePtr priv;
int rc;
virDomainDefPtr config = NULL;
- virDomainDefPtr inactiveConfig = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
bool was_stopped = false;
@@ -16458,7 +16457,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
goto endjob;
}
if (config) {
- virDomainObjAssignDef(vm, config, false, &inactiveConfig);
+ virDomainObjAssignDef(vm, config, false, NULL);
virCPUDefFree(priv->origCPU);
VIR_STEAL_PTR(priv->origCPU, origCPU);
}
@@ -16467,7 +16466,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
load:
was_stopped = true;
if (config)
- virDomainObjAssignDef(vm, config, false, &inactiveConfig);
+ virDomainObjAssignDef(vm, config, false, NULL);
/* No cookie means libvirt which saved the domain was too old to
* mess up the CPU definitions.
@@ -16526,9 +16525,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
detail);
}
}
- if (inactiveConfig)
- VIR_STEAL_PTR(vm->newDef, inactiveConfig);
-
break;
case VIR_DOMAIN_SNAPSHOT_SHUTDOWN:
@@ -16556,11 +16552,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuProcessEndJob(driver, vm);
goto cleanup;
}
- if (config) {
- virDomainObjAssignDef(vm, config, false, &inactiveConfig);
- if (inactiveConfig)
- VIR_STEAL_PTR(vm->newDef, inactiveConfig);
- }
+ if (config)
+ virDomainObjAssignDef(vm, config, false, NULL);
if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
--
2.21.0
5 years, 7 months
[libvirt] [glib PATCH 00/16] Update libvirt-glib python examples
by Fabiano Fidêncio
This series contains a bunch of trivial fixes for our python examples,
including:
- Not using ";" at the end of the lines;
- Ensuring that the right version of the libraries are imported;
- Change the scripts so they're python3 compatible
- Update the sha-bang lines to use python3
Fabiano Fidêncio (16):
config-demo: Don't use ";" in the end of lines
config-demo: Ensure the right LibvirtGConfig version gets loaded
config-demo: Use print() in a py3 compatible way
config-demo: Use octal when setting mode
config-demo: Change she-bang line to use python3
conn-test: Don't use ";" in the end of lines
conn-test: Ensure the right versions of LibvirtGObject and Gtk get
loaded
conn-test: Use print() in a py3 compatible way
conn-test: Handle exceptions in a py3 compatible way
conn-test: Change sha-bang line to use python3
event-test: LibvirtGLib.init() takes (at maximum) 1 argment
event-test: Don't use ";" in the end of lines
event-test: Ensure the right versions of LibvirtGLib and Gtk get
loaded
event-test: Use print() in a py3 compatible way
event-test: Handle exceptions in a py3 compatible way
event-test: Change sha-bang line to use python3
examples/config-demo.py | 15 +++++++++------
examples/conn-test.py | 20 ++++++++++++--------
examples/event-test.py | 28 ++++++++++++++++------------
3 files changed, 37 insertions(+), 26 deletions(-)
--
2.21.0
5 years, 7 months
[libvirt] [PATCH v1] qemu: migration: Convert to virErrorRestore/virErrorPreserveLast
by Syed Humaid
Replaced usages of virSaveLastError and virSetError/virFreeError with
virErrorPreserveLast and virErrorRestore respectively.
Signed-off-by: Syed Humaid <syedhumaidbinharoon(a)gmail.com>
---
src/qemu/qemu_migration.c | 75 +++++++++++++--------------------------
1 file changed, 24 insertions(+), 51 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e3ad4e52a7..b1fe79aed9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -722,7 +722,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
if (rv != 0) {
if (rv < 0) {
if (!err)
- err = virSaveLastError();
+ virErrorPreserveLast(&err);
failed = true;
}
qemuBlockJobSyncEnd(vm, job, asyncJob);
@@ -747,7 +747,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
}
if (failed && !err)
- err = virSaveLastError();
+ virErrorPreserveLast(&err);
if (virDomainObjWait(vm) < 0)
goto cleanup;
@@ -769,10 +769,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
ret = failed ? -1 : 0;
cleanup:
- if (err) {
- virSetError(err);
- virFreeError(err);
- }
+ virErrorRestore(&err);
return ret;
}
@@ -3189,16 +3186,13 @@ static void qemuMigrationSrcIOFunc(void *arg)
return;
abrt:
- err = virSaveLastError();
+ virErrorPreserveLast(&err);
if (err && err->code == VIR_ERR_OK) {
virFreeError(err);
err = NULL;
}
virStreamAbort(data->st);
- if (err) {
- virSetError(err);
- virFreeError(err);
- }
+ virErrorRestore(&err);
error:
/* Let the source qemu know that the transfer cant continue anymore.
@@ -3685,15 +3679,12 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
if (events)
priv->signalIOError = false;
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
return ret;
error:
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
if (virDomainObjIsActive(vm)) {
if (cancel &&
@@ -3948,7 +3939,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domainMigratePrepare2 did not set uri"));
cancelled = true;
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
goto finish;
}
@@ -3971,7 +3962,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
/* Perform failed. Make sure Finish doesn't overwrite the error */
if (ret < 0)
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
/* If Perform returns < 0, then we need to cancel the VM
* startup on the destination
@@ -4004,10 +3995,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
virObjectUnref(st);
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
VIR_FREE(uri_out);
VIR_FREE(cookie);
@@ -4181,13 +4169,13 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
if (useParams &&
virTypedParamsReplaceString(¶ms, &nparams,
VIR_MIGRATE_PARAM_URI, uri_out) < 0) {
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
goto finish;
}
} else if (!uri && !(flags & VIR_MIGRATE_TUNNELLED)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domainMigratePrepare3 did not set uri"));
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
goto finish;
}
@@ -4220,7 +4208,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
/* Perform failed. Make sure Finish doesn't overwrite the error */
if (ret < 0) {
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
} else {
qemuMigrationJobSetPhase(driver, vm,
QEMU_MIGRATION_PHASE_PERFORM3_DONE);
@@ -4312,7 +4300,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
* one we need to preserve it in case confirm3 overwrites
*/
if (!orig_err)
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
/*
* If cancelled, then src VM will be restarted, else
@@ -4344,10 +4332,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
virObjectUnref(st);
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
VIR_FREE(uri_out);
VIR_FREE(cookiein);
VIR_FREE(cookieout);
@@ -4523,15 +4508,12 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
}
cleanup:
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
qemuDomainObjEnterRemote(vm);
virConnectUnregisterCloseCallback(dconn, qemuMigrationSrcConnectionClosed);
virObjectUnref(dconn);
ignore_value(qemuDomainObjExitRemote(vm, false));
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
virObjectUnref(cfg);
return ret;
}
@@ -4619,7 +4601,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
endjob:
if (ret < 0)
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
/* v2 proto has no confirm phase so we need to reset migration parameters
* here
@@ -4639,10 +4621,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
qemuDomainRemoveInactiveJob(driver, vm);
}
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
cleanup:
virObjectEventStateQueue(driver->domainEventState, event);
@@ -5052,7 +5031,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
/* Need to save the current error, in case shutting
* down the process overwrites it
*/
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
/*
* In v3 protocol, the source VM is still available to
@@ -5181,10 +5160,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
VIR_FREE(priv->origname);
virDomainObjEndAPI(&vm);
qemuMigrationCookieFree(mig);
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
virObjectUnref(cfg);
/* Set a special error if Finish is expected to return NULL as a result of
@@ -5289,7 +5265,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (rc < 0) {
if (rc == -2) {
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
virCommandAbort(cmd);
if (virDomainObjIsActive(vm) &&
qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
@@ -5308,7 +5284,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
cleanup:
if (ret < 0 && !orig_err)
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
/* Restore max migration bandwidth */
if (virDomainObjIsActive(vm) &&
@@ -5326,10 +5302,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
virCommandFree(cmd);
}
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
return ret;
}
--
2.20.1
5 years, 7 months
[libvirt] [PATCH v1] qemu: Convert to virErrorPreserveLast/virErrorRestore
by Syed Humaid
Replaced usage of virSaveLastError and virSetError/virFreeError with
virErrorPreserveLast and virErrorRestore respectively.
Signed-off-by: Syed Humaid <syedhumaidbinharoon(a)gmail.com>
---
src/qemu/qemu_cgroup.c | 7 ++-----
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 28 ++++++++--------------------
4 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ca76c4fdfa..c8d9ae4808 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -1123,10 +1123,7 @@ qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
if (period) {
virErrorPtr saved = virSaveLastError();
ignore_value(virCgroupSetCpuCfsPeriod(cgroup, old_period));
- if (saved) {
- virSetError(saved);
- virFreeError(saved);
- }
+ virErrorRestore(&saved);
}
return -1;
@@ -1334,7 +1331,7 @@ qemuCgroupEmulatorAllNodesRestore(qemuCgroupEmulatorAllNodesDataPtr data)
if (!data)
return;
- err = virSaveLastError();
+ virErrorPreserveLast(&err);
virCgroupSetCpusetMems(data->emulatorCgroup, data->emulatorMemMask);
virSetError(err);
virFreeError(err);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1425d97b1e..9772e4f9af 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9119,7 +9119,7 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver,
error:
/* free up any resources in the network driver
* but don't overwrite the original error */
- originalError = virSaveLastError();
+ virErrorPreserveLast(&originalError);
for (i = 0; last_good_net != -1 && i <= last_good_net; i++)
virDomainConfNWFilterTeardown(def->nets[i]);
virSetError(originalError);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 960aaff3c7..dff1d7b1a5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8042,7 +8042,7 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver,
/* We don't care about errors logging taint info, so
* preserve original error, and clear any error that
* is raised */
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
if (!(timestamp = virTimeStringNow()))
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f48d9256e4..51b16f5aa1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6844,7 +6844,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
* must manually kill it and ignore any error related to
* the process
*/
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
VIR_FORCE_CLOSE(intermediatefd);
VIR_FORCE_CLOSE(*fd);
}
@@ -6855,10 +6855,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
}
VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf));
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
}
VIR_FORCE_CLOSE(intermediatefd);
@@ -14398,7 +14395,7 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
agent = qemuDomainObjEnterAgent(vm);
if (!report)
- err = virSaveLastError();
+ virErrorPreserveLast(&err);
thawed = qemuAgentFSThaw(agent);
if (!report)
virSetError(err);
@@ -15308,7 +15305,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
error:
if (ret < 0) {
- orig_err = virSaveLastError();
+ virErrorPreserveLast(&orig_err);
for (i = 0; i < snapdef->ndisks; i++) {
if (!diskdata[i].src)
continue;
@@ -15351,10 +15348,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
virJSONValueFree(actions);
virObjectUnref(cfg);
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
return ret;
}
@@ -17773,7 +17767,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
if (ret < 0) {
- monitor_error = virSaveLastError();
+ virErrorPreserveLast(&monitor_error);
qemuDomainDiskChainElementRevoke(driver, vm, mirror);
goto endjob;
}
@@ -17795,10 +17789,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
VIR_WARN("%s", _("unable to remove just-created copy target"));
virStorageFileDeinit(mirror);
qemuDomainObjEndJob(driver, vm);
- if (monitor_error) {
- virSetError(monitor_error);
- virFreeError(monitor_error);
- }
+ virErrorRestore(&monitor_error);
qemuBlockJobStartupFinalize(job);
cleanup:
@@ -18196,10 +18187,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
if (top_parent && top_parent != disk->src)
qemuDomainDiskChainElementPrepare(driver, vm, top_parent, true, false);
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
+ virErrorRestore(&orig_err);
}
qemuBlockJobStartupFinalize(job);
qemuDomainObjEndJob(driver, vm);
--
2.20.1
5 years, 7 months
[libvirt] [PATCH] qemuProcessReconnect: ensure vm xml integrity when save status
by Wang King
From: Dingzhong Weng <wengdingzhong(a)huawei.com>
libvirtd starts qemuProcessReconnect threads when libvirtd is starting
and there are live vm on the host. but as qemuProcessReconnect threads
are simply side job done by libvirtd upon start and are only called
for existing vm. these threads are not managed like that of worker
threads and event pool.
once libvirtd receives SIGTERM signal or any similar command right after
it starts, these qemuProcessReconnect threads might still be running and
libvirtd goes to clean up and frees qemu_driver and its components. In
this short window, qemuProcessReconnect threads might have a NULL
qemu_driver->xmlopt.format, skip this function, and only partial vm
status can be saved to disk. As a result, vm may fail to recover with
missing information.
this patch increases qemu_driver->xmlopt ref count during the lifecycle
of qemuProcessReconnect so that libvirtd will not release this resource
until qemuProcessReconnect threads finish using it. thus make sure all
of vm status information can be formatted and thus maintain its integrity
in virDomainSaveStatus.
no vm is killed in this patch.
Signed-off-by: Dingzhong Weng <wengdingzhong(a)huawei.com>
---
src/qemu/qemu_process.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 90466771cd..36b9b5fd03 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8000,6 +8000,7 @@ qemuProcessReconnect(void *opaque)
struct qemuProcessReconnectData *data = opaque;
virQEMUDriverPtr driver = data->driver;
virDomainObjPtr obj = data->obj;
+ virDomainXMLOptionPtr xmlopt = NULL;
qemuDomainObjPrivatePtr priv;
qemuDomainJobObj oldjob;
int state;
@@ -8023,6 +8024,9 @@ qemuProcessReconnect(void *opaque)
cfg = virQEMUDriverGetConfig(driver);
priv = obj->privateData;
+ /* need xmlopt later to save status, do not free */
+ xmlopt = virObjectRef(driver->xmlopt);
+
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto error;
@@ -8218,7 +8222,7 @@ qemuProcessReconnect(void *opaque)
}
/* update domain state XML with possibly updated state in virDomainObj */
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0)
+ if (virDomainSaveStatus(xmlopt, cfg->stateDir, obj, driver->caps) < 0)
goto error;
/* Run an hook to allow admins to do some magic */
@@ -8253,6 +8257,7 @@ qemuProcessReconnect(void *opaque)
virDomainObjEndAPI(&obj);
virObjectUnref(cfg);
virObjectUnref(caps);
+ virObjectUnref(xmlopt);
virNWFilterUnlockFilterUpdates();
virIdentitySetCurrent(NULL);
return;
--
2.18.0.windows.1
5 years, 7 months
[libvirt] [PATCH v2] qemu: Add entry for balloon stats stat-htlb-pgalloc and stat-htlb-pgfail
by Han Han
Qemu added reporting of virtio balloon new statistics stat-htlb-pgalloc and
stat-htlb-pgfail since qemu-3.0 commit b7b12644297. The value of
stat-htlb-pgalloc represents the number of successful hugetlb page allocations
while stat-htlb-pgfail represents the number of failed ones. Add this
statistics reporting to libvirt.
To enable this feature for vm, guest kenel >= 4.17 is required because
the exporting hugetlb page allocation for virtio balloon is introduced
since 6c64fe7f.
Signed-off-by: Han Han <hhan(a)redhat.com>
---
include/libvirt/libvirt-domain.h | 14 +++++++++++++-
src/libvirt-domain.c | 5 ++++-
src/qemu/qemu_driver.c | 2 ++
src/qemu/qemu_monitor_json.c | 5 +++++
tools/virsh-domain-monitor.c | 4 ++++
tools/virsh.pod | 2 ++
6 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7d36820b5a..192d25c1db 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -636,11 +636,23 @@ typedef enum {
*/
VIR_DOMAIN_MEMORY_STAT_DISK_CACHES = 10,
+ /*
+ * The amount of successful hugetlb(Huge Page Tables) allocations via
+ * virtio balloon.
+ */
+ VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC = 11,
+
+ /*
+ * The amount of failed hugetlb(Huge Page Tables) allocations via
+ * virtio balloon.
+ */
+ VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL = 12,
+
/*
* The number of statistics supported by this version of the interface.
* To add new statistics, add them to the enum and increase this value.
*/
- VIR_DOMAIN_MEMORY_STAT_NR = 11,
+ VIR_DOMAIN_MEMORY_STAT_NR = 13,
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 80284a99f0..a95690e8a4 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -5734,7 +5734,10 @@ virDomainGetInterfaceParameters(virDomainPtr domain,
* VIR_DOMAIN_MEMORY_STAT_DISK_CACHES
* Memory that can be reclaimed without additional I/O, typically disk
* caches (in kb).
- *
+ * VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC
+ * The amount of successful hugetlb(Huge Page Tables) allocations
+ * VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL
+ * The amount of failed hugetlb(Huge Page Tables) allocations
* Returns: The number of stats provided or -1 in case of failure.
*/
int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f48d9256e4..2d849beac8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20245,6 +20245,8 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
STORE_MEM_RECORD(LAST_UPDATE, "last-update")
STORE_MEM_RECORD(USABLE, "usable")
STORE_MEM_RECORD(DISK_CACHES, "disk_caches")
+ STORE_MEM_RECORD(HUGETLB_PGALLOC, "hugetlb_pgalloc")
+ STORE_MEM_RECORD(HUGETLB_PGFAIL, "hugetlb_pgfail")
}
#undef STORE_MEM_RECORD
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 908967f46c..5e3df5e759 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2150,6 +2150,11 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1);
GET_BALLOON_STATS(statsdata, "stat-disk-caches",
VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024);
+ GET_BALLOON_STATS(statsdata, "stat-htlb-pgalloc",
+ VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, 1);
+ GET_BALLOON_STATS(statsdata, "stat-htlb-pgfail",
+ VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 1);
+
ret = got;
cleanup:
virJSONValueFree(cmd);
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index d87475f6f6..0092a9786e 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -376,6 +376,10 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "last_update %llu\n", stats[i].val);
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
vshPrint(ctl, "disk_caches %llu\n", stats[i].val);
+ if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC)
+ vshPrint(ctl, "hugetlb_pgalloc %llu\n", stats[i].val);
+ if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL)
+ vshPrint(ctl, "hugetlb_pgfail %llu\n", stats[i].val);
}
ret = true;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index afc1684db0..ef27c527d6 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -938,6 +938,8 @@ without causing host swapping (in KiB)
last-update - Timestamp of the last update of statistics (in seconds)
disk_caches - The amount of memory that can be reclaimed without
additional I/O, typically disk caches (in KiB)
+ hugetlb_pgalloc - The number of successful huge page table allocations
+ hugetlb_pgfail - The number of failed huge page table allocations
For QEMU/KVM with a memory balloon, setting the optional I<--period> to a
value larger than 0 in seconds will allow the balloon driver to return
--
2.20.1
5 years, 7 months
[libvirt] [glib PATCH 0/8] Add machinery forsetting firmware attribute to <os/>
by Fabiano Fidêncio
This series consists in two different things that, together, are needed
to set <os firmware="efi|bios"/> as part of libvirt domain's XML.
The first patch simply changes the XML adding the bit mentioned above.
All the other patches, on the other hand, add enough (and nothing more
than that) infra for consumers to check which are the supported
firmwares (the ones listed by virConnectGetDomainCapabilities()).
Fabiano Fidêncio (8):
gconfig: Add _domain_os_set_firmware()
gobject: Use the proper return type in
_connection_get_capabilities_finish()
gconfig: Add GVirConfigDomainCapabilities
gconfig: Add GVirConfigDomainCapabilitiesOs
gconfig: Add _domain_capabilities_get_os()
gconfig: Add _domain_capabilities_os_get_firmwares()
tests: Add basic test for domain capabilities
gobject: Wrap virConnectGetDomainCapabilities()
libvirt-gconfig/Makefile.am | 4 +
.../libvirt-gconfig-domain-capabilities-os.c | 115 ++++++++++++
.../libvirt-gconfig-domain-capabilities-os.h | 66 +++++++
.../libvirt-gconfig-domain-capabilities.c | 94 ++++++++++
.../libvirt-gconfig-domain-capabilities.h | 68 +++++++
libvirt-gconfig/libvirt-gconfig-domain-os.c | 17 ++
libvirt-gconfig/libvirt-gconfig-domain-os.h | 7 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 8 +
libvirt-gobject/libvirt-gobject-connection.c | 170 +++++++++++++++++-
libvirt-gobject/libvirt-gobject-connection.h | 22 +++
libvirt-gobject/libvirt-gobject.sym | 8 +
tests/test-gconfig.c | 34 ++++
tests/xml/gconfig-domain-capabilities-os.xml | 23 +++
tests/xml/gconfig-domain-os.xml | 2 +-
15 files changed, 638 insertions(+), 2 deletions(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities-os.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities-os.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities.h
create mode 100644 tests/xml/gconfig-domain-capabilities-os.xml
--
2.21.0
5 years, 7 months
[libvirt] [PATCH 0/7] x86: Multi-key Total Memory Encryption (Intel)
by Larkins Carvalho
This patch series provides support for launching an encrypted guest using
Intel's Multi-key Total Memory Encryption (MKTME) feature.
The purpose of this review is to get initial feedback and to get on par with
libvirt development process.
Considering we have not added tests, this is a preliminary patch
and based on the community feedback, we expect more updates to follow.
Total Memory Encryption (TME) provides the capability to encrypt the
entirety of the physical memory of a system. MKTME builds on TME and
adds support for multiple encryption keys.
High Level flow:
1. Management tool calls virConnectGetDomainCapabilities which calls virNodeGetMKTMEInfo.
This returns an XML document that includes the following:
<feature>
...
<mktme supported='yes'>
<keys_supported> </keys_supported>
</mktme>
</feature>
2. If MKTME is supported management tool requests to start a guest calling virCreateXML().
The xml would include:
<launchSecurity type='mktme'>
<id>m0</id>
<key_type>user</key_type>
<key>samplekey</key>
<encryption_algorithm>aes-xts-128</encryption_algorithm>
</launchSecurity>
3. Libvirt makes system call with the provided information to generate a key handle using linux keyring services.
Qemu uses the key handle to launch the workload.
4. Libvirt generate the QEMU cli arg to enable the MKTME feature, a typical
args looks like this:
# Qemu ...\
-machine pc,memory-encryption=m0 -object mktme-guest,id=m0,handle=${serial}
Intel MKTME spec: https://software.intel.com/sites/default/files/managed/a5/16/Multi-Key-To...
TODO:
Add tests for launch security of type mktme.
WIP: Qemu and KVM patch to support Intel MKTME are in the process of upstreaming.
The complete git tree is available at:
https://github.com/larkinscarvalho/libvirt/tree/intel-mktme-patch-series
Larkins Carvalho (7):
qemu: provide support to query the MKTME capability
conf: Add MKTME feature in domain capabilities
libvirt: add new public API to get MKTME Info
remote: implement the remote protocol for virNodeMKTMEInfo()
qemu: Add support to get the MKTME info
conf: introduce launchSecurity element type mktme in domain
qemu: add support to launch MKTME guest
docs/formatdomain.html.in | 64 +-
docs/formatdomaincaps.html.in | 20 +
docs/schemas/domaincaps.rng | 14 +
docs/schemas/domaincommon.rng | 87 +-
include/libvirt/libvirt-host.h | 18 +
src/conf/domain_capabilities.c | 30 +
src/conf/domain_capabilities.h | 12 +
src/conf/domain_conf.c | 112 +-
src/conf/domain_conf.h | 14 +
src/conf/virconftypes.h | 3 +
src/driver-hypervisor.h | 7 +
src/libvirt-host.c | 49 +
src/libvirt_private.syms | 4 +
src/libvirt_public.syms | 5 +
src/qemu/qemu_capabilities.c | 140 +-
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_capspriv.h | 4 +
src/qemu/qemu_command.c | 40 +
src/qemu/qemu_driver.c | 63 +
src/qemu/qemu_monitor.c | 10 +
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 61 +
src/qemu/qemu_monitor_json.h | 3 +
src/remote/remote_daemon_dispatch.c | 44 +
src/remote/remote_driver.c | 41 +-
src/remote/remote_protocol.x | 21 +-
src/remote_protocol-structs | 12 +
src/util/Makefile.inc.am | 2 +
src/util/virmktme.c | 127 ++
src/util/virmktme.h | 34 +
.../bhyve_basic.x86_64.xml | 1 +
.../bhyve_fbuf.x86_64.xml | 1 +
.../bhyve_uefi.x86_64.xml | 1 +
tests/domaincapsschemadata/empty.xml | 1 +
tests/domaincapsschemadata/libxl-xenfv.xml | 1 +
tests/domaincapsschemadata/libxl-xenpv.xml | 1 +
.../qemu_1.7.0.x86_64.xml | 1 +
.../qemu_2.12.0-virt.aarch64.xml | 1 +
.../qemu_2.12.0.ppc64.xml | 1 +
.../qemu_2.12.0.s390x.xml | 1 +
.../qemu_2.12.0.x86_64.xml | 1 +
.../qemu_2.6.0-virt.aarch64.xml | 1 +
.../qemu_2.6.0.aarch64.xml | 1 +
.../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 +
.../qemu_2.6.0.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 +
.../qemu_2.8.0-tcg.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 +
.../qemu_2.8.0.x86_64.xml | 1 +
.../qemu_2.9.0-q35.x86_64.xml | 1 +
.../qemu_2.9.0-tcg.x86_64.xml | 1 +
.../qemu_2.9.0.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_3.0.0.s390x.xml | 1 +
.../qemu_3.1.0.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_4.0.0.s390x.xml | 1 +
.../qemu_4.0.0.x86_64.xml | 1 +
.../qemu_5.3.0.x86_64.xml | 164 ++
tests/domaincapstest.c | 5 +
.../caps_5.3.0.x86_64.xml | 1377 +++++++++++++++++
59 files changed, 2579 insertions(+), 41 deletions(-)
create mode 100644 src/util/virmktme.c
create mode 100644 src/util/virmktme.h
create mode 100644 tests/domaincapsschemadata/qemu_5.3.0.x86_64.xml
create mode 100644 tests/qemucapabilitiesdata/caps_5.3.0.x86_64.xml
5 years, 7 months
[libvirt] [PATCH] rpm: remove dependancy from qemu to network/storage drivers
by Daniel P. Berrangé
The libvirt-daemon-driver-qemu RPM has historically had a hard
dependency on the libvirt-daemon-driver-network and
libvirt-daemon-driver-storage-core packages. This was because the QEMU
driver would directly call into APIs that were part of these drivers.
The dependency to the storage driver was eliminated in
commit 064fec69be4a4673e0df17b007bf781026c3b4b2
Author: Daniel P. Berrangé <berrange(a)redhat.com>
Date: Thu Jan 25 09:35:46 2018 +0000
storage: move storage file backend framework into util directory
The dependency to the network driver was eliminated in
commit 5b13570ab8b43ec3c590399ec5a7644d91082149
Author: Daniel P. Berrangé <berrange(a)redhat.com>
Date: Thu Jan 25 09:35:47 2018 +0000
conf: introduce callback registration for domain net device allocation
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Previously sent as patch of the the network refactor but it can in
fact be merged now as it doesn't depend on it directly.
libvirt.spec.in | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5c27a44fc5..b159c50d8f 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -720,9 +720,6 @@ parted and more.
Summary: QEMU driver plugin for the libvirtd daemon
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
-# There really is a hard cross-driver dependency here
-Requires: libvirt-daemon-driver-network = %{version}-%{release}
-Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
Requires: /usr/bin/qemu-img
# For image compression
Requires: gzip
--
2.21.0
5 years, 7 months