- remote: fix double free of migration params on error - qemu: avoid deadlock in qemuDomainObjStopWorker We are dropping the only reference here so that the event loop thread is going to be exited synchronously. In order to avoid deadlocks we need to unlock the VM so that any handler being called can finish execution and thus even loop thread be finished too. - virsh: add tmm main command word Add tmm command word into virsh tool to call get tmm memory info API. It makes virsh can use tmm main commmand to show tmm memory info on console. This command requires specific kernel and a kernel driver to make sure its regular function. If runnning environment missing the above reliance, this command will show error result on console. - libvirt: add get tmm memory info API and libvirtd RPC Add the get tmm memory info API into libvirt-host. Also should add the RPC calls into libvirtd for API calling. - libvirt: support the virtCCA feature Add cvm parameter into the type of LaunchSecurity which is a optional filed for libvirt xml. Its purpose is to pass the cvm parameter through to qemu. Also this patch support virsh edit to save cvm parameter into libvirt temporary xml. - qemu_driver: Add calc_mode for dirtyrate statistics - virsh: Add mode option to domdirtyrate-calc virsh api - qemu: Generate command line for dirty-ring-size - qemu: support dirty ring feature - conf: Turn virDomainDef.kvm_features into a struct - qemu_validate: Allow kvm hint-dedicated on non-passthrough VMs - virDomainFeaturesKVMDefParse: Remove tautological "if" - virDomainFeaturesKVMDefParse: Remove tautological "switch" - virxml: Add virXMLPropUInt - virxml: Add virXMLPropInt - virxml: Add virXMLPropTristateSwitch - virxml: Add virXMLPropTristateBool - virDomainFeaturesKVMDefParse: Remove ctxt - virDomainFeaturesDefParse: Factor out KVM parsing into separate function - internal.h: Introduce and use VIR_IS_POW2() - hotpatch: if hotpatch_path not in qemu.conf,the hotpatch doesn't antoload Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
135 lines
3.5 KiB
Diff
135 lines
3.5 KiB
Diff
From d9599ee42db6a62cac6ae89c8d246c4c47574d5f Mon Sep 17 00:00:00 2001
|
|
From: tujipei <tujipei@huawei.com>
|
|
Date: Wed, 12 Jun 2024 14:34:57 +0800
|
|
Subject: [PATCH] virsh: add tmm main command word Add tmm command word into
|
|
virsh tool to call get tmm memory info API. It makes virsh can use tmm main
|
|
commmand to show tmm memory info on console. This command requires specific
|
|
kernel and a kernel driver to make sure its regular function. If runnning
|
|
environment missing the above reliance, this command will show error result
|
|
on console.
|
|
|
|
Signed-off-by: tujipei <tujipei@huawei.com>
|
|
---
|
|
tools/virsh-host.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 99 insertions(+)
|
|
|
|
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
|
|
index 67d5466be2..4f54cafec7 100644
|
|
--- a/tools/virsh-host.c
|
|
+++ b/tools/virsh-host.c
|
|
@@ -1799,6 +1799,99 @@ cmdHypervisorCPUBaseline(vshControl *ctl,
|
|
return ret;
|
|
}
|
|
|
|
+/*
|
|
+ * "securememinfo" command
|
|
+ */
|
|
+
|
|
+static const vshCmdInfo info_tmm[] = {
|
|
+ {.name = "help",
|
|
+ .data = N_("Interaction with the tmm")
|
|
+ },
|
|
+ {.name = "desc",
|
|
+ .data = N_("Call the host kernel dev which is provided for virsh to use receiving tmm informations.")
|
|
+ },
|
|
+ {.name = NULL}
|
|
+};
|
|
+
|
|
+static const vshCmdOptDef opts_tmm[] = {
|
|
+ {.name = "dev",
|
|
+ .type = VSH_OT_DATA,
|
|
+ .flags = VSH_OFLAG_REQ,
|
|
+ .help = N_("Device name of host kernel dev")
|
|
+ },
|
|
+ {.name = "detail",
|
|
+ .type = VSH_OT_BOOL,
|
|
+ .help = N_("print detailed info if this option contained in cmd")
|
|
+ },
|
|
+ {.name = NULL}
|
|
+};
|
|
+
|
|
+static bool
|
|
+virshGetTmmMemoryInfo(vshControl *ctl,
|
|
+ const vshCmd *cmd)
|
|
+{
|
|
+ char *tmmMemoryInfo = NULL;
|
|
+ bool detail;
|
|
+ virshControlPtr priv = ctl->privData;
|
|
+
|
|
+ detail = vshCommandOptBool(cmd, "detail");
|
|
+ if (!(tmmMemoryInfo = virConnectGetTmmMemoryInfo(priv->conn, (unsigned int)detail))) {
|
|
+ vshError(ctl, _("Get tmm_memory_info failed"));
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ vshPrintExtra(ctl, _("%s"), tmmMemoryInfo);
|
|
+
|
|
+ VIR_FREE(tmmMemoryInfo);
|
|
+ return true;
|
|
+}
|
|
+
|
|
+typedef bool
|
|
+(*virshTmmFunc)(vshControl *ctl,
|
|
+ const vshCmd *cmd);
|
|
+
|
|
+struct _virshTmmFuncInfo {
|
|
+ const char *devName;
|
|
+ virshTmmFunc funcPtr;
|
|
+};
|
|
+
|
|
+typedef struct _virshTmmFuncInfo virshTmmFuncInfo;
|
|
+
|
|
+static virshTmmFuncInfo virshTmmFuncMap[] = {
|
|
+ {"tmm_memory_info", virshGetTmmMemoryInfo},
|
|
+};
|
|
+
|
|
+static bool
|
|
+virshTmmRunFunc(vshControl *ctl,
|
|
+ const char *devName,
|
|
+ const vshCmd *cmd)
|
|
+{
|
|
+ int funcIndex;
|
|
+
|
|
+ for (funcIndex = 0; funcIndex < sizeof(virshTmmFuncMap) / sizeof(virshTmmFuncInfo); funcIndex++) {
|
|
+ if (strcmp(devName, virshTmmFuncMap[funcIndex].devName) == 0) {
|
|
+ virshTmmFuncMap[funcIndex].funcPtr(ctl, cmd);
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ vshError(ctl, _("Invalid dev name"));
|
|
+ return false;
|
|
+}
|
|
+
|
|
+static bool
|
|
+cmdTmm(vshControl *ctl, const vshCmd *cmd)
|
|
+{
|
|
+ const char *devName = NULL;
|
|
+
|
|
+ if (vshCommandOptStringReq(ctl, cmd, "dev", &devName) < 0)
|
|
+ return false;
|
|
+
|
|
+ if (!virshTmmRunFunc(ctl, devName, cmd))
|
|
+ return false;
|
|
+
|
|
+ return true;
|
|
+}
|
|
|
|
const vshCmdDef hostAndHypervisorCmds[] = {
|
|
{.name = "allocpages",
|
|
@@ -1927,5 +2020,11 @@ const vshCmdDef hostAndHypervisorCmds[] = {
|
|
.info = info_version,
|
|
.flags = 0
|
|
},
|
|
+ {.name = "tmm",
|
|
+ .handler = cmdTmm,
|
|
+ .opts = opts_tmm,
|
|
+ .info = info_tmm,
|
|
+ .flags = 0
|
|
+ },
|
|
{.name = NULL}
|
|
};
|
|
--
|
|
2.27.0
|
|
|