diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-14 15:16:27 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-14 15:16:27 +0200 |
commit | 418c62b58e7e7cea94bd92ab773daffa0b2f0512 (patch) | |
tree | 886d68830446ff428dfdecb56c1d48ad7ffe838b | |
parent | dd5b27b164ffd16756218795b4f6c1892ad795d2 (diff) | |
download | vconsole-418c62b58e7e7cea94bd92ab773daffa0b2f0512.tar.gz |
reset button
-rw-r--r-- | domain.c | 15 | ||||
-rw-r--r-- | vconsole.c | 17 | ||||
-rw-r--r-- | vconsole.h | 1 |
3 files changed, 32 insertions, 1 deletions
@@ -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); @@ -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" @@ -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); |