[libvirt PATCH 5/5] virsh: Introduce domdisplay-reload command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zheng Yan <yanzheng759@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 docs/manpages/virsh.rst | 15 ++++++++++++++
 tools/virsh-domain.c    | 45 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 8224aec8c3..115b802c45 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -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
 -----------
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e69d14a6aa..d3e28f38f4 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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}
 };
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux