summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-18 10:00:16 -0400
committerMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-18 10:00:16 -0400
commit5f299e05bdeac6dc086065b9c5ff68d7c25eec16 (patch)
tree461f3ce84cb651e46eac196d6cce40ff1d0065c1 /func
parent14dd22a0644bf4ea4a7f5f2e6f5b08fe793eb943 (diff)
Moving all the func changes to a public repo and changing the
README to reference that until those changes are upstream
Diffstat (limited to 'func')
-rw-r--r--func/.gitignore1
-rw-r--r--func/README4
-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-Adding-a-find_resources-script-to-look-across-minion.patch157
-rw-r--r--func/patches/0004-Closing-file-descriptors-during-the-virt-install-to.patch25
6 files changed, 2 insertions, 287 deletions
diff --git a/func/.gitignore b/func/.gitignore
new file mode 100644
index 0000000..51e1cb0
--- /dev/null
+++ b/func/.gitignore
@@ -0,0 +1 @@
+func/*
diff --git a/func/README b/func/README
index f466ed4..2809c90 100644
--- a/func/README
+++ b/func/README
@@ -3,9 +3,7 @@ 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
+git clone git://github.com/matthicksj/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
deleted file mode 100644
index 331aa47..0000000
--- a/func/patches/0001-Enhancements-to-the-koan-installation-in-the-virt-mo.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-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
deleted file mode 100644
index 15938d2..0000000
--- a/func/patches/0002-Adding-freemem-functionality.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-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-Adding-a-find_resources-script-to-look-across-minion.patch b/func/patches/0003-Adding-a-find_resources-script-to-look-across-minion.patch
deleted file mode 100644
index 586c8c5..0000000
--- a/func/patches/0003-Adding-a-find_resources-script-to-look-across-minion.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From d5e3864f6965af63b3a735debc0fe0097b3b9b4d Mon Sep 17 00:00:00 2001
-From: Matthew Hicks <mhicks@mhicks-host.usersys.redhat.com>
-Date: Tue, 17 Jun 2008 16:23:22 -0400
-Subject: [PATCH] Adding a find_resources script to look across minions
- for enough RAM and disk space to run a 'virt install' (koan)
-
-- Requires the storage.py module for LVM functionality
-- Requires the freemem functionality enhancement to the virt.py module
-- Only allows Domain-0 shrink to 512M to keep it stable
--- Technically, Domain-0 can be shrunk to 256M which is in
- accordance with how the freemem module reports available memory
----
- func/overlord/find_resources.py | 113 +++++++++++++++++++++++++++++++++++++++
- scripts/find-resources | 11 ++++
- 2 files changed, 124 insertions(+), 0 deletions(-)
- create mode 100755 func/overlord/find_resources.py
- create mode 100755 scripts/find-resources
-
-diff --git a/func/overlord/find_resources.py b/func/overlord/find_resources.py
-new file mode 100755
-index 0000000..c4e30bd
---- /dev/null
-+++ b/func/overlord/find_resources.py
-@@ -0,0 +1,113 @@
-+##
-+## Func cloud availability application.
-+## Given machine requirements, returns the best
-+## location in the cloud to run koan.
-+## Depends on the storage and virt modules.
-+##
-+## Copyright 2008, Red Hat, Inc
-+## Matt Hicks <mhicks@redhat.com>
-+## +AUTHORS
-+##
-+## This software may be freely redistributed under the terms of the GNU
-+## general public license.
-+##
-+## You should have received a copy of the GNU General Public License
-+## along with this program; if not, write to the Free Software
-+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+##
-+
-+import os.path
-+import optparse
-+import sys
-+import random
-+import func.overlord.client as func_client
-+import func.utils as utils
-+
-+class FindResources(object):
-+
-+ def __init__(self):
-+ pass
-+
-+ def run(self,args):
-+
-+ p = optparse.OptionParser()
-+ p.add_option("-v", "--verbose",
-+ dest="verbose",
-+ action="store_true",
-+ help="provide extra output")
-+ p.add_option("-s", "--server-spec",
-+ dest="server_spec",
-+ default="*",
-+ help="run against specific servers, default: '*'")
-+ p.add_option("-m", "--memory",
-+ dest="memory",
-+ default="512",
-+ help="the memory requirements in megabytes, default: '512'")
-+ p.add_option("-d", "--disk",
-+ dest="disk",
-+ default="20",
-+ help="the disk storage requirements in gigabytes, default: '20'")
-+
-+ (options, args) = p.parse_args(args)
-+ self.options = options
-+
-+ # convert the memory and storage to integers for later comparisons
-+ memory = int(options.memory)
-+ storage = int(options.disk)
-+
-+ # see what hosts have enough RAM
-+ avail_hosts = {}
-+ host_freemem = func_client.Client(options.server_spec).virt.freemem()
-+ for (host, freemem) in host_freemem.iteritems():
-+ if utils.is_error(freemem):
-+ print "-- connection refused: %s" % host
-+ continue
-+
-+ # Take an additional 256M off the freemem to keep
-+ # Domain-0 stable (shrinking it to 256M can cause
-+ # it to crash under load)
-+ if (freemem-256) >= memory:
-+ avail_hosts[host] = {'memory': freemem}
-+
-+ # figure out which of these machines have enough storage
-+ for avail_host in avail_hosts.keys():
-+ # see what hosts have the required storage
-+ host_volume_groups = func_client.Client(avail_host).storage.vgs()
-+
-+ for (host, vol_groups) in host_volume_groups.iteritems():
-+ if utils.is_error(vol_groups):
-+ print "-- connection refused: %s" % host
-+ continue
-+
-+ avail_vol_groups = []
-+ for vol_group, attrs in vol_groups.iteritems():
-+ free_space = int(float(attrs['free'][:-1]))
-+ if free_space >= storage:
-+ avail_vol_groups.append((vol_group, free_space))
-+
-+ if len(avail_vol_groups) > 0:
-+ avail_hosts[host]['space'] = dict(avail_vol_groups)
-+ else:
-+ avail_hosts.pop(host)
-+
-+ # Default the dest_host to nothing
-+ dest_host = None
-+
-+ if len(avail_hosts) > 0:
-+ # Find the host that is the closest memory match
-+ for (host, attrs) in avail_hosts.iteritems():
-+ # Use a random volume group
-+ vol_group = random.choice(attrs['space'].keys())
-+
-+ if not dest_host:
-+ dest_host = [host, vol_group, attrs['memory']]
-+ else:
-+ if attrs['memory'] < dest_host[2]:
-+ # Use the better match
-+ dest_host = [host, vol_group, attrs['memory']]
-+
-+ return dest_host
-+
-+if __name__ == "__main__":
-+ inv = FindResources()
-+ inv.run(sys.argv)
-diff --git a/scripts/find-resources b/scripts/find-resources
-new file mode 100755
-index 0000000..043793b
---- /dev/null
-+++ b/scripts/find-resources
-@@ -0,0 +1,11 @@
-+#!/usr/bin/python
-+
-+import sys
-+import distutils.sysconfig
-+import func.overlord.find_resources as find_resources
-+
-+find_res = find_resources.FindResources()
-+avail_host = find_res.run(sys.argv)
-+
-+if avail_host:
-+ print "%s:%s" % (avail_host[0], avail_host[1])
---
-1.5.3.6
-
diff --git a/func/patches/0004-Closing-file-descriptors-during-the-virt-install-to.patch b/func/patches/0004-Closing-file-descriptors-during-the-virt-install-to.patch
deleted file mode 100644
index 83fbc4f..0000000
--- a/func/patches/0004-Closing-file-descriptors-during-the-virt-install-to.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 46cdb0b777bc7c594d67e94b8e291392c9222a08 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
-