Sorry, forgot about that. ;)
From 2a536e4b4f5e0bbc493728256eeb006d00a91736 Mon Sep 17 00:00:00 2001
From: ARos <thestrider(a)gmail.com>
Date: Mon, 23 Mar 2009 22:37:31 +0000
Subject: [PATCH] VM AutoBoot
---
koan/app.py | 38 +++++++++++++++++++++++++-------------
koan/utils.py | 13 +++++++++++++
2 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/koan/app.py b/koan/app.py
index cf49737..b74ca39 100755
--- a/koan/app.py
+++ b/koan/app.py
@@ -59,7 +59,7 @@ DISPLAY_PARAMS = [
"install_tree","kernel","initrd",
"kernel_options",
"repos",
- "virt_ram","virt_disk","virt_type",
"virt_path"
+ "virt_ram","virt_disk","virt_type",
"virt_path", "virt_auto_boot"
]
@@ -138,6 +138,10 @@ def main():
action="store_true",
dest="no_gfx",
help="disable Xen graphics (xenpv,xenfv)")
+ p.add_option("", "--auto-boot",
+ action="store_true",
+ dest="virt_auto_boot",
+ help="set VM for autoboot")
p.add_option("", "--add-reinstall-entry",
dest="add_reinstall_entry",
action="store_true",
@@ -180,6 +184,7 @@ def main():
k.use_kexec = options.use_kexec
k.should_poll = options.should_poll
k.embed_kickstart = options.embed_kickstart
+ k.virt_auto_boot = options.virt_auto_boot
if options.virt_name is not None:
k.virt_name = options.virt_name
@@ -1025,20 +1030,22 @@ class Koan:
path_list = self.calc_virt_path(pd, virtname)
size_list = self.calc_virt_filesize(pd)
disks = self.merge_disk_data(path_list,size_list)
+ virt_auto_boot = self.virt_auto_boot
results = create_func(
- name = virtname,
- ram = ram,
- disks = disks,
- uuid = uuid,
- extra = kextra,
- vcpus = vcpus,
- profile_data = profile_data,
- arch = arch,
- no_gfx = self.no_gfx,
- fullvirt = fullvirt,
- bridge = self.virt_bridge,
- virt_type = self.virt_type
+ name = virtname,
+ ram = ram,
+ disks = disks,
+ uuid = uuid,
+ extra = kextra,
+ vcpus = vcpus,
+ profile_data = profile_data,
+ arch = arch,
+ no_gfx = self.no_gfx,
+ fullvirt = fullvirt,
+ bridge = self.virt_bridge,
+ virt_type = self.virt_type,
+ virt_auto_boot = self.virt_auto_boot
)
print results
@@ -1071,6 +1078,11 @@ class Koan:
else:
raise InfoException("internal error, bad virt state")
+ if self.virt_auto_boot:
+ if self.virt_type in [ "xenpv", "xenfv" ]:
+ utils.create_xendomains_symlink(virtname)
+ # else qemu
+ # else...
return results
#---------------------------------------------------
diff --git a/koan/utils.py b/koan/utils.py
index 77e51fd..50b263a 100644
--- a/koan/utils.py
+++ b/koan/utils.py
@@ -377,6 +377,19 @@ def connect_to_server(server=None,port=None):
return server
raise InfoException ("Could not find Cobbler.")
+def create_xendomains_symlink(name):
+ """
+ Create an /etc/xen/auto/<name> symlink for use with
"xendomains"-style
+ VM boot upon dom0 reboot.
+ """
+ src = "/etc/xen/%s" % name
+ dst = "/etc/xen/auto/%s" % name
+
+ # check that xen config file exists and create symlink
+ if os.path.exists(src) and os.access(os.path.dirname(dst), os.W_OK):
+ os.symlink(src, dst)
+ else:
+ raise InfoException("Could not create /etc/xen/auto/%s
symlink. Please check write permissions and ownership" % name)
class ServerProxy(xmlrpclib.ServerProxy):
--
1.5.5.1
Michael DeHaan wrote:
Adam Rosenwald wrote:
> Reposting with `git-format-patch` output (i.e. `git-format-patch -1`)...
> FYI, Adam.
>
> From ee8f57a87faa17daa4772befcd1fd26bf3b5a753 Mon Sep 17 00:00:00 2001
> From: ARos <thestrider@gmailcom>
> Date: Mon, 23 Mar 2009 21:52:31 +0000
> Subject: [PATCH] VM AutoBoot feature
>
> ---
> cobbler/collection.py | 1 +
> cobbler/item_image.py | 9 +++++++++
> cobbler/item_profile.py | 9 +++++++++
> cobbler/item_system.py | 9 +++++++++
> cobbler/remote.py | 2 ++
> cobbler/settings.py | 1 +
> cobbler/utils.py | 22 ++++++++++++++++++++++
> contrib/ruby/lib/cobbler/image.rb | 2 +-
> contrib/ruby/lib/cobbler/profile.rb | 1 +
> contrib/ruby/lib/cobbler/system.rb | 1 +
> contrib/ruby/test/test_image.rb | 2 ++
> contrib/ruby/test/test_profile.rb | 2 ++
> contrib/ruby/test/test_system.rb | 2 ++
> installer_templates/settings.template | 5 +++++
> webui_templates/image_edit.tmpl | 15 +++++++++++++++
> webui_templates/profile_edit.tmpl | 13 +++++++++++++
> webui_templates/search.tmpl | 3 +++
> webui_templates/system_edit.tmpl | 12 ++++++++++++
> 18 files changed, 110 insertions(+), 1 deletions(-)
>
Excellent, thanks... is there a koan patch series to go with this one so
the command will function?
I know you did the symlink thing before. If it only does the symlink
that's a start, and we can look at how to do it for qemu/KVM afterwards.
(Getting a bit late, so I will most likely will be applying patches
tomorrow, then I expect to be caught up with everyone's patches)
--Michael
_______________________________________________
cobbler-devel mailing list
cobbler-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler-devel