aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-09-14 15:16:27 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-09-14 15:16:27 +0200
commit418c62b58e7e7cea94bd92ab773daffa0b2f0512 (patch)
tree886d68830446ff428dfdecb56c1d48ad7ffe838b
parentdd5b27b164ffd16756218795b4f6c1892ad795d2 (diff)
downloadvconsole-418c62b58e7e7cea94bd92ab773daffa0b2f0512.tar.gz
reset button
-rw-r--r--domain.c15
-rw-r--r--vconsole.c17
-rw-r--r--vconsole.h1
3 files changed, 32 insertions, 1 deletions
diff --git a/domain.c b/domain.c
index 002bb64..74b9879 100644
--- a/domain.c
+++ b/domain.c
@@ -413,6 +413,21 @@ void domain_shutdown(struct vconsole_domain *dom)
}
}
+void domain_reset(struct vconsole_domain *dom)
+{
+ virDomainPtr d = virDomainLookupByUUIDString(dom->conn->ptr, dom->uuid);
+
+ domain_update_info(dom, d);
+ switch (dom->info.state) {
+ case VIR_DOMAIN_RUNNING:
+ virDomainReset(d, 0);
+ break;
+ default:
+ fprintf(stderr, "%s: invalid guest state: %s\n",
+ __func__, domain_state_name(dom));
+ }
+}
+
void domain_kill(struct vconsole_domain *dom)
{
virDomainPtr d = virDomainLookupByUUIDString(dom->conn->ptr, dom->uuid);
diff --git a/vconsole.c b/vconsole.c
index 64175eb..2ed42e5 100644
--- a/vconsole.c
+++ b/vconsole.c
@@ -298,6 +298,15 @@ static void menu_cb_vm_shutdown(GtkAction *action, void *data)
domain_shutdown(dom);
}
+static void menu_cb_vm_reset(GtkAction *action, void *data)
+{
+ struct vconsole_window *win = data;
+ struct vconsole_domain *dom = find_guest(win);
+
+ if (dom)
+ domain_reset(dom);
+}
+
static void menu_cb_vm_kill(GtkAction *action, void *data)
{
struct vconsole_window *win = data;
@@ -449,9 +458,14 @@ static const GtkActionEntry entries[] = {
.tooltip = "Shutdown guest",
.callback = G_CALLBACK(menu_cb_vm_shutdown),
},{
+ .name = "GuestReset",
+ .label = "Reset",
+ .tooltip = "Reset guest",
+ .callback = G_CALLBACK(menu_cb_vm_reset),
+ },{
.name = "GuestKill",
.label = "Destroy",
- .tooltip = "Destroy guest",
+ .tooltip = "Destriy guest",
.callback = G_CALLBACK(menu_cb_vm_kill),
},{
@@ -516,6 +530,7 @@ static char ui_xml[] =
" <menuitem action='GuestReboot'/>\n"
" <menuitem action='GuestShutdown'/>\n"
" <separator/>\n"
+" <menuitem action='GuestReset'/>\n"
" <menuitem action='GuestKill'/>\n"
" </menu>\n"
" <menu action='HelpMenu'>\n"
diff --git a/vconsole.h b/vconsole.h
index 06fc4c8..d676b39 100644
--- a/vconsole.h
+++ b/vconsole.h
@@ -106,6 +106,7 @@ void domain_pause(struct vconsole_domain *dom);
void domain_save(struct vconsole_domain *dom);
void domain_reboot(struct vconsole_domain *dom);
void domain_shutdown(struct vconsole_domain *dom);
+void domain_reset(struct vconsole_domain *dom);
void domain_kill(struct vconsole_domain *dom);
void domain_free(struct vconsole_domain *dom);