::
- console domain [devname] [--safe] [--force]
+ console domain [devname] [--safe] [--force] [--resume]
Connect the virtual serial console for the guest. The optional
*devname* parameter refers to the device alias of an alternate
the *--force* flag may be specified, requesting to disconnect any existing
sessions, such as in a case of a broken connection.
+If the flag *--resume* is specified then the guest is resumed after connecting
+to the console.
+
cpu-stats
---------
virshRunConsole(vshControl *ctl,
virDomainPtr dom,
const char *dev_name,
+ const bool resume_domain,
unsigned int flags)
{
virConsole *con = NULL;
goto cleanup;
}
+ if (resume_domain) {
+ if (virDomainResume(dom) != 0) {
+ vshError(ctl, _("Failed to resume domain '%1$s'"),
+ virDomainGetName(dom));
+ goto cleanup;
+ }
+ }
+
while (!con->quit) {
if (virCondWait(&con->cond, &con->parent.lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
.type = VSH_OT_BOOL,
.help = N_("force console connection (disconnect already connected sessions)")
},
+ {.name = "resume",
+ .type = VSH_OT_BOOL,
+ .help = N_("resume a paused guest after connecting to console")
+ },
{.name = "safe",
.type = VSH_OT_BOOL,
.help = N_("only connect if safe console handling is supported")
static bool
cmdRunConsole(vshControl *ctl, virDomainPtr dom,
const char *name,
+ const bool resume_domain,
unsigned int flags)
{
int state;
vshPrintExtra(ctl, " (Ctrl + %c)", priv->escapeChar[1]);
vshPrintExtra(ctl, "\n");
fflush(stdout);
- if (virshRunConsole(ctl, dom, name, flags) == 0)
+ if (virshRunConsole(ctl, dom, name, resume_domain, flags) == 0)
return true;
return false;
{
g_autoptr(virshDomain) dom = NULL;
bool force = vshCommandOptBool(cmd, "force");
+ bool resume = vshCommandOptBool(cmd, "resume");
bool safe = vshCommandOptBool(cmd, "safe");
unsigned int flags = 0;
const char *name = NULL;
if (safe)
flags |= VIR_DOMAIN_CONSOLE_SAFE;
- return cmdRunConsole(ctl, dom, name, flags);
+ return cmdRunConsole(ctl, dom, name, resume, flags);
}
#endif /* WIN32 */
vshPrintExtra(ctl, _("Domain '%1$s' started\n"),
virDomainGetName(dom));
#ifndef WIN32
- if (console && !cmdRunConsole(ctl, dom, NULL, 0))
+ if (console && !cmdRunConsole(ctl, dom, NULL, false, 0))
return false;
#endif
virDomainGetName(dom), from);
#ifndef WIN32
if (console)
- cmdRunConsole(ctl, dom, NULL, 0);
+ cmdRunConsole(ctl, dom, NULL, false, 0);
#endif
return true;
}