summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-17 22:52:26 -0400
committerMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-17 22:52:26 -0400
commit706f05deb34103db710d19c718dd7946cf0ab367 (patch)
treefeca536dec3a173c979853ee37ff7ce58bfa2fc4 /func
parent23b97b41b443457f875d504087571f8a01524540 (diff)
downloadtools-706f05deb34103db710d19c718dd7946cf0ab367.tar.gz
tools-706f05deb34103db710d19c718dd7946cf0ab367.tar.xz
tools-706f05deb34103db710d19c718dd7946cf0ab367.zip
Adding the func patches used to build a custom version of func
until those patches are accepted upstream
Diffstat (limited to 'func')
-rw-r--r--func/README11
-rw-r--r--func/patches/0001-Enhancements-to-the-koan-installation-in-the-virt-mo.patch59
-rw-r--r--func/patches/0002-Adding-freemem-functionality.patch43
-rw-r--r--func/patches/0003-Closing-file-descriptors-during-the-virt-install-to.patch25
4 files changed, 138 insertions, 0 deletions
diff --git a/func/README b/func/README
new file mode 100644
index 0000000..f466ed4
--- /dev/null
+++ b/func/README
@@ -0,0 +1,11 @@
+Right now, this will serve as a placeholder for how to
+patch and compile our own version of func until our
+changes are available upstream. Follow these
+instructions to patch and build func:
+
+git clone git://git.fedorahosted.org/func.git
+cd func
+git reset --hard v0.18
+git-am ../patches/*.patch
+echo "0.19 1" > version
+make clean all
diff --git a/func/patches/0001-Enhancements-to-the-koan-installation-in-the-virt-mo.patch b/func/patches/0001-Enhancements-to-the-koan-installation-in-the-virt-mo.patch
new file mode 100644
index 0000000..331aa47
--- /dev/null
+++ b/func/patches/0001-Enhancements-to-the-koan-installation-in-the-virt-mo.patch
@@ -0,0 +1,59 @@
+From 22db3c137ab4a641273c49723e52232232f1e6fe Mon Sep 17 00:00:00 2001
+From: Matthew Hicks <mhicks@mhicks-host.usersys.redhat.com>
+Date: Tue, 17 Jun 2008 13:23:51 -0400
+Subject: [PATCH] Enhancements to the koan installation in the virt module
+
+- Adding support for virt-name and virt-path for the install command
+- Removing --virt-graphics from the koan options as it's no longer supported
+-- Koan enables graphical installations by default and the option isn't
+ supported in the current release
+---
+ func/minion/modules/virt.py | 11 ++++++++---
+ 1 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
+index 0828484..92107fe 100644
+--- a/func/minion/modules/virt.py
++++ b/func/minion/modules/virt.py
+@@ -184,7 +184,7 @@ class Virt(func_module.FuncModule):
+ pass
+ return results
+
+- def install(self, server_name, target_name, system=False):
++ def install(self, server_name, target_name, system=False, virt_name=None, virt_path=None):
+
+ """
+ Install a new virt system by way of a named cobbler profile.
+@@ -192,6 +192,7 @@ class Virt(func_module.FuncModule):
+
+ # Example:
+ # install("bootserver.example.org", "fc7webserver", True)
++ # install("bootserver.example.org", "client.example.org", True, "client-disk0", "HostVolGroup00")
+
+ conn = self.__get_conn()
+
+@@ -204,15 +205,19 @@ class Virt(func_module.FuncModule):
+ if system:
+ target = "system"
+
+- # TODO: FUTURE: set --virt-path in cobbler or here
+ koan_args = [
+ "/usr/bin/koan",
+ "--virt",
+- "--virt-graphics", # enable VNC
+ "--%s=%s" % (target, target_name),
+ "--server=%s" % server_name
+ ]
+
++ if virt_name:
++ koan_args.append("--virt-name=%s" % virt_name)
++
++ if virt_path:
++ koan_args.append("--virt-path=%s" % virt_path)
++
+ rc = sub_process.call(koan_args,shell=False)
+ if rc == 0:
+ return 0
+--
+1.5.3.6
+
diff --git a/func/patches/0002-Adding-freemem-functionality.patch b/func/patches/0002-Adding-freemem-functionality.patch
new file mode 100644
index 0000000..15938d2
--- /dev/null
+++ b/func/patches/0002-Adding-freemem-functionality.patch
@@ -0,0 +1,43 @@
+From 4cec34948da30acfb6d0724019f12db596807ce2 Mon Sep 17 00:00:00 2001
+From: Matthew Hicks <mhicks@mhicks-host.usersys.redhat.com>
+Date: Tue, 17 Jun 2008 19:56:18 -0400
+Subject: [PATCH] Adding freemem functionality
+ - Calculates the amount of memory available to virtual
+ machines assuming Domain-0 can be reduced to 256M
+
+---
+ func/minion/modules/virt.py | 18 ++++++++++++++++++
+ 1 files changed, 18 insertions(+), 0 deletions(-)
+
+diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
+index 92107fe..40ae274 100644
+--- a/func/minion/modules/virt.py
++++ b/func/minion/modules/virt.py
+@@ -184,6 +184,24 @@ class Virt(func_module.FuncModule):
+ pass
+ return results
+
++ def freemem(self):
++ self.conn = self.__get_conn()
++ # Start with the physical memory and subtract
++ memory = self.conn.nodeinfo()[1]
++
++ # Take 256M off which is reserved for Domain-0
++ memory = memory - 256
++
++ vms = self.conn.find_vm(-1)
++ for vm in vms:
++ # Exclude stopped vms and Domain-0 by using
++ # ids greater than 0
++ if vm.ID() > 0:
++ # This node is active - remove its memory (in bytes)
++ memory = memory - int(vm.info()[2])/1024
++
++ return memory
++
+ def install(self, server_name, target_name, system=False, virt_name=None, virt_path=None):
+
+ """
+--
+1.5.3.6
+
diff --git a/func/patches/0003-Closing-file-descriptors-during-the-virt-install-to.patch b/func/patches/0003-Closing-file-descriptors-during-the-virt-install-to.patch
new file mode 100644
index 0000000..28b631d
--- /dev/null
+++ b/func/patches/0003-Closing-file-descriptors-during-the-virt-install-to.patch
@@ -0,0 +1,25 @@
+From d204ee82600d04cc4dc76afb81712210fa0c1dfe Mon Sep 17 00:00:00 2001
+From: Matthew Hicks <mhicks@mhicks-host.usersys.redhat.com>
+Date: Tue, 17 Jun 2008 22:35:14 -0400
+Subject: [PATCH] Closing file descriptors during the virt install to avoid leaking them
+
+---
+ func/minion/modules/virt.py | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
+index 40ae274..c4b718a 100644
+--- a/func/minion/modules/virt.py
++++ b/func/minion/modules/virt.py
+@@ -236,7 +236,7 @@ class Virt(func_module.FuncModule):
+ if virt_path:
+ koan_args.append("--virt-path=%s" % virt_path)
+
+- rc = sub_process.call(koan_args,shell=False)
++ rc = sub_process.call(koan_args,shell=False,close_fds=True)
+ if rc == 0:
+ return 0
+ else:
+--
+1.5.3.6
+