[gnome-boxes] Reboot should destroy (shutdown) VM on first boot
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Reboot should destroy (shutdown) VM on first boot
- Date: Wed, 7 Dec 2011 13:09:40 +0000 (UTC)
commit b05bc13eb15115eb6d16ceb5c083b04a3ac4f515
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Nov 30 22:37:56 2011 +0200
Reboot should destroy (shutdown) VM on first boot
We manually start the domain after the shutdown but we need to have this
shutdown in between for our post-install setup to be able to kick-in.
https://bugzilla.gnome.org/show_bug.cgi?id=665254
src/vm-creator.vala | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 03098a9..34cdef6 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -8,10 +8,12 @@ private class Boxes.VMCreator {
private static Regex direct_boot_regex;
private static Regex cdrom_boot_regex;
+ private static Regex on_reboot_regex;
static construct {
direct_boot_regex = /<kernel>.*<\/cmdline>/msx;
cdrom_boot_regex = /<boot.*dev=.cdrom.\/>/msx;
+ on_reboot_regex = /<on_reboot>destroy/msx;
}
public VMCreator (App app, string uri) throws GLib.Error {
@@ -62,9 +64,10 @@ private class Boxes.VMCreator {
private void post_install_setup (Domain domain, GVirConfig.Domain config, bool permanent) {
try {
var new_config = create_post_install_config (config);
- if (permanent)
+ if (permanent) {
domain.set_config (new_config);
- else {
+ domain.start (0);
+ } else {
var new_domain = connection.create_domain (new_config);
new_domain.start (0);
}
@@ -90,6 +93,7 @@ private class Boxes.VMCreator {
var xml = config.to_xml ();
xml = direct_boot_regex.replace (xml, -1, 0, "");
xml = cdrom_boot_regex.replace (xml, -1, 0, "");
+ xml = on_reboot_regex.replace (xml, -1, 0, "<on_reboot>restart");
return new GVirConfig.Domain.from_xml (xml);
}
@@ -126,7 +130,7 @@ private class Boxes.VMCreator {
" </features>\n" +
" <clock offset='" + clock_offset + "'/>\n" +
" <on_poweroff>destroy</on_poweroff>\n" +
- " <on_reboot>restart</on_reboot>\n" +
+ " <on_reboot>destroy</on_reboot>\n" +
" <on_crash>destroy</on_crash>\n" +
" <devices>\n" +
get_target_media_xml (target_path) +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]