diff options
author | mdehaan@mdehaan.rdu.redhat.com <> | 2006-10-25 11:03:49 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-10-25 11:03:49 -0400 |
commit | 118c34bf597c35b60396181a7b3ca79e3c7b2c69 (patch) | |
tree | 4efe57d0ece9884f2a4d07f862d6734f505e6a5e /cobbler | |
parent | 03bd765f7993c413bf71d580f2c7adcc00000be3 (diff) | |
download | third_party-cobbler-118c34bf597c35b60396181a7b3ca79e3c7b2c69.tar.gz third_party-cobbler-118c34bf597c35b60396181a7b3ca79e3c7b2c69.tar.xz third_party-cobbler-118c34bf597c35b60396181a7b3ca79e3c7b2c69.zip |
Change "Xen" to "virt" to make it more generic.
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/action_import.py | 6 | ||||
-rw-r--r-- | cobbler/action_sync.py | 14 | ||||
-rwxr-xr-x | cobbler/cobbler.py | 12 | ||||
-rw-r--r-- | cobbler/cobbler_msg.py | 14 | ||||
-rw-r--r-- | cobbler/collection_profiles.py | 2 | ||||
-rw-r--r-- | cobbler/item_profile.py | 125 |
6 files changed, 85 insertions, 88 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 9e0dc69..486842e 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -187,7 +187,7 @@ class Importer: if tentative == filter_out: fnames.remove(tentative) print "%s" % dirname - if not self.is_pxe_or_xen_dir(dirname): + if not self.is_pxe_or_virt_dir(dirname): return for x in fnames: if x.startswith("initrd"): @@ -236,8 +236,8 @@ class Importer: return "x86" return "x86" - def is_pxe_or_xen_dir(self,dirname): - if dirname.find("pxe") != -1 or dirname.find("xen") != -1: + def is_pxe_or_virt_dir(self,dirname): + if dirname.find("pxe") != -1 or dirname.find("xen") != -1 or dirname.find("virt") != -1: return True return False diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index bd7a083..b723dc4 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -176,11 +176,11 @@ class BootSync: def clean_trees(self): """ - Delete any previously built pxelinux.cfg tree and xen tree info. + Delete any previously built pxelinux.cfg tree and virt tree info. Note: for SELinux reasons, some information goes in /tftpboot, some in /var/www/cobbler and some must be duplicated in both. This is because PXE needs tftp, and auto-kickstart - and Xen operations need http. Only the kernel and initrd images are duplicated, which is + and Virt operations need http. Only the kernel and initrd images are duplicated, which is unfortunate, though SELinux won't let me give them two contexts, so symlinks are not a solution. *Otherwise* duplication is minimal. """ @@ -246,7 +246,7 @@ class BootSync: def validate_kickstarts_per_profile(self): """ - Koan provisioning (Xen + auto-ks) needs kickstarts + Koan provisioning (Virt + auto-ks) needs kickstarts per profile. Validate them as needed. Local kickstarts get template substitution. Since http:// kickstarts might get generated via magic URLs, those are *not* substituted. @@ -332,7 +332,7 @@ class BootSync: """ Now that kernels and initrds are copied and kickstarts are all valid, build the pxelinux.cfg tree, which contains a directory for each - configured IP or MAC address. Also build a tree for Xen info. + configured IP or MAC address. Also build a tree for Virt info. NOTE: some info needs to go in TFTP and HTTP directories, but not all. Usually it's just one or the other. @@ -501,7 +501,7 @@ class BootSync: def write_distro_file(self,filename,distro): """ - Create distro information for xen-net-install + Create distro information for virt install NOTE: relevant to http only """ @@ -514,7 +514,7 @@ class BootSync: def write_profile_file(self,filename,profile): """ - Create profile information for xen-net-install + Create profile information for virt install NOTE: relevant to http only """ @@ -529,7 +529,7 @@ class BootSync: def write_system_file(self,filename,system): """ - Create system information for xen-net-install + Create system information for virt install NOTE: relevant to http only """ diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index 47ae6da..aa64ff4 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -210,12 +210,12 @@ class BootCLI: '--kickstart' : lambda(a) : profile.set_kickstart(a), '--kick-start' : lambda(a) : profile.set_kickstart(a), '--kopts' : lambda(a) : profile.set_kernel_options(a), - '--xen-name' : lambda(a) : profile.set_xen_name(a), - '--virt-name' : lambda(a) : profile.set_xen_name(a), - '--xen-file-size' : lambda(a) : profile.set_xen_file_size(a), - '--virt-file-size' : lambda(a) : profile.set_xen_file_size(a), - '--xen-ram' : lambda(a) : profile.set_xen_ram(a), - '--virt-ram' : lambda(a) : profile.set_xen_ram(a), + '--xen-name' : lambda(a) : profile.set_virt_name(a), + '--virt-name' : lambda(a) : profile.set_virt_name(a), + '--xen-file-size' : lambda(a) : profile.set_virt_file_size(a), + '--virt-file-size' : lambda(a) : profile.set_virt_file_size(a), + '--xen-ram' : lambda(a) : profile.set_virt_ram(a), + '--virt-ram' : lambda(a) : profile.set_virt_ram(a), '--ksmeta' : lambda(a) : profile.set_ksmeta(a) } on_ok = lambda: self.api.profiles().add(profile) diff --git a/cobbler/cobbler_msg.py b/cobbler/cobbler_msg.py index a77e537..0181439 100644 --- a/cobbler/cobbler_msg.py +++ b/cobbler/cobbler_msg.py @@ -26,8 +26,8 @@ cobbler distro add --name=<string> --kernel=<path> --initrd=<path> cobbler profile add --name=<string --distro=<string> [--kick-start=<url>] [--kopts=<string>] [--ksmeta=<string>] - [--xen-name=<string>] [--xen-file-size=<gigabytes>] - [--xen-ram=<megabytes>] + [--virt-name=<string>] [--virt-file-size=<gigabytes>] + [--virt-ram=<megabytes>] cobbler system add --name=<ip│mac│hostname|default> --profile=<string> [--pxe-address=<string>] @@ -103,11 +103,11 @@ _msg_table = { "copying" : "copying file: %s to %s", "removing" : "removing: %s", "no_initrd" : "cannot find initrd", - "exc_xen_name" : "invalid Xen name", - "exc_xen_file" : "invalid Xen file size", - "exc_xen_ram" : "invalid Xen RAM size", - "exc_xen_mac" : "invalid Xen mac address", - "exc_xen_para" : "invalid Xen paravirtualization setting", + "exc_virt_name" : "invalid name for virtual image", + "exc_virt_file" : "invalid file size for virtual image", + "exc_virt_ram" : "invalid RAM size for virtual image", + "exc_virt_mac" : "invalid MAC address for virtual image", + "exc_virt_para" : "invalid paravirtualization setting", "exc_profile" : "invalid profile name", "exc_profile2" : "profile name not set", "exc_pxe_arch" : "valid PXE architectures: standard or ia64", diff --git a/cobbler/collection_profiles.py b/cobbler/collection_profiles.py index 71cbd9f..717d19c 100644 --- a/cobbler/collection_profiles.py +++ b/cobbler/collection_profiles.py @@ -1,7 +1,7 @@ """ A profile represents a distro paired with a kickstart file. For instance, FC5 with a kickstart file specifying OpenOffice -might represent a 'desktop' profile. For Xen, there are many +might represent a 'desktop' profile. For Virt, there are many additional options, with client-side defaults (not kept here). Copyright 2006, Red Hat, Inc diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py index b40ecf5..311b54f 100644 --- a/cobbler/item_profile.py +++ b/cobbler/item_profile.py @@ -1,5 +1,5 @@ """ -A Cobbler Profile. A profile is a reference to a distribution, possibly some kernel options, possibly some Xen options, and some kickstart data. +A Cobbler Profile. A profile is a reference to a distribution, possibly some kernel options, possibly some Virt options, and some kickstart data. Copyright 2006, Red Hat, Inc Michael DeHaan <mdehaan@redhat.com> @@ -35,10 +35,10 @@ class Profile(item.Item): self.kickstart = self.settings.default_kickstart self.kernel_options = '' self.ks_meta = '' - self.xen_name = 'virtguest' - self.xen_file_size = 5 # GB. 5 = Decent _minimum_ default for FC5. - self.xen_ram = 512 # MB. Install with 256 not likely to pass - self.xen_paravirt = True # hvm support is *NOT* in Koan (now) + self.virt_name = 'virtguest' + self.virt_file_size = 5 # GB. 5 = Decent _minimum_ default for FC5. + self.virt_ram = 512 # MB. Install with 256 not likely to pass + self.virt_paravirt = True # hvm support is *NOT* in Koan (now) def from_datastruct(self,seed_data): """ @@ -49,12 +49,22 @@ class Profile(item.Item): self.kickstart = self.load_item(seed_data,'kickstart') self.kernel_options = self.load_item(seed_data,'kernel_options') self.ks_meta = self.load_item(seed_data,'ks_meta') - self.xen_name = self.load_item(seed_data,'xen_name') - if not self.xen_name or self.xen_name == '': - self.xen_name = self.name - self.xen_ram = self.load_item(seed_data,'xen_ram') - self.xen_file_size = self.load_item(seed_data,'xen_file_size') - self.xen_paravirt = self.load_item(seed_data,'xen_paravirt') + + # virt specific + self.virt_name = self.load_item(seed_data,'virt_name') + self.virt_ram = self.load_item(seed_data,'virt_ram') + self.virt_file_size = self.load_item(seed_data,'virt_file_size') + self.virt_paravirt = self.load_item(seed_data,'virt_paravirt') + + # support for older versions of the cobbler files (backwards compat)... + self.virt_name = self.load_item(seed_data,'xen_name') + if not self.virt_name or self.virt_name == '': + self.virt_name = self.name + self.virt_ram = self.load_item(seed_data,'xen_ram') + self.virt_file_size = self.load_item(seed_data,'xen_file_size') + self.virt_paravirt = self.load_item(seed_data,'xen_paravirt') + + return self def set_distro(self,distro_name): @@ -77,11 +87,11 @@ class Profile(item.Item): return True raise cexceptions.CobblerException("no_kickstart") - def set_xen_name(self,str): + def set_virt_name(self,str): """ - For Xen only. - Specifies what xenguest install should use for --name. - xen-net-install may do conflict resolution, so this is mostly + For Virt only. + Specifies what virt install should use for --name. + virt install may do conflict resolution, so this is mostly a hint... To keep the shell happy, the 'str' cannot contain wildcards or slashes and may be subject to some other untainting later. @@ -89,18 +99,14 @@ class Profile(item.Item): # no slashes or wildcards for bad in [ '/', '*', '?' ]: if str.find(bad) != -1: - raise cexceptions.CobblerException("exc_xen_name") - self.xen_name = str + raise cexceptions.CobblerException("exc_virt_name") + self.virt_name = str return True - def set_virt_name(self,str): - return self.set_xen_name(str) - - - def set_xen_file_size(self,num): + def set_virt_file_size(self,num): """ - For Xen only. - Specifies the size of the Xen image in gigabytes. xen-net-install + For Virt only. + Specifies the size of the virt image in gigabytes. koan may contain some logic to ignore 'illogical' values of this size, though there are no guarantees. 0 tells koan to just let it pick a semi-reasonable size. When in doubt, specify the @@ -110,41 +116,35 @@ class Profile(item.Item): try: inum = int(num) if inum != float(num): - return cexceptions.CobblerException("exc_xen_file") + return cexceptions.CobblerException("exc_virt_file") if inum >= 0: - self.xen_file_size = inum + self.virt_file_size = inum return True - return cexceptions.CobblerException("exc_xen_file") + return cexceptions.CobblerException("exc_virt_file") except: - return cexceptions.CobblerException("exc_xen_file") + return cexceptions.CobblerException("exc_virt_file") - def set_virt_file_size(self,num): - return self.set_xen_file_size(num) - - def set_xen_ram(self,num): + def set_virt_ram(self,num): """ - For Xen only. - Specifies the size of the Xen RAM in MB. + For Virt only. + Specifies the size of the Virt RAM in MB. 0 tells Koan to just choose a reasonable default. """ # num is a non-negative integer (0 means default) try: inum = int(num) if inum != float(num): - return cexceptions.CobblerException("exc_xen_ram") + return cexceptions.CobblerException("exc_virt_ram") if inum >= 0: - self.xen_ram = inum + self.virt_ram = inum return True - return cexceptions.CobblerException("exc_xen_ram") + return cexceptions.CobblerException("exc_virt_ram") except: - return cexceptions.CobblerException("exc_xen_ram") - - def set_virt_ram(self,num): - return self.set_xen_ram(num) + return cexceptions.CobblerException("exc_virt_ram") - def set_xen_paravirt(self,truthiness): + def set_virt_paravirt(self,truthiness): """ - For Xen only. + For Virt only. Specifies whether the system is a paravirtualized system or not. For ordinary computers, you want to pick 'true'. Method accepts string 'true'/'false' in all cases, or Python True/False. @@ -154,22 +154,19 @@ class Profile(item.Item): # the string "foosball" is True, and that is not a valid argument for this function try: if (not truthiness or truthiness.lower() == 'false'): - self.xen_paravirt = False + self.virt_paravirt = False elif (truthiness or truthiness.lower() == 'true'): - self.xen_paravirt = True + self.virt_paravirt = True else: - return cexceptions.CobblerException("exc_xen_para") + return cexceptions.CobblerException("exc_virt_para") except: - return cexceptions.CobblerException("exc_xen_para") + return cexceptions.CobblerException("exc_virt_para") return True - def set_virt_paravirt(self,truthiness): - return self.set_xen_paravirt(truthiness) - def is_valid(self): """ A profile only needs a name and a distro. Kickstart info, - as well as Xen info, are optional. (Though I would say provisioning + as well as Virt info, are optional. (Though I would say provisioning without a kickstart is *usually* not a good idea). """ for x in (self.name, self.distro): @@ -182,15 +179,15 @@ class Profile(item.Item): Return hash representation for the serializer """ return { - 'name' : self.name, - 'distro' : self.distro, - 'kickstart' : self.kickstart, - 'kernel_options' : self.kernel_options, - 'xen_name' : self.xen_name, - 'xen_file_size' : self.xen_file_size, - 'xen_ram' : self.xen_ram, - 'xen_paravirt' : self.xen_paravirt, - 'ks_meta' : self.ks_meta + 'name' : self.name, + 'distro' : self.distro, + 'kickstart' : self.kickstart, + 'kernel_options' : self.kernel_options, + 'virt_name' : self.virt_name, + 'virt_file_size' : self.virt_file_size, + 'virt_ram' : self.virt_ram, + 'virt_paravirt' : self.virt_paravirt, + 'ks_meta' : self.ks_meta } def printable(self,id): @@ -202,9 +199,9 @@ class Profile(item.Item): buf = buf + "kickstart : %s\n" % self.kickstart buf = buf + "kernel options : %s\n" % self.kernel_options buf = buf + "ks metadata : %s\n" % self.ks_meta - buf = buf + "xen name : %s\n" % self.xen_name - buf = buf + "xen file size : %s\n" % self.xen_file_size - buf = buf + "xen ram : %s\n" % self.xen_ram - buf = buf + "xen paravirt : %s\n" % self.xen_paravirt + buf = buf + "virt name : %s\n" % self.virt_name + buf = buf + "virt file size : %s\n" % self.virt_file_size + buf = buf + "virt ram : %s\n" % self.virt_ram + buf = buf + "virt paravirt : %s\n" % self.virt_paravirt return buf |