aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2022-12-07 09:35:39 +0100
committerGerd Hoffmann <kraxel@redhat.com>2022-12-07 09:35:39 +0100
commitf7b51680b96ed01f681eeec9e487347b31682de0 (patch)
tree90b386ad07ef4d465666e80a363bf1dc81f72b3d
parentd33191174efce46b7c4be190a93637dc314a5139 (diff)
downloadvconsole-f7b51680b96ed01f681eeec9e487347b31682de0.tar.gz
add nvram reset optionHEADmaster
-rw-r--r--domain.c7
-rw-r--r--main.ui9
-rw-r--r--vconsole.c18
-rw-r--r--vconsole.h2
4 files changed, 31 insertions, 5 deletions
diff --git a/domain.c b/domain.c
index 610d4fe..66ca9cc 100644
--- a/domain.c
+++ b/domain.c
@@ -249,7 +249,7 @@ static void domain_user_input(VteTerminal *vte, gchar *buf, guint len,
virStreamSend(dom->stream, buf, len);
return;
}
- domain_start(dom);
+ domain_start(dom, false);
}
static void domain_connect(struct vconsole_domain *dom, virDomainPtr d)
@@ -433,11 +433,14 @@ void domain_untabify(struct vconsole_domain *dom)
gtk_widget_show_all(dom->window);
}
-void domain_start(struct vconsole_domain *dom)
+void domain_start(struct vconsole_domain *dom, bool reset_nvram)
{
virDomainPtr d = virDomainLookupByUUIDString(dom->conn->ptr, dom->uuid);
uint32_t flags = 0;
+ if (reset_nvram)
+ flags |= VIR_DOMAIN_START_RESET_NVRAM;
+
domain_update_info(dom, d);
switch (dom->info.state) {
case VIR_DOMAIN_SHUTOFF:
diff --git a/main.ui b/main.ui
index f7178d5..f27662f 100644
--- a/main.ui
+++ b/main.ui
@@ -216,6 +216,15 @@
</child>
<child>
<object class="GtkImageMenuItem">
+ <property name="label" translatable="yes">Run with NVRAM reset</property>
+ <property name="can-focus">False</property>
+ <property name="action-name">main.GuestRunResetNvram</property>
+ <property name="use-underline">True</property>
+ <property name="use-stock">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem">
<property name="label" translatable="yes">_Pause</property>
<property name="can-focus">False</property>
<property name="action-name">main.GuestPause</property>
diff --git a/vconsole.c b/vconsole.c
index 70ccfa7..afb4856 100644
--- a/vconsole.c
+++ b/vconsole.c
@@ -505,7 +505,18 @@ static void menu_cb_vm_run(GSimpleAction *action,
struct vconsole_domain *dom = find_guest(win);
if (dom)
- domain_start(dom);
+ domain_start(dom, false);
+}
+
+static void menu_cb_vm_run_reset_nvram(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ struct vconsole_window *win = data;
+ struct vconsole_domain *dom = find_guest(win);
+
+ if (dom)
+ domain_start(dom, true);
}
static void menu_cb_vm_run_gfx(GSimpleAction *action,
@@ -517,7 +528,7 @@ static void menu_cb_vm_run_gfx(GSimpleAction *action,
if (dom) {
run_virt_viewer(dom, false);
- domain_start(dom);
+ domain_start(dom, false);
}
}
@@ -694,6 +705,9 @@ static const GActionEntry entries[] = {
.name = "GuestRun",
.activate = menu_cb_vm_run,
},{
+ .name = "GuestRunResetNvram",
+ .activate = menu_cb_vm_run_reset_nvram,
+ },{
.name = "GuestRunGfx",
.activate = menu_cb_vm_run_gfx,
},{
diff --git a/vconsole.h b/vconsole.h
index 31f8596..8d52446 100644
--- a/vconsole.h
+++ b/vconsole.h
@@ -126,7 +126,7 @@ struct vconsole_domain {
void domain_untabify(struct vconsole_domain *dom);
-void domain_start(struct vconsole_domain *dom);
+void domain_start(struct vconsole_domain *dom, bool reset_nvram);
void domain_pause(struct vconsole_domain *dom);
void domain_save(struct vconsole_domain *dom);
void domain_reboot(struct vconsole_domain *dom);