virsh: Introduce domdisplay-reload command

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>
This commit is contained in:
Zheng Yan 2021-05-11 22:05:21 +08:00 committed by Ján Tomko
parent a74897efe6
commit c9caf53d9b
2 changed files with 60 additions and 0 deletions

View 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
-----------

View 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}
};