]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Introduce domdisplay-reload command
authorZheng Yan <yanzheng759@huawei.com>
Tue, 11 May 2021 14:05:21 +0000 (22:05 +0800)
committerJán Tomko <jtomko@redhat.com>
Fri, 8 Mar 2024 16:00:15 +0000 (17:00 +0100)
Introduce the domdisplay-reload command to make the domain reload
its graphics certificates
   #virsh domdisplay-reload <domain> --type <type>

Signed-off-by: Zheng Yan <yanzheng759@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/manpages/virsh.rst
tools/virsh-domain.c

index 8224aec8c36901dc2b3f83a82cbd1560f3653e24..115b802c45daf1483e06aba77a90a12f6ec484a0 100644 (file)
@@ -1783,6 +1783,21 @@ included in the URI. If *--all* is specified, then all show all possible
 graphical displays, for a VM could have more than one graphical displays.
 
 
+domdisplay-reload
+-----------------
+
+**Syntax:**
+
+::
+
+    domdisplay-reload <domain> [[--type] <type>]
+
+Reload the domain's graphical display. This reloads its TLS certificates
+without restarting the domain. ``type`` can be any constant from the
+`virDomainGraphicsReloadType` enum. By default any supported type is reloaded
+(so far only VNC).
+
+
 domfsfreeze
 -----------
 
index e69d14a6aaa0e1a5a2d6549bbcff469fa0c4c21d..d3e28f38f413d867812fa6dc348a8e0634897024 100644 (file)
@@ -13801,6 +13801,45 @@ cmdDomDirtyRateCalc(vshControl *ctl, const vshCmd *cmd)
     return true;
 }
 
+/**
+ * "domdisplay-reload" command
+ */
+static const vshCmdInfo info_domdisplay_reload[] = {
+    {.name = "help",
+     .data = N_("Reload domain's graphics display certificates")
+    },
+    {.name = "desc",
+     .data = N_("Reload domain's graphics display certificates")
+    },
+    {.name = NULL}
+};
+
+static const vshCmdOptDef opts_domdisplay_reload[] = {
+    VIRSH_COMMON_OPT_DOMAIN_FULL(0),
+    {.name = "type",
+     .type = VSH_OT_INT,
+     .help = N_("graphics display type")
+    },
+    {.name = NULL}
+};
+
+static bool
+cmdDomdisplayReload(vshControl *ctl, const vshCmd *cmd)
+{
+    g_autoptr(virshDomain) dom = NULL;
+    unsigned int type = 0;
+
+    if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
+        return false;
+
+    if (vshCommandOptUInt(ctl, cmd, "type", &type) < 0)
+        return false;
+
+    if (virDomainGraphicsReload(dom, type, 0) < 0)
+        return false;
+
+    return true;
+}
 
 const vshCmdDef domManagementCmds[] = {
     {.name = "attach-device",
@@ -14465,5 +14504,11 @@ const vshCmdDef domManagementCmds[] = {
      .info = info_dom_fd_associate,
      .flags = 0
     },
+    {.name = "domdisplay-reload",
+     .handler = cmdDomdisplayReload,
+     .opts = opts_domdisplay_reload,
+     .info = info_domdisplay_reload,
+     .flags = 0
+    },
     {.name = NULL}
 };