Regarding Ticket #408 --virt-auto-boot needs to support qemu/KVM
by James Cammarata
Ok, I was doing some research into this over the weekend, and it does not
appear that python-virtinst currently supports setting autostart on any VM
architecture via the python API. I do see API calls in libvirt to do this,
so I'm exploring the possibility of submitting a patch to the
python-virtinst people to add the extra capabilities, but this would be
upstream and not available in all distros immediately, if at all.
Alternatively, we could do a shell call to "virsh autostart <vmname>",
which should work for anything that virsh can control.
Thoughts?
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
Problems with make test
by James Cammarata
Any thoughts on why I would be seeing this:
http://cobbler.pastebin.com/m3c206fe9
I see two errors there, one about no serializer_shelf module and then a LOT
of "AttributeError: BootAPI instance has no attribute '_config'". I'm
wondering if the first error is causing all of the rest?
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
[PATCH] Two patches to cleanup devel tree, removing windows code from devel
by James Cammarata
Found a few instances of windows cruft that didn't get cleaned out, a
couple of which were breaking things for me when trying to import. Also,
it seems like the kickstart path specified in the RedHat importer class was
wrong, so I fixed that up too.
I've done some testing on these (import, sync) to see if anything was
missed, but it hasn't been exceptionally thorough. You may want to go
through the code seeing if anything references the functions I've removed.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
Latest data from sloccount
by Michael DeHaan
The "cost" and "schedule" estimates from sloccount are next to
meaningless, but in case you wanted to know how much code there is now ...
SLOC Directory SLOC-by-Language (Sorted)
14409 cobbler python=14409
1198 contrib ruby=1198
371 top_dir python=371
319 scripts python=319
289 legacy python=289
260 debian sh=260
254 aux python=191,sh=63
241 tests python=241
156 config sh=156
60 website php=59,sh=1
Totals grouped by language (dominant language first):
python: 15820 (90.10%)
ruby: 1198 (6.82%)
sh: 481 (2.74%)
php: 59 (0.34%)
(The php stuff can be deleted. The incomplete ruby libraries will most
likely will be replaced by a AMQP/QMF binding at some point as OVirt
moves over to that. The shell counts are also
a bit weird)
--Michael
15 years, 1 month
find not working because of unicode object data
by Vreman, Peter
Maybe the it comes from the change to json, but the find for distro and repo is not working:
2009-03-27 17:37:44,375 - api - find_distro; user(?)
2009-03-27 17:37:44,375 - api - {'name': 'RHEL'}; user(?)
2009-03-27 17:37:44,375 - api - Exception occured: cobbler.cexceptions.CX
2009-03-27 17:37:44,375 - api - Exception value: "find cannot compare type: <type 'unicode'>"
2009-03-27 17:37:44,376 - api - Exception Info:
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 1604, in _dispatch
return method_handle(*params)
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 604, in find_distro
data = self.__find(self.api.find_distro,criteria,expand=expand,token=token)
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 597, in __find
data = [x.to_datastruct_with_cache() for x in find_function(name, True, True, **criteria)]
File "/usr/lib/python2.3/site-packages/cobbler/api.py", line 432, in find_distro
return self._config.distros().find(name=name, return_list=return_list, no_errors=no_errors, **kargs)
File "/usr/lib/python2.3/site-packages/cobbler/collection.py", line 91, in find
if obj.find_match(kargs, no_errors=no_errors):
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 268, in find_match
if not self.find_match_single_key(data,key,value,no_errors):
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 295, in find_match_single_key
return self.__find_compare(value, data[key])
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 336, in __find_compare
raise CX(_("find cannot compare type: %s") % type(from_obj))
The following patch fixes this for me:
--- old/cobbler/item.py 2009-03-27 14:51:25.000000000 +0100
+++ build/cobbler/item.py 2009-03-27 17:54:16.000000000 +0100
@@ -297,7 +297,7 @@
def __find_compare(self, from_search, from_obj):
- if type(from_obj) == type(""):
+ if type(from_obj) == type("") or type(from_obj) == unicode:
# FIXME: fnmatch is only used for string to string comparisions
# which should cover most major usage, if not, this deserves fixing
if fnmatch.fnmatch(from_obj.lower(), from_search.lower()):
Regards,
Peter
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
15 years, 1 month
[PATCH] Added --exclude_dns flag to buildiso
by Dave Hatton
The recently added code to provide DNS servers to the kernel when using
buildiso causes problems when the target systems cannot contact the DNS
servers.
This is highly likely when building with buildiso, since it it intended
for building on isolated networks.
This patch adds the flag --exclude_dns to resolve this problem.
I've attached patches for master and devel and are also available on github.
git://github.com/davehatton/my-cobbler-master.git
git://github.com/davehatton/my-cobbler-devel.git
Thanks
Dave Hatton
>From 5e55adc250e8e0cc8f6bc7ca7fe7bca7d868c803 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Thu, 26 Mar 2009 23:28:03 +0000
Subject: [PATCH] added --exclude_dns option to buildiso
---
cobbler/action_buildiso.py | 8 ++++----
cobbler/api.py | 4 ++--
cobbler/modules/cli_misc.py | 4 +++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 2eebb66..bd5484f 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -83,7 +83,7 @@ class BuildIso:
return str(self.distctr)
- def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None):
+ def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None,exclude_dns=None):
print _("- copying kernels and initrds - for profiles")
# copy all images in included profiles to images dir
for profile in self.api.profiles():
@@ -229,7 +229,7 @@ class BuildIso:
if data.has_key("gateway") and data["gateway"] != "":
append_line = append_line + " gateway=%s" % data["gateway"]
- if data.has_key("name_servers") and data["name_servers"]:
+ if not exclude_dns and data.has_key("name_servers") and data["name_servers"]:
append_line = append_line + " dns=%s\n" % ",".join(data["name_servers"])
length=len(append_line)
@@ -329,7 +329,7 @@ class BuildIso:
return
- def run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None):
+ def run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None,exclude_dns=None):
# the distro option is for stand-alone builds only
if not standalone and distro is not None:
@@ -391,7 +391,7 @@ class BuildIso:
if standalone:
self.generate_standalone_iso(imagesdir,isolinuxdir,distro,source)
else:
- self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems)
+ self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems,exclude_dns)
cmd = "mkisofs -quiet -o %s -r -b isolinux/isolinux.bin -c isolinux/boot.cat" % iso
cmd = cmd + " -no-emul-boot -boot-load-size 4"
diff --git a/cobbler/api.py b/cobbler/api.py
index fee90f2..85e908c 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -710,10 +710,10 @@ class BootAPI:
self.log("authorize",[user,resource,arg1,arg2,rc],debug=True)
return rc
- def build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None):
+ def build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None, exclude_dns=None):
builder = action_buildiso.BuildIso(self._config)
return builder.run(
- iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro, standalone=standalone, source=source
+ iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro, standalone=standalone, source=source, exclude_dns=exclude_dns
)
def hardlink(self):
diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py
index f4c9630..b898f7a 100644
--- a/cobbler/modules/cli_misc.py
+++ b/cobbler/modules/cli_misc.py
@@ -245,6 +245,7 @@ class BuildIsoFunction(commands.CobblerFunction):
p.add_option("--distro", dest="distro", help="(OPTIONAL) used with --standalone to create a distro-based ISO including all associated profiles/systems")
p.add_option("--standalone", dest="standalone", action="store_true", help="(OPTIONAL) creates a standalone ISO with all required distro files on it")
p.add_option("--source", dest="source", help="(OPTIONAL) used with --standalone to specify a source for the distribution files")
+ p.add_option("--exclude_dns", dest="exclude_dns", action="store_true", help="(OPTIONAL) prevents addition of name server addresses to the kernel boot options")
def help_me(self):
return HELP_FORMAT % ("cobbler buildiso","[ARGS]")
@@ -260,7 +261,8 @@ class BuildIsoFunction(commands.CobblerFunction):
tempdir=self.options.tempdir,
distro=self.options.distro,
standalone=self.options.standalone,
- source=self.options.source
+ source=self.options.source,
+ exclude_dns=self.options.exclude_dns
)
########################################################
--
1.5.5.6
>From 715c5549cfb83d5fc1796db69b4439ed689adbd7 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Thu, 26 Mar 2009 23:28:03 +0000
Subject: [PATCH] added --exclude_dns option to buildiso
---
cobbler/action_buildiso.py | 8 ++++----
cobbler/api.py | 4 ++--
cobbler/modules/cli_misc.py | 4 +++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 2eebb66..bd5484f 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -83,7 +83,7 @@ class BuildIso:
return str(self.distctr)
- def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None):
+ def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None,exclude_dns=None):
print _("- copying kernels and initrds - for profiles")
# copy all images in included profiles to images dir
for profile in self.api.profiles():
@@ -229,7 +229,7 @@ class BuildIso:
if data.has_key("gateway") and data["gateway"] != "":
append_line = append_line + " gateway=%s" % data["gateway"]
- if data.has_key("name_servers") and data["name_servers"]:
+ if not exclude_dns and data.has_key("name_servers") and data["name_servers"]:
append_line = append_line + " dns=%s\n" % ",".join(data["name_servers"])
length=len(append_line)
@@ -329,7 +329,7 @@ class BuildIso:
return
- def run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None):
+ def run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None,exclude_dns=None):
# the distro option is for stand-alone builds only
if not standalone and distro is not None:
@@ -391,7 +391,7 @@ class BuildIso:
if standalone:
self.generate_standalone_iso(imagesdir,isolinuxdir,distro,source)
else:
- self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems)
+ self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems,exclude_dns)
cmd = "mkisofs -quiet -o %s -r -b isolinux/isolinux.bin -c isolinux/boot.cat" % iso
cmd = cmd + " -no-emul-boot -boot-load-size 4"
diff --git a/cobbler/api.py b/cobbler/api.py
index 3d728d4..220e905 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -676,10 +676,10 @@ class BootAPI:
self.log("authorize",[user,resource,arg1,arg2,rc],debug=True)
return rc
- def build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None):
+ def build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None, exclude_dns=None):
builder = action_buildiso.BuildIso(self._config)
return builder.run(
- iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro, standalone=standalone, source=source
+ iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro, standalone=standalone, source=source, exclude_dns=exclude_dns
)
def hardlink(self):
diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py
index a4fc470..6050e48 100644
--- a/cobbler/modules/cli_misc.py
+++ b/cobbler/modules/cli_misc.py
@@ -243,6 +243,7 @@ class BuildIsoFunction(commands.CobblerFunction):
p.add_option("--distro", dest="distro", help="(OPTIONAL) used with --standalone to create a distro-based ISO including all associated profiles/systems")
p.add_option("--standalone", dest="standalone", action="store_true", help="(OPTIONAL) creates a standalone ISO with all required distro files on it")
p.add_option("--source", dest="source", help="(OPTIONAL) used with --standalone to specify a source for the distribution files")
+ p.add_option("--exclude_dns", dest="exclude_dns", action="store_true", help="(OPTIONAL) prevents addition of name server addresses to the kernel boot options")
def help_me(self):
return HELP_FORMAT % ("cobbler buildiso","[ARGS]")
@@ -258,7 +259,8 @@ class BuildIsoFunction(commands.CobblerFunction):
tempdir=self.options.tempdir,
distro=self.options.distro,
standalone=self.options.standalone,
- source=self.options.source
+ source=self.options.source,
+ exclude_dns=self.options.exclude_dns
)
########################################################
--
1.5.5.6
15 years, 1 month
[PATCH] trac ticket #401 - Make random MAC creation in cobbler smarter
by James Cammarata
Taken care of. I've also created a koan repository on github for this:
git://github.com/jimi1283/koan.git
Koan commit:
commit 5bd232a4ccfdf34962cd7f1386c6e3b9f6b22f65
Author: James Cammarata <jimi(a)sngx.net>
Date: Thu Mar 26 00:00:31 2009 -0500
Modified random mac address generation for vmware virt-types
Trac Ticket #216
Cobbler commit (branch my-devel):
commit e6aaed12eff0afd7a3d63a6695cf98af30d8b1df
Author: James Cammarata <jimi(a)sngx.net>
Date: Wed Mar 25 23:52:43 2009 -0500
Updated random mac address generate to assign the VMWare range of mac
addresses to vmware virt types
Trac Ticket #216
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
[Patch] Cobbler deployment
by Scott Henson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This patch implements 'cobbler system deploy'. Basically, if you have
func connecting your cobbler server to your virtual hosts, you can now
have cobbler simply deploy the virtual hosts. You can also manage the
power state of your virtual hosts over func. You can deploy a system to
a virt_host or a virt_group. A virt_group is a collection of available
virt_hosts. Basic usage is as follows
cobbler system edit --name=virtserver01 --virt-group=default
cobbler system edit --name=virtserver02 --virt-group=default
cobbler system deploy --name=vm01 --virt-group=default
cobbler system deploy --name=vm02 --virt-host=virtserver02
The first two commands add virtservers 01 and 02 to virtual group
default. Then the second two commands deploy vms to those hosts. The
first one will get randomly placed on 01 or 02, while the second will
get placed on virtserver02.
Currently cobbler picks which virt_host from a virt_group a vm lands on
at random (random.choice(systems)). I would like to make this choice
more intelligent based on the load each virtual host. Unfortunately,
the load a virtual host is under can change from place to place.
Currently the load factor I would like to use involves over committing
the physical CPUs by 2 times, and limiting based upon maximum memory in
the system. So it would be (VRAM+VCPU)/(PRAM+2*PCPU). Which should
come out to a number less than one and we would grab the minimum. Any
suggestions on a better way to do it? Its a pretty small/simple piece
of code, but I bet it will have a large effect on the usability of the
system.
As for testing, I did initial smoke testing and it doesn't seem to break
anything else. It should work except I can't get my version of koan to
contact cobbler, but it is calling koan with all the proper arguments on
the other side, so I call that 'working'. I'd love comments on it. Thanks.
- --
Scott Henson
Red Hat CIS Operator
WVU Alum BSAE/BSME
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAknL2cQACgkQZ+CEIfzQ+Eq/DQCgkV4i97VsVQj8nC1+a4XJC6Ns
nzwAoKB25abxzXBweE+RCIQICZOAuvg5
=HvJU
-----END PGP SIGNATURE-----
>From 6d0364c48116de03bbed3364723c41b626963827 Mon Sep 17 00:00:00 2001
From: Scott Henson <shenson(a)redhat.com>
Date: Mon, 9 Mar 2009 18:28:45 -0400
Subject: [PATCH] Implement cobbler system deploy
- We now have a func utils module
- As a bonus we get power over func for virt hosts
---
cobbler/action_deploy.py | 81 +++++++++++++++++++++++++++++++++++++++++
cobbler/action_power.py | 15 ++++++++
cobbler/api.py | 9 ++++-
cobbler/collection.py | 2 +
cobbler/commands.py | 25 +++++++++++++
cobbler/func_utils.py | 29 +++++++++++++++
cobbler/item_system.py | 19 ++++++++++
cobbler/modules/cli_system.py | 10 ++++-
cobbler/remote.py | 9 ++++-
cobbler/utils.py | 30 +++++++++++++++
10 files changed, 225 insertions(+), 4 deletions(-)
create mode 100644 cobbler/action_deploy.py
create mode 100644 cobbler/func_utils.py
diff --git a/cobbler/action_deploy.py b/cobbler/action_deploy.py
new file mode 100644
index 0000000..875a202
--- /dev/null
+++ b/cobbler/action_deploy.py
@@ -0,0 +1,81 @@
+"""
+Replicate from a cobbler master.
+
+Copyright 2009, Red Hat, Inc
+Scott Henson <shenson(a)redhat.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+"""
+
+import func_utils
+from utils import _
+from cexceptions import *
+import random
+
+class Deployer:
+ def __init__(self,config):
+ """
+ Constructor
+ """
+ self.config = config
+ self.settings = config.settings()
+ self.api = config.api
+ self.virt_host = None
+
+ # -------------------------------------------------------
+
+ def find_host(self, virt_group):
+ """
+ Find a system in the virtual group specified
+ """
+
+ systems = self.api.find_system(virt_group=virt_group, return_list = True)
+ if len(systems) == 0:
+ raise CX("No systems were found in virtual group %s"%virt_group)
+ return random.choice(systems)
+
+ # -------------------------------------------------------
+
+ def deploy(self, system, virt_host = None, virt_group=None):
+ """
+ Deploy the current system to the virtual host or virtual group
+ """
+ if virt_host is None and virt_group is not None:
+ virt_host = self.find_host(virt_group)
+
+ if virt_host is None and system.virt_group == '':
+ virt_host = self.find_host(system.virt_group)
+
+ if system.virt_host != '':
+ virt_host = system.virt_host
+
+ if virt_host is None:
+ raise CX("No host specified for deployment.")
+
+ if not func_utils.HAZFUNC:
+ raise CX("Func is not available.")
+
+ try:
+ client = func_utils.func.Client(virt_host)
+ rc = client.virt.install(self.settings.server, system.hostname, True)[virt_host]
+ if rc != 0:
+ raise CX("Func Error: %s"%rc[2])
+ system.virt_host = virt_host
+ self.api.add_system(system)
+ return rc
+
+ except func_utils.Func_Client_Exception, ex:
+ raise CX("A Func Exception has occured: %s"%ex)
diff --git a/cobbler/action_power.py b/cobbler/action_power.py
index 789750a..f43c215 100644
--- a/cobbler/action_power.py
+++ b/cobbler/action_power.py
@@ -34,6 +34,7 @@ import traceback
import time
import utils
+import func_utils
from cexceptions import *
import templar
@@ -64,6 +65,20 @@ class PowerTool:
interested in maximum security should take that route.
"""
+ if self.system.virt_host != '' and func_utils.HAZFUNC:
+ try:
+ client = func_utils.func.Client(self.system.virt_host)
+ if desired_state == 'on':
+ rc = client.virt.create(self.system.hostname)[self.system.virt_host]
+ else:
+ rc = client.virt.destroy(self.system.hostname)[self.system.virt_host]
+ if rc != 0:
+ print rc[2]
+ else:
+ return rc
+ except func_utils.Func_Client_Exception:
+ pass
+
template = self.get_command_template()
template_file = open(template, "r")
diff --git a/cobbler/api.py b/cobbler/api.py
index fee90f2..5617833 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -27,6 +27,7 @@ import config
import utils
import action_sync
import action_check
+import action_deploy
import action_import
import action_reposync
import action_status
@@ -767,7 +768,13 @@ class BootAPI:
self.power_off(system, user, password)
time.sleep(5)
return self.power_on(system, user, password)
-
+
+ def deploy(self, system, virt_host=None, virt_group=None):
+ """
+ Deploys a system to the virtual host or virtual group
+ """
+ return action_deploy.Deployer(self._config).deploy(system,virt_host=virt_host,virt_group=virt_group)
+
def get_os_details(self):
return (self.dist, self.os_version)
diff --git a/cobbler/collection.py b/cobbler/collection.py
index 55c65f6..63c3fb4 100644
--- a/cobbler/collection.py
+++ b/cobbler/collection.py
@@ -113,6 +113,8 @@ class Collection(serializable.Serializable):
'virt-type' : 'virt_type',
'virt-bridge' : 'virt_bridge',
'virt-cpus' : 'virt_cpus',
+ 'virt-host' : 'virt_host',
+ 'virt-group' : 'virt_group',
'dhcp-tag' : 'dhcp_tag',
'netboot-enabled' : 'netboot_enabled'
}
diff --git a/cobbler/commands.py b/cobbler/commands.py
index 4bb6ec3..791c58c 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -299,6 +299,21 @@ class CobblerFunction:
self.api.reboot(obj,self.options.power_user,self.options.power_pass)
return None
+ if "deploy" in self.args:
+ obj = collect_fn().find(self.options.name)
+ if obj is None:
+ raise CX(_("object not found"))
+ if self.options.virt_host == '':
+ virt_host = None
+ else:
+ virt_host = self.options.virt_host
+
+ if self.options.virt_group == '':
+ virt_group = None
+ else:
+ virt_group = self.options.virt_group
+ self.api.deploy(obj,virt_host=virt_host,virt_group=virt_group)
+
if "remove" in self.args:
recursive = False
# only applies to distros/profiles and is not supported elsewhere
@@ -332,6 +347,16 @@ class CobblerFunction:
raise CX(_("object not found"))
return obj
+ if "deploy" in self.args:
+ if not self.options.name:
+ raise CX(_("name is required"))
+ obj = collect_fn().find(self.options.name)
+ if obj is None:
+ raise CX(_("object not found"))
+ if obj.virt_host == '' or not self.options.virt_host or not self.options.virt_group:
+ raise CX(_("No virtual host to deploy to"))
+ return obj
+
try:
# catch some invalid executions of the CLI
getattr(self, "options")
diff --git a/cobbler/func_utils.py b/cobbler/func_utils.py
new file mode 100644
index 0000000..79e1e10
--- /dev/null
+++ b/cobbler/func_utils.py
@@ -0,0 +1,29 @@
+"""
+Misc func functions for cobbler
+
+Copyright 2006-2008, Red Hat, Inc
+Scott Henson <shenson(a)redhat.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+"""
+
+try:
+ import func.overlord.client as func
+ from func.CommonErrors import Func_Client_Exception
+ HAZFUNC=True
+except ImportError:
+ HAZFUNC=False
+
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index cf8e5d1..5d6f85e 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -62,6 +62,8 @@ class System(item.Item):
self.virt_type = "<<inherit>>" # ""
self.virt_path = "<<inherit>>" # ""
self.virt_bridge = "<<inherit>>" # ""
+ self.virt_host = "" # ""
+ self.virt_group = "" # ""
self.comment = ""
self.ctime = 0
self.mtime = 0
@@ -195,6 +197,8 @@ class System(item.Item):
self.virt_type = self.load_item(seed_data,'virt_type','<<inherit>>')
self.virt_bridge = self.load_item(seed_data,'virt_bridge','<<inherit>>')
self.virt_cpus = self.load_item(seed_data,'virt_cpus','<<inherit>>')
+ self.virt_host = self.load_item(seed_data,'virt_host','')
+ self.virt_group = self.load_item(seed_data,'virt_group','')
self.ctime = self.load_item(seed_data,'ctime',0)
self.mtime = self.load_item(seed_data,'mtime',0)
@@ -576,6 +580,12 @@ class System(item.Item):
def set_virt_cpus(self,num):
return utils.set_virt_cpus(self,num)
+ def set_virt_host(self,host):
+ return utils.set_virt_host(self,host)
+
+ def set_virt_group(self,group):
+ return utils.set_virt_group(self,group)
+
def set_virt_file_size(self,num):
return utils.set_virt_file_size(self,num)
@@ -706,6 +716,8 @@ class System(item.Item):
'image' : self.image,
'server' : self.server,
'virt_cpus' : self.virt_cpus,
+ 'virt_host' : self.virt_host,
+ 'virt_group' : self.virt_group,
'virt_bridge' : self.virt_bridge,
'virt_file_size' : self.virt_file_size,
'virt_path' : self.virt_path,
@@ -754,6 +766,8 @@ class System(item.Item):
buf = buf + _("virt auto boot : %s\n") % self.virt_auto_boot
buf = buf + _("virt cpus : %s\n") % self.virt_cpus
+ buf = buf + _("virt host : %s\n") % self.virt_host
+ buf = buf + _("virt group : %s\n") % self.virt_group
buf = buf + _("virt file size : %s\n") % self.virt_file_size
buf = buf + _("virt path : %s\n") % self.virt_path
buf = buf + _("virt ram : %s\n") % self.virt_ram
@@ -829,6 +843,11 @@ class System(item.Item):
'virt_ram' : self.set_virt_ram,
'virt_type' : self.set_virt_type,
'virt_cpus' : self.set_virt_cpus,
+ 'virt-host' : self.set_virt_host,
+ 'virt_host' : self.set_virt_host,
+ 'virt-group' : self.set_virt_group,
+ 'virt_group' : self.set_virt_group,
+ 'virt-file-size' : self.set_virt_file_size,
'virt_file_size' : self.set_virt_file_size,
'server' : self.set_server,
'owners' : self.set_owners,
diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py
index 9516b77..148e418 100644
--- a/cobbler/modules/cli_system.py
+++ b/cobbler/modules/cli_system.py
@@ -35,13 +35,13 @@ from cexceptions import *
class SystemFunction(commands.CobblerFunction):
def help_me(self):
- return commands.HELP_FORMAT % ("cobbler system","<add|copy|edit|find|list|power[off|on]|reboot|rename|remove|report|getks> [ARGS]")
+ return commands.HELP_FORMAT % ("cobbler system","<add|copy|deploy|edit|find|list|power[off|on]|reboot|rename|remove|report|getks> [ARGS]")
def command_name(self):
return "system"
def subcommands(self):
- return ["add","copy","dumpvars","edit","find","getks","poweroff","poweron","list","reboot","remove","rename","report"]
+ return ["add","copy","deploy","dumpvars","edit","find","getks","poweroff","poweron","list","reboot","remove","rename","report"]
def add_options(self, p, args):
@@ -121,6 +121,8 @@ class SystemFunction(commands.CobblerFunction):
p.add_option("--virt-auto-boot", dest="virt_auto_boot", help="auto boot this VM with host?")
p.add_option("--virt-bridge", dest="virt_bridge", help="ex: 'virbr0'")
p.add_option("--virt-cpus", dest="virt_cpus", help="integer (default: 1)")
+ p.add_option("--virt-host", dest="virt_host", help="virtual host")
+ p.add_option("--virt-group", dest="virt_group", help="virtual group")
p.add_option("--virt-file-size", dest="virt_file_size", help="size in GB")
p.add_option("--virt-path", dest="virt_path", help="path, partition, or volume")
p.add_option("--virt-ram", dest="virt_ram", help="size in MB")
@@ -187,6 +189,10 @@ class SystemFunction(commands.CobblerFunction):
obj.set_virt_type(self.options.virt_type)
if self.options.virt_cpus is not None:
obj.set_virt_cpus(self.options.virt_cpus)
+ if self.options.virt_host is not None:
+ obj.set_virt_host(self.options.virt_host)
+ if self.options.virt_group is not None and not self.matches_args(self.args, ["deploy"]):
+ obj.set_virt_group(self.options.virt_group)
if self.options.virt_path is not None:
obj.set_virt_path(self.options.virt_path)
diff --git a/cobbler/remote.py b/cobbler/remote.py
index c9d668d..5646586 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -1570,7 +1570,14 @@ class CobblerXMLRPCInterface:
raise CX(_("invalid power mode '%s', expected on/off/reboot" % power))
return rc
-
+ def deploy(self, object_id, virt_host=None, virt_group=None, token=None):
+ """
+ Deploy a system
+ """
+ obj = self.__get_object(object_id)
+ self.check_access(token, "deploy", obj)
+ rc = self.api.deploy(obj, virt_host=virt_host, virt_group=virt_group)
+ return rc
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 1c3d56b..edd18d7 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -1381,6 +1381,36 @@ def set_virt_cpus(self,num):
self.virt_cpus = num
return True
+def set_virt_host(self,host):
+ """
+ For setting the virtual host that the virt system resides on.
+ """
+ if host is None:
+ self.virt_host = ''
+ return True
+
+ if host == "<<inherit>>":
+ self.virt_host = "<<inherit>>"
+ return True
+
+ self.virt_host = host
+ return True
+
+def set_virt_group(self,group):
+ """
+ For setting the virtual group that the virt system resides in.
+ """
+ if group is None:
+ self.virt_group = ''
+ return True
+
+ if group == "<<inherit>>":
+ self.virt_group = "<<inherit>>"
+ return True
+
+ self.virt_group = group
+ return True
+
def get_kickstart_templates(api):
files = {}
for x in api.profiles():
--
1.6.0.6
15 years, 1 month
[PATCH] add a flag to yumdownloader to ensure only the correct repo is being used
by Robert Lazzurs
Hello,
I have made a small change to the flags that yumdownloader uses by
default to ensure the system repos are not used. However I view this
as a quick fix for the current stable, I would suggest that the RFE to
replace yumdownloader is actioned in devel (by me if no one else wants
it) to solve this long term for the next major release. This patch is
for bug #406 in trac.
The commit is a56e81a8b7df721978b295575b4448958cc2fd47 in my
lazzurs-master branch on github, also picked over to devel however I
had to update the CHANGELOG in devel as it was out of date with the
changes under 1.6, hope I did not make a mess in git doing this.
Take care.
15 years, 1 month