Giter VIP home page Giter VIP logo

koan's Introduction

Cobbler

Publish Python distributions to TestPyPI PyPI version PyPI - Downloads Documentation Status Matrix Codacy Badge Codacy Badge Asciinema

Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between lots of various commands and applications when rolling out new systems, and, in some cases, changing existing ones. It can help with installation, DNS, DHCP, package updates, power management, configuration management orchestration, and much more.

asciicast

Read more at https://cobbler.github.io

To view the man-pages, install the RPM and run man cobbler or run perldoc cobbler.pod from a source checkout.

To build the RPM, run make rpms. Developers, try make webtest to do a local make install that preserves your configuration.

If you want to contribute you may find more information under CONTRIBUTING.md.

The documentation can be found at Readthedocs

koan's People

Contributors

awiddersheim avatar brejoc avatar cbosdo avatar chutzimir avatar conan-kudo avatar dblommesteijn avatar geliwei avatar jdobes avatar jmaas avatar mcalmer avatar nodeg avatar opoplawski avatar schoolguy avatar tiltingpenguin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koan's Issues

ethtool: installation error with pip

I tried to install Koan in a new virtualenv with pip an got the following error:

$ pip install .
Processing /home/dom/git/work/koan
Collecting simplejson 
  Using cached simplejson-3.17.2-cp38-cp38-manylinux2010_x86_64.whl (137 kB)
Collecting ethtool 
  Using cached ethtool-0.14.tar.gz (43 kB)
Collecting distro
Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB) 
Collecting libvirt-python                                                              
  Downloading libvirt-python-6.7.0.tar.gz (208 kB)
     |████████████████████████████████| 208 kB 1.9 MB/s 
Collecting netifaces
  Using cached netifaces-0.10.9.tar.gz (28 kB)
Building wheels for collected packages: koan, ethtool, libvirt-python, netifaces
  Building wheel for koan (setup.py) ... done
  Created wheel for koan: filename=koan-2.9.0-py3-none-any.whl size=51724 sha256=21af52b161b6af4a41c1af556c882482fbfe5e4b4fbc759c4ff429358734beb7
  Stored in directory: /tmp/pip-ephem-wheel-cache-glb0z8yq/wheels/de/04/68/adfc75a7be69e46c5850caa92cee335cce584962e4e94b884d
  Building wheel for ethtool (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/dom/git/work/koan/koan/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j_fep18l/ethtool/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j_fep18l/ethtool/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil
e(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-b8j9cwy3      
       cwd: /tmp/pip-install-j_fep18l/ethtool/                                                                                                                                
  Complete output (5 lines):                                                           
  running bdist_wheel
  running build            
  running build_ext      
  building 'ethtool' extension
  Failed to query pkg-config --cflags-only-I libnl-3.0
  ----------------------------------------
  ERROR: Failed building wheel for ethtool
  Running setup.py clean for ethtool
  Building wheel for libvirt-python (setup.py) ... \done
  Created wheel for libvirt-python: filename=libvirt_python-6.7.0-cp38-cp38-linux_x86_64.whl size=563649 sha256=9dafd273fd8191fd761b8e5a9c0466b359f398a37618195775d7f847380d7c69
  Stored in directory: /home/dom/.cache/pip/wheels/da/7b/3a/99528db6aa9d79280536e28df7453a932ffca5daf7f29098fc
  Building wheel for netifaces (setup.py) ... done
  Created wheel for netifaces: filename=netifaces-0.10.9-cp38-cp38-linux_x86_64.whl size=36885 sha256=4499fa68b3520db6b1d0aa8a6151943cfad95e812ae79761f5d9ad7aa9463f7f
  Stored in directory: /home/dom/.cache/pip/wheels/9b/51/d5/d4682860392414da28ba3c5ffac0243983399b868a9cced6df
Successfully built koan libvirt-python netifaces
Failed to build ethtool
DEPRECATION: Could not build wheels for ethtool which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this fun
ctionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: simplejson, ethtool, distro, libvirt-python, netifaces, koan
    Running setup.py install for ethtool ... error
    ERROR: Command errored out with exit status 1:
     command: /home/dom/git/work/koan/koan/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j_fep18l/ethtool/setup.py'"'"'; __file__='"
'"'/tmp/pip-install-j_fep18l/ethtool/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(comp
ile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-12ctznix/install-record.txt --single-version-externally-managed --compile --install-headers /home/dom/g
it/work/koan/koan/include/site/python3.8/ethtool
         cwd: /tmp/pip-install-j_fep18l/ethtool/
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'ethtool' extension
    Failed to query pkg-config --cflags-only-I libnl-3.0
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/dom/git/work/koan/koan/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j_fep18l/e
thtool/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j_fep18l/ethtool/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-12ctznix/install-record.txt --single-version-externally-managed --comp
ile --install-headers /home/dom/git/work/koan/koan/include/site/python3.8/ethtool Check the logs for full command output.

When looking to the official GitHub page of ethtool the maintainers recommend using netifaces instead:

This is the new upstream for python-ethtool maintained by Fedora's Python SIG. We ported it to Python 3 and only maintain it for the current tools to keep working. No new development is happening. This is a deprecated package. If you are considering to start using this, please don't. We recommend netifaces instead.

Koan has netifaces already as installation requirement, but still lists ethtool. When I remove this requirement the installation is successfull.

$ pip install .
Processing /home/dom/git/work/koan
Requirement already satisfied: simplejson in ./koan/lib64/python3.8/site-packages (from koan==2.9.0) (3.17.2)
Collecting distro
  Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB)
Processing /home/dom/.cache/pip/wheels/da/7b/3a/99528db6aa9d79280536e28df7453a932ffca5daf7f29098fc/libvirt_python-6.7.0-cp38-cp38-linux_x86_64.whl
Processing /home/dom/.cache/pip/wheels/9b/51/d5/d4682860392414da28ba3c5ffac0243983399b868a9cced6df/netifaces-0.10.9-cp38-cp38-linux_x86_64.whl
Building wheels for collected packages: koan
  Building wheel for koan (setup.py) ... done
  Created wheel for koan: filename=koan-2.9.0-py3-none-any.whl size=51717 sha256=27c37c389ea0aa47d56405ec980902bd0888bb710fd4d961451d778ec703d63c
  Stored in directory: /tmp/pip-ephem-wheel-cache-jfectac_/wheels/de/04/68/adfc75a7be69e46c5850caa92cee335cce584962e4e94b884d
Successfully built koan
Installing collected packages: distro, libvirt-python, netifaces, koan
Successfully installed distro-1.5.0 koan-2.9.0 libvirt-python-6.7.0 netifaces-0.10.9

According to

koan/koan/utils.py

Lines 33 to 37 in f6f6272

try: # python 2
import urllib2
import xmlrpclib
import ethtool
removing ethtoolbreaks the Python2 compatibility, though.

Koan Error unexpected keyword argument 'virt_pxe_boot'

I am testing Automated Build using Koan and Cobbler on RHEL 7.1. I am facing a problem while building a virtual instance on ESXi using Koan. Following are some details about the setup I am using. All these are on the same RHEL 7.1 server.

Cobbler Version : 2.6.7 (Distro/Profile/System created through Cobbler Web GUI.)
Koan Version : 2.6.7 (I use koan command with Cobbler system name.)
Python Version : 2.7.5

I am facing an issue executing following command. Please see the logs below.

[root@cobbler2 ~]# koan --server=localhost --port=80 --system=minimal2 --virt --virt-type=vmware

  • looking for Cobbler at http://localhost:80/cobbler_api
  • reading URL: http://localhost/cblr/svc/op/ks/system/minimal2
    install_tree: http://192.168.6.89/cblr/links/rhel7.1-x86_64
  • ['virt-install', '--version']
    1.1.0
  • ['virt-install', '--os-variant', 'list']
    WARNING KVM acceleration not available, using 'qemu'
    ERROR
    --name is required
    --memory amount in MiB is required
    --disk storage must be specified (override with --nodisks)
    An install method must be specified
    (--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
    <type 'exceptions.TypeError'>
    start_install() got an unexpected keyword argument 'virt_pxe_boot'
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 274, in main
    k.run()
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 424, in run
    self.virt()
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 843, in virt
    return self.net_install(after_download)
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 670, in net_install
    after_download(self, profile_data)
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 841, in after_download
    self.virt_net_install(profile_data)
    File "/usr/lib/python2.7/site-packages/koan/app.py", line 1513, in virt_net_install
    osimport = self.virtinstall_osimport,

[root@cobbler2 ~]#

This works perfectly fine with Koan Version 2.2.2 installed on another machine. See the logs below.

[root@CobblerServerG1 ~]# koan --server=192.168.6.89 --port=80 --system=minimal2 --virt --virt-type=vmware

I checked the difference in /usr/lib/python2.x/site-packages/koan/app.py file of 2 different koan versions and it seems that there is a new parameter added in the app.py of koan 2.6.7. See the screenshot below. Can someone please tell me how to fix this ? I would highly appreciate it.

Koan 2.6.7 params

DISPLAY_PARAMS = [
"name",
"distro","profile",
"kickstart","ks_meta",
"install_tree","kernel","initrd",
"netboot_enabled",
"kernel_options",
"repos",
"virt_ram",
"virt_disk",
"virt_disk_driver",
"virt_type",
"virt_path",
"virt_auto_boot",
"virt_pxe_boot",
]

Koan 2.2.2 params

DISPLAY_PARAMS = [
"name",
"distro","profile",
"kickstart","ks_meta",
"install_tree","kernel","initrd",
"netboot_enabled",
"kernel_options",
"repos",
"virt_ram",
"virt_disk",
"virt_disk_driver",
"virt_type",
"virt_path",
"virt_auto_boot",
]

Thanks,
Hrishikesh

Issues with semanage

First off, I'm wondering if semanage and setting the context of the device or image files is necessary anymore. But at least with CentOS 8.0, semanage is starting to return with an error for already defined contexts:

/usr/bin/chcon -t virt_image_t /dev/mapper/vg_nvme-vmub16--disk0
/usr/sbin/semanage fcontext -a -t virt_image_t /dev/mapper/vg_nvme-vmub16--disk0
ValueError: File context for /dev/mapper/vg_nvme-vmub16--disk0 already defined
SELinux security context setting to LVM partition failed

Port Travis configuration to GH Actions

Currently we are not using GH Actions because there was not time. Since I now need to fix another bug this is required to make sure it doesn't break things.

Cobbler-register report error when register system

run command:
Cobbler-register --server=10.238.206.247 --profile=centos7 -f=233

already installed ethtool

error message:
the rhpl or ethtool module is required to use this feature( is your OS>=EL3?)

koan --update-config ??

Looking into the CMS part of cobbler right now. Running two physical servers, both Scientifc Linux 6.3 (64bit), cobbler commit 8388a2a660.
My client seems to be able to communicate w/ the server:

[root@test1 tmp]# koan --server=10.2.9.7 --display --system=test1
- looking for Cobbler at http://10.2.9.7:80/cobbler_api
- reading URL: http://10.2.9.7/cblr/svc/op/ks/system/test1
  install_tree: http://10.2.9.7/cblr/links/SL6.3-x86_64
              name  : test1
            distro  : SL6.3-x86_64
           profile  : pdaq-machine1
         kickstart  : http://10.2.9.7/cblr/svc/op/ks/system/test1
           ks_meta  : tree=http://@@http_server@@/cblr/links/SL6.3-x86_64 pdaq_pkg_group=@Emacs 
      install_tree  : http://10.2.9.7/cblr/links/SL6.3-x86_64
            kernel  : /var/www/cobbler/ks_mirror/SL6.3-x86_64/images/pxeboot/vmlinuz
            initrd  : /var/www/cobbler/ks_mirror/SL6.3-x86_64/images/pxeboot/initrd.img
   netboot_enabled  : True
    kernel_options  : ks=http://10.2.9.7/cblr/svc/op/ks/system/test1 ksdevice=link kssendmac lang= text 
             repos  : Dell
          virt_ram  : 512
  virt_disk_driver  : raw
         virt_type  : xenpv
         virt_path  : 
    virt_auto_boot  : 0
     virt_pxe_boot  : 0
  [root@test1 tmp]# 

but I can't do any updates:

[root@test1 tmp]# koan --server=10.2.9.7 --update-config
- looking for Cobbler at http://10.2.9.7:80/cobbler_api
- Auto detected: test1
  Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/koan/app.py", line 869, in update_config
    config = server.get_config_data(hostname)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in **call**
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
  Fault: <Fault 1: "<type 'exceptions.AttributeError'>:'NoneType' object has no attribute 'get_parent'">
  Could not communicate with 10.2.9.7:None

Any idea what might be going wrong here?

Thanks much!

Add support for Open vSwitch bridges used in libvirt interfaces to Koan

I replaced my Linux bridge with Open vSwitch because of some technical limitations of Linux bridges.

I was able to configure libvirt to deal with this, following these instructions.

Note that I also removed and blacklisted the bridge kernel module, as well as the bridge-utils package containing the brctl command because calling the brctl command loads the bridge kernel module which breaks Open vSwitch.
In other words: classic Linux bridging is no longer in any way available on my machine.

This works when manually creating virtual machines with virt-install, when using the following network options:

virt-install --network network=br0

When I create a machine with Koan, however, it is created with:

virt-install --network bridge=br0

Which fails with the following error:

ERROR    Unable to add bridge br0 port vnet1: Operation not supported
Domain installation does not appear to have been successful.

Koan does not appear to support passing this option to virt-install at the moment.

My technical environment: CentOS 6.4 as both virtual guest and host OS. KVM virtualization, Open vSwitch package procured from the RDO repository.

koan: Error with --update-files: curl: option --output : is unknown

Received the following error when using koan --update-files (ip and hostname modified below):

# koan --update-files
- looking for Cobbler at http://<ip>:80/cobbler_api
- Auto detected: <hostname>
- template map: {'/var/lib/cobbler/templates/pdit_ntp_conf.template': '/etc/ntp.conf'}
- processing for files to download...
- file: /etc/ntp.conf
- ['/usr/bin/curl', 'http://<ip>/cblr/svc/op/template/system/<hostname>/path/_etc_ntp.conf', '--output ', '/etc/ntp.conf']
curl: option --output : is unknown
curl: try 'curl --help' or 'curl --manual' for more information
command failed (2)

Confirmed that curl works fine by running the command manually. The template was properly rendered.

The version of koan:

# rpm -q koan
koan-2.6.11-7.1.noarch

The system is OracleLinux 7.2 which is binary compatible with RHEL 7.2

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

RFE: Support LVM thin provisioning

koan checks to see if there is free space in the volume group before proceeding and fails if there isn't, e.g.:

volume group needs 10 GB free space.

This can fail improperly in two situations - if the LV already exists, or if one is using thin provisioning and all space is allocated to the thin pool (although the only way to currently make use of thin provisioning is to create the needed LV before running koan).

At least as a first step, I think we should just remove the space check entirely and rely on errors from LVM if there is not enough space. Longer term it would be good to support the needed thin provisioning options.

koan can't get port for profile

cobbler server change port to 10080,use below command fail to get URL for profile.Should add http_port to URL path.

command:
koan --server=192.168.10.112 --port 10080 --virt --virt-name=main5 --virt-bridge=br0 --profile=centos7.4-x86_64

error message:

[root@www ~]# koan --server=192.168.10.112 --port 10080 --virt --virt-name=main5   --virt-bridge=br0  --profile=centos7.4-x86_64
- looking for Cobbler at http://192.168.10.112:10080/cobbler_api
- reading URL: http://192.168.10.112/cblr/svc/op/ks/profile/centos7.4-x86_64
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/koan/utils.py", line 125, in urlread
    fd = urllib2.urlopen(url)
  File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 1244, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.7/urllib2.py", line 1214, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused>
- ['/usr/bin/virt-install', '--version']
- ['virt-install', '--version']
- ['virt-install', '--os-variant', 'list']
- ['osinfo-query', '-f', 'short-id', 'os']
Cannot find install source in kickstart file, aborting.

Koan-V3.0.1 is not compatible with Cobbler-V3.2.2

It seems that Koan-V3.0.1 is not compatible with Cobbler-V3.2.2, for example:

  1. autoinst does not exist in xmlrpc return (see bellow profile data)
  2. ks_meta has been renamed to autoinstall_meta
  3. kickstart has been renamed to autoinstall

https://github.com/cobbler/cobbler/blob/d6fa0b14051fcd0cd7c6d562c5d56eeca0422f44/scripts/migrate-data-v2-to-v3.py#L96
image

Cobbler-V3.2.2 profile data

{'allow_duplicate_hostnames': True,
 'allow_duplicate_ips': False,
 'allow_duplicate_macs': False,
 'allow_dynamic_settings': True,
 'always_write_dhcp_entries': False,
 'anamon_enabled': False,
 'arch': 'x86_64',
 'auth_token_expiration': 3600,
 'authn_pam_service': 'login',
 'autoinstall': 'sample.ks',
 'autoinstall_meta': 'tree=http://@@http_server@@/cblr/links/centos-7.9-x86_64 ',
 'autoinstall_snippets_dir': '/var/lib/cobbler/snippets',
 'autoinstall_templates_dir': '/var/lib/cobbler/templates',
 'bind_chroot_path': '',
 'bind_manage_ipmi': False,
 'bind_master': '127.0.0.1',
 'boot_files': '',
 'boot_loader': 'grub',
 'boot_loader_conf_template_dir': '/etc/cobbler/boot_loader_conf',
 'bootloaders_dir': '/var/lib/cobbler/loaders',
 'breed': 'redhat',
 'build_reporting_email': ['root@localhost'],
 'build_reporting_enabled': False,
 'build_reporting_ignorelist': [],
 'build_reporting_sender': '',
 'build_reporting_smtp_server': 'localhost',
 'build_reporting_subject': '',
 'buildisodir': '/var/cache/cobbler/buildiso',
 'cache_enabled': True,
 'cheetah_import_whitelist': ['random', 're', 'time', 'netaddr'],
 'client_use_https': False,
 'client_use_localhost': True,
 'cobbler_master': '',
 'comment': '',
 'convert_server_to_ip': True,
 'createrepo_flags': '-c cache -s sha',
 'ctime': 1644779073.024603,
 'default_autoinstall': '/var/lib/cobbler/templates/default.ks',
 'default_name_servers': [],
 'default_name_servers_search': [],
 'default_ownership': ['admin'],
 'default_password_crypted': '$1$tId2Jrra$iauZ8XrO0wzGoEW26qZ2w1',
 'default_template_type': 'cheetah',
 'default_virt_bridge': 'xenbr0',
 'default_virt_disk_driver': 'raw',
 'default_virt_file_size': 5,
 'default_virt_ram': 512,
 'default_virt_type': 'xenpv',
 'depth': 1,
 'dhcp_tag': 'default',
 'distro': 'centos-7.9-x86_64',
 'distro_name': 'centos-7.9-x86_64',
 'enable_gpxe': True,
 'enable_menu': True,
 'fetchable_files': '',
 'grubconfig_dir': '/var/lib/cobbler/grub_config',
 'http_port': 80,
 'http_server': '10.255.101.101',
 'include': ['/etc/cobbler/settings.d/*.settings'],
 'initrd': '/var/www/cobbler/distro_mirror/centos-7.9-x86_64/images/pxeboot/initrd.img',
 'iso_template_dir': '/etc/cobbler/iso',
 'jinja2_includedir': '/var/lib/cobbler/jinja2',
 'kernel': '/var/www/cobbler/distro_mirror/centos-7.9-x86_64/images/pxeboot/vmlinuz',
 'kernel_options': '',
 'kernel_options_post': '',
 'kickstart': 'sample.ks',
 'ks_meta': {'tree': 'http://@@http_server@@/cblr/links/centos-7.9-x86_64'},
 'ldap_anonymous_bind': True,
 'ldap_base_dn': 'DC=example,DC=com',
 'ldap_port': 389,
 'ldap_search_bind_dn': '',
 'ldap_search_passwd': '',
 'ldap_search_prefix': 'uid=',
 'ldap_server': 'ldap.example.com',
 'ldap_tls': True,
 'ldap_tls_cacertfile': '',
 'ldap_tls_certfile': '',
 'ldap_tls_keyfile': '',
 'manage_dhcp': True,
 'manage_dns': False,
 'manage_forward_zones': [],
 'manage_genders': False,
 'manage_reverse_zones': [],
 'manage_rsync': True,
 'manage_tftpd': True,
 'mgmt_classes': [],
 'mgmt_parameters': {'from_cobbler': True,
                     'tree': 'http://@@http_server@@/cblr/links/centos-7.9-x86_64'},
 'mtime': 1644779073.024603,
 'name': 'centos-7.9-x86_64',
 'name_servers': [],
 'name_servers_search': [],
 'next_server': '10.255.101.101',
 'nopxe_with_triggers': True,
 'nsupdate_enabled': False,
 'nsupdate_log': '/var/log/cobbler/nsupdate.log',
 'nsupdate_tsig_algorithm': 'hmac-sha512',
 'nsupdate_tsig_key': [],
 'os_version': 'rhel7',
 'owners': ['admin'],
 'parent': '',
 'power_management_default_type': 'ipmilan',
 'profile_name': 'centos-7.9-x86_64',
 'proxy': '',
 'proxy_url_ext': '',
 'proxy_url_int': '',
 'puppet_auto_setup': False,
 'puppet_parameterized_classes': True,
 'puppet_server': '',
 'puppet_version': 2,
 'puppetca_path': '/usr/bin/puppet',
 'pxe_just_once': True,
 'redhat_management_key': '',
 'redhat_management_permissive': False,
 'redhat_management_server': 'xmlrpc.rhn.redhat.com',
 'register_new_installs': False,
 'remote_boot_initrd': '~',
 'remote_boot_kernel': '~',
 'remove_old_puppet_certs_automatically': False,
 'replicate_repo_rsync_options': '-avzH',
 'replicate_rsync_options': '-avzH',
 'repo_data': [],
 'repos': '',
 'reposync_flags': '-l -n -d',
 'reposync_rsync_flags': '-rltDv --copy-unsafe-links',
 'restart_dhcp': True,
 'restart_dns': True,
 'run_install_triggers': True,
 'scm_push_script': '/bin/true',
 'scm_track_author': 'cobbler <cobbler@localhost>',
 'scm_track_enabled': False,
 'scm_track_mode': 'git',
 'serializer_pretty_json': False,
 'server': '10.255.101.101',
 'sign_puppet_certs_automatically': False,
 'signature_path': '/var/lib/cobbler/distro_signatures.json',
 'signature_url': 'https://cobbler.github.io/signatures/3.0.x/latest.json',
 'source_repos': [['http://@@http_server@@/cobbler/distro_mirror/config/centos-7.9-x86_64-0.repo',
                   'http://@@http_server@@/cobbler/distro_mirror/centos-7.9-x86_64']],
 'template_files': '',
 'tftpboot_location': '/var/lib/tftpboot',
 'tree_build_time': 0,
 'uid': 'b4b26756754c4da1bd5709cc352159d8',
 'virt_auto_boot': True,
 'virt_bridge': 'xenbr0',
 'virt_cpus': 1,
 'virt_disk_driver': 'raw',
 'virt_file_size': 5,
 'virt_path': '',
 'virt_ram': 512,
 'virt_type': 'kvm',
 'webdir': '/var/www/cobbler',
 'webdir_whitelist': ['misc',
                      'web',
                      'webui',
                      'localmirror',
                      'repo_mirror',
                      'distro_mirror',
                      'images',
                      'links',
                      'pub',
                      'repo_profile',
                      'repo_system',
                      'svc',
                      'rendered',
                      '.link_cache'],
 'xmlrpc_port': 25151,
 'yum_distro_priority': 1,
 'yum_post_install_mirror': True,
 'yumdownloader_flags': '--resolve'}

Ability to set virt NIC model

We've got a bunch of VMs running under kvm/libvirt with CentOS 5.5 guest OS that drop packets using the default realtek driver, but work fine using virtio. Right now this is a manual libvirt change after cobbler/koan install.

It would be great if this setting (it's the element in the section of the libvirt XML) was exposed via koan and cobbler, so it could be set correctly at install time instead of a manual hack.

Undecipherable error when trying to koan

Trying to create a VM with koan:

➜ ~ git:(master) ✗ sudo koan --virt --profile=SLES-11-SP3-x86_64 --server=172.17.0.4
looking for Cobbler at http://172.17.0.4:80/cobbler_api
['rpm', '-q', 'virt-install']
<type 'exceptions.OSError'>
[Errno 2] No such file or directory
File "/usr/lib/python2.7/dist-packages/koan/app.py", line 274, in main
k.run()
File "/usr/lib/python2.7/dist-packages/koan/app.py", line 424, in run
self.virt()
File "/usr/lib/python2.7/dist-packages/koan/app.py", line 813, in virt
return self.net_install(after_download)
File "/usr/lib/python2.7/dist-packages/koan/app.py", line 634, in net_install
rc, version_str = utils.subprocess_get_response(shlex.split('rpm -q virt-install'), True)
File "/usr/lib/python2.7/dist-packages/koan/utils.py", line 184, in subprocess_get_response
p = sub_process.Popen(cmd, stdout=sub_process.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception

Before I delve deeper into the code, where can I find a more detailed error log?

From /var/log/cobbler.log I see:

Thu Jan 28 03:05:49 2016 - INFO | REMOTE get_profile_as_rendered; user(?); name(SLES-11-SP3-x86_64)

cobbler check reports:

[ root@d815889bfc31:~ ]$ cobbler check
The following are potential configuration items that you may want to fix:

1 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a recent version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.

Restart cobblerd and then run 'cobbler sync' to apply changes.

cobbler_web works fine

Issue: virt-install check fails on version 0.10.0

Today i performed an install with Centos 7.1406, installed a libvirt/kvm host and installed koan from epel7 (issue occurs with repo's from cobbler website as well)

When i give command:

koan --server=cobbler --system=random_VM --virt

Following error occurs:

- ['/usr/bin/virt-install', '--version']
need python-virtinst >= 0.2 or virt-install package to do installs for qemu/kvm (depending on your OS)

Installed versions:

3.10.0-123.20.1.el7.x86_64
koan-2.6.7-13.1.noarch

virsh version:

Compiled against library: libvirt 1.1.1
Using library: libvirt 1.1.1
Using API: QEMU 1.1.1
Running hypervisor: QEMU 2.0.0
 virt-install --version
0.10.0

When uncommenting section related to this:

if rc != 0 or re.match('^0\.[01]\..*', version_str):

The virtual machine starts and kickstarts without any issue.

Issue is reproducable every time.

Koan + Ovirt

Greetings,
OS: Scientific Linux 7.3
oVirt: 4.1.6.2-1.el7.centos
Cobbler: 2.8.1 (EPEL)
Koan: 2.8.1 (EPEL)

I'm having issues getting Koan to play nicely with oVirt. Unfortunately, most of the links I'm finding are dead. I reached out to the oVirt mailing list but I did not get a response. I tried to reach out to the Cobbler mailing list, but that's a dead link.

Can someone please point me to where I can find documentation on getting Cobbler + Koan + oVirt to play nicely together?

Thanks!

[Meta] Thought collection of the pre V3.0.0 release review

This list should represent things we do want to possibly do for the next release V3.1.0:

  • setup.py: long_description should be the README.md instead of a custom string
  • init.py: We do want to have a main docstring for the Koan module - currently empty.
  • app.py: Move CLI stuff into own module
  • CLI: optparse --> argparse
  • CLI: Add Version command
  • License: Replace long text with SPDX text
  • Obsolete scripts in bin/
  • Docs: ovz-install
  • Reasonable defaults instead of just none in app.py
  • Check custom exceptions and maybe remove some of them
  • Check and document optional dependencies
  • Docs: Update and consolidate
  • Code organization: Move *-create.py into submodule and shorten filenames
  • Pacakging: maybe create subpackages to not install all virt types
  • Check if register script is also available in Cobbler
  • Check utils.py for obsolete stuff
  • Tests: Raise coverage at least to 20%
  • Packaging: native Debian

Problem reporting error with virt-install

virt-install was failing because of an undefined bridge interface, but koan produces a traceback trying to report the error:

<class 'ValueError'>
unsupported format character '[' (0x5b) at index 155
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 372, in main
    k.run()
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 526, in run
    self.virt()
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 922, in virt
    return self.net_install(after_download)
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 787, in net_install
    after_download(self, profile_data)
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 920, in after_download
    self.virt_net_install(profile_data)
  File "/usr/lib/python3.6/site-packages/koan/app.py", line 1621, in virt_net_install
    osimport=self.virtinstall_osimport,
  File "/usr/lib/python3.6/site-packages/koan/qcreate.py", line 35, in start_install
    raise utils.InfoException("command failed (%s): %s %s" % (rc, result, result_stderr))
  File "/usr/lib/python3.6/site-packages/koan/cexceptions.py", line 50, in __init__
    self.value = value % args

I get the feeling that InfoException was meant to be called like:

  raise utils.InfoException("command failed (%s): %s %s" , (rc, result, result_stderr))

but that doesn't look like that is how it is called anywhere. Time to just drop the whole args option?

Also, none of KoanException, KX, or FileNotFoundException seem to be used as near as I can tell.

Improve the CI

Before the release V3.0.0 we need to improve the CI in the following ways:

  • Add package builds for:
    • CentOS 8
    • Fedora 34
    • openSUSE Leap 15.3
    • openSUSE Tumbleweed
  • Add TestPyPi & PyPi CD

Need to support both cobbler 2 and cobbler 3

I think we need to be able to support loading data from either cobbler 3 or cobbler 2, which I think primarily means being able to fall back to 'kickstart' from 'autoinst' if 'autoinst' isn't present on the server. Not sure what the best was to do this is.

koan: Allow alternate source for kernel/initrd than kickstart install URL

I like to test out Fedora staged install images with koan. However I'm not able to get this quite right. Currently I set:

  • initrd: /data/repos/fedora/stage/20-Alpha-RC1/Fedora/x86_64/os/images/pxeboot/initrd.img
  • kernel: /data/repos/fedora/stage/20-Alpha-RC1/Fedora/x86_64/os/images/pxeboot/vmlinuz
  • kernel_options : ksdevice=bootif lang= nokill text kssendmac inst.stage2=http://fedstage.cora.nwra.com/20-Alpha-RC1/Fedora/x86_64/os
  • ks_meta : tree=http://fedora.cora.nwra.com/development/20/x86_64/os

I need to use the development url for the tree in order to get the packages (the staged images only have the kernel/initrd/installer-image.

So, would it be possible to have koan retrieve the kernel/initrd directly from cobbler or from the inst.stage2 location if given?

koan should wait for a VM to be in VIR_DOMAIN_SHUTOFF state before recreating the domain

When the VM is halted at the end of the installation, koan can restart the VM.
In this case, koan waits until the vm is shutdown and then performs a virsh create for the VM.

I noticed in several occasions that the creation failed with error
`

  • polling for virt completion
  • install is still running, sleeping for 1 minute (0)
  • install is still running, sleeping for 1 minute (1)
  • install is still running, sleeping for 1 minute (2)
  • install is still running, sleeping for 1 minute (3)
  • install is still running, sleeping for 1 minute (4)
  • shutdown VM detected, is the install done? Restarting!
    <class 'libvirt.libvirtError'>
    Requested operation is not valid: domain is already running
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 274, in main
    k.run()
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 424, in run
    self.virt()
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 844, in virt
    return self.net_install(after_download)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 671, in net_install
    after_download(self, profile_data)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 842, in after_download
    self.virt_net_install(profile_data)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 1562, in virt_net_install
    utils.find_vm(conn, virtname).create()
    File "/usr/lib64/python2.6/site-packages/libvirt.py", line 686, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
    `

i think this is caused by the status polling that interprets the domain status VIR_DOMAIN_SHUTDOWN the same as VIR_DOMAIN_SHUTOFF. But VIR_DOMAIN_SHUTDOWN means

the domain is being shut down

And in this state the VM can't be recreated (yet).
This error happens only now and again because the VIR_DOMAIN_SHUTDOWN state is short lived (less than a second in my tests) and the polling interval is 60 seconds.

CentOS release 6.9 (Final)
koan-2.6.11-1.el6.noarch
libvirt-0.10.2-62.el6.x86_64

Merge PyPi workflows

At the moment we have two almost identical workflows for publishing to the different PyPi servers. We do want to unify them to have less duplicated configuration files.

What is the "autoinst" variable in profile_data supposed to be?

There is no "autoinst" entry in the Cobbler profile variables, and so the code in app.py doesn't seem to work correctly. I worked around it by doing the following, but there's no comment indicating what this variable was supposed to be...

@@ -627,30 +627,38 @@ class Koan:
             # fix URLs
             if profile_data["autoinst"][0] == "/":
                 if not self.system:
-                    profile_data["autoinst"] = "http://%s/cblr/svc/op/ks/profile/%s" % (
+                    profile_data["autoinst"] = "http://%s/cblr/svc/op/autoinstall/profile/%s" % (
                         profile_data['http_server'], profile_data['name'])
                 else:
-                    profile_data["autoinst"] = "http://%s/cblr/svc/op/ks/system/%s" % (
+                    profile_data["autoinst"] = "http://%s/cblr/svc/op/autoinstall/system/%s" % (
                         profile_data['http_server'], profile_data['name'])
+        else:
+           if not self.system:
+               profile_data["autoinst"] = "http://%s/cblr/svc/op/autoinstall/profile/%s" % (
+                   profile_data['http_server'], profile_data['name'])
+           else:
+               profile_data["autoinst"] = "http://%s/cblr/svc/op/autoinstall/system/%s" % (
+                   profile_data['http_server'], profile_data['name'])
+
+
+        # If breed is ubuntu/debian we need to source the install tree differently
+        # as preseeds are used instead of kickstarts.
+        if profile_data["breed"] in ["ubuntu", "debian", "suse"]:
+            self.get_install_tree_from_profile_data(profile_data)
+        else:
+            # find_autoinst source tree in the autoinst file
+            self.get_install_tree_from_autoinst(profile_data)

-            # If breed is ubuntu/debian we need to source the install tree differently
-            # as preseeds are used instead of kickstarts.
-            if profile_data["breed"] in ["ubuntu", "debian", "suse"]:
-                self.get_install_tree_from_profile_data(profile_data)
-            else:
-                # find_autoinst source tree in the autoinst file
-                self.get_install_tree_from_autoinst(profile_data)
+        # if we found an install_tree, and we don't have a kernel or initrd
+        # use the ones in the install_tree
+        if self.safe_load(profile_data, "install_tree"):
+            if not self.safe_load(profile_data, "kernel"):
+                profile_data["kernel"] = profile_data[
+                    "install_tree"] + "/images/pxeboot/vmlinuz"

-            # if we found an install_tree, and we don't have a kernel or initrd
-            # use the ones in the install_tree
-            if self.safe_load(profile_data, "install_tree"):
-                if not self.safe_load(profile_data, "kernel"):
-                    profile_data["kernel"] = profile_data[
-                        "install_tree"] + "/images/pxeboot/vmlinuz"
-
-                if not self.safe_load(profile_data, "initrd"):
-                    profile_data["initrd"] = profile_data[
-                        "install_tree"] + "/images/pxeboot/initrd.img"
+            if not self.safe_load(profile_data, "initrd"):
+                profile_data["initrd"] = profile_data[
+                    "install_tree"] + "/images/pxeboot/initrd.img"

         # find the correct file download location
         if not self.is_virt:

Possibly support generic virt-install options?

For debugging a VM Fedora install, I wanted to implement https://fedoraproject.org/wiki/Anaconda/Logging#virt-install which requires adding:

--channel tcp,host=127.0.0.1:6080,mode=connect,target_type=virtio,name=org.fedoraproject.anaconda.log.0

to the virt-install line. Note that the host= argument can change. This seems pretty out of the ordinary, so I'm not sure if a full blown --virtio-anaconda option or some such is warranted. But a --virt-install-opts would be useful as an alternative. Thoughts?

Koan runs extremely slowly since 2.4

Since switching from libvirt-python to virsh in koan 2.4, koan is completely unusable on Centos 6.x. There are no errors or logs that indicate any obvious errors that I can find. The OS installer (also Centos 6) does run, just extremely slowly. Where an install took 5 minutes with koan 2.2, 2.4 and 2.6 take 12+ hours. I have only tested this with KVM and Centos 6x hosts/guests.

Copied from cobbler/#953

Need to add http_port to app.py

Port missing -> http://%s/cblr/svc/op/ks/profile

            if not self.system:
                profile_data["autoinst"] = "http://%s/cblr/svc/op/ks/profile/%s" % (
                    profile_data['http_server'], profile_data['name'])
            else:
                profile_data["autoinst"] = "http://%s/cblr/svc/op/ks/system/%s" % (
                    profile_data['http_server'], profile_data['name'])

passthrough ksdevice=bootif param

Can't get why mangling is needed. User requested bootif, so let it be so.

# cobbler system dumpvars  --name xxx | grep kernel_options
kernel_options : ksdevice=bootif lang=  kssendmac text 

# koan --virt-pxe-boot --system xxx --display
              kernel  : /mirrors/centos/5/os/x86_64/images/pxeboot/vmlinuz
              initrd  : /mirrors/centos/5/os/x86_64/images/pxeboot/initrd.img
     netboot_enabled  : True
      kernel_options  : ks=xx ksdevice=link kssendmac lang= text 
    virt_disk_driver  : raw
           virt_type  : kvm
           virt_path  : fused
      virt_auto_boot  : 1
       virt_pxe_boot  : 1

This code is doing replacement which shouldn't occur:

 1461         # if using ksdevice=bootif that only works for PXE so replace
 1462         # it with something that will work
 1463         options = string.replace(options, "ksdevice=bootif","ksdevice=link")

Thanks.

Add Black formatter

Koan should adhere to the same standards as Cobbler and thus we should add Black.

Current & Max memory setting missing for virtualized hosts

When installing a virtualized host in kvm, the only setting available in cobbler, Virt RAM, is only the maximum memory available to a guest. libvirt/kvm allow a current memory usage setting as well but that one is not possible to configure in cobbler.

Impact: If I need to provision virtual machines with dynamically adjusted memory, I need to set the max in cobbler and then use another too to adjust it and then reboot the vm. This take the provisioning of virtual machines only half way.

Copied from cobbler/cobbler#288

Use towncrier for changelog generation

I want to establish the usage of https://github.com/twisted/towncrier paired with GitHub Actions to enable me to spend less time writing the changelog.

At the moment this process can take hours and I want to save that time and use it to develop meaningful features.

The new release process would be:

  1. Trigger a manual run of the action that creates a PR with the generated changelog.
  2. Accept the opened PR
  3. GH Actions detects this and triggers a run of the action that creates the release.
  4. I manually increase the version to the one that is specified as the next version.

Possible error in code

There are statements introduced by PR #1294 in koan/app.py like:

elif breed == "redhat" and (os_version >= "rhel7" or os_version >= "fedora17"):

However, statement "rhel6" >= "fedora17" is evaluated as True in Python. Am I correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.