Repository: cobbler/cobbler

Issue:
Why my client can't show the Xen option on cobbler's menu?
I installed the cobbler on my virutalhost(with vmware,OS is centos 6.3).
when them install and configure,all completed.
the client can't install the OS with pxe.
but I saw,the cobbler's menu havn't the Xen's option(CentOS-5-xen-i386).

I execute these command:

本帖最后由 zhxd 于 2013-10-28 23:05 编辑

虚拟机上安装了cobbler，cobbler上执行
# cobbler sync

task started: 2013-10-28_223747_sync
task started (id=Sync, time=Mon Oct 28 22:37:47 2013)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS-5-xen-i386
removing: /var/www/cobbler/images/CentOS-5-i386
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/CentOS-5-xen-i386
removing: /var/lib/tftpboot/images/CentOS-5-i386
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: CentOS-5-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-5-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-5-i386/initrd.img
copying files for distro: CentOS-5-xen-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/vmlinuz -> /var/lib/tftpboot/images/CentOS-5-xen-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/initrd.img -> /var/lib/tftpboot/images/CentOS-5-xen-i386/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS-5-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-5-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-5-i386/initrd.img
Writing template files for CentOS-5-i386
copying files for distro: CentOS-5-xen-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/vmlinuz -> /var/www/cobbler/images/CentOS-5-xen-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/initrd.img -> /var/www/cobbler/images/CentOS-5-xen-i386/initrd.img
Writing template files for CentOS-5-xen-i386
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: Shutting down dhcpd: [  OK  ]
Starting dhcpd: [  OK  ]

received on stderr: 
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
**\* TASK COMPLETE ***
# cobbler distro list

   CentOS-5-i386
   CentOS-5-xen-i386
# cobbler distro report

Name                           : CentOS-5-i386
Architecture                   : i386
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS-5-i386/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS-5-i386'}
Management Classes             : []
OS Version                     : rhel5
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

Name                           : CentOS-5-xen-i386
Architecture                   : i386
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS-5-i386/images/xen/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS-5-xen-i386'}
Management Classes             : []
OS Version                     : rhel5
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

the three command can found the xen.

but why my client can't show the xen option(CentOS-5-xen-i386).

Help me,please!

thanks a lot!



Discussion:
I see this in pxegen.py:

```
        # xen distros can be ruled out as they won't boot
        if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
            # can't PXE Xen
            continue
```

I see that:

# xen distros can be ruled out as they won't boot

```
    if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
        # can't PXE Xen
        continue
```

in the /usr/lib/python2.6/site-packages/cobbler/pxegen.py.

what's the mean?
It means I can't see the Xen on the cobbler's menu?
If it isn's this mean,how can I fix it?

Thanks!

At 2013-10-31 00:13:35,"Jörgen Maas" notifications@github.com wrote:

I see this in pxegen.py:

```
    # xen distros can be ruled out as they won't boot
    if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
        # can't PXE Xen
        continue
```

—
Reply to this email directly or view it on GitHub.

Because I test cobbler in virtualhost on VMware.
I don't know vmware support xen,whether or not.
If cobbler supported xen on vmware.
Why there does not display "CentOS-5-xen-i386" option?
whereis my mistake,and how I can fix it?;(

At 2013-10-31 00:28:11,zhxd zhou_xd@126.com wrote:

I see that:

# xen distros can be ruled out as they won't boot

```
    if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
        # can't PXE Xen
        continue
```

in the /usr/lib/python2.6/site-packages/cobbler/pxegen.py.

what's the mean?
It means I can't see the Xen on the cobbler's menu?
If it isn's this mean,how can I fix it?

Thanks!

At 2013-10-31 00:13:35,"Jörgen Maas" notifications@github.com wrote:

I see this in pxegen.py:

```
    # xen distros can be ruled out as they won't boot
    if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
        # can't PXE Xen
        continue
```

—
Reply to this email directly or view it on GitHub.

I don't believe you can boot xen inside a VMware guest, so you probably won't be able to test this way. However, I think that may be unrelated to the issue, because in the past it may have been impossible to PXE boot the xen hypervisor, so it was removed from the list. Again, that may have changed, so we'd need to test it.


Resolving patch:
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -366,10 +366,6 @@ def sort_name(a,b):
                # This profile has been excluded from the menu
                continue
             distro = profile.get_conceptual_parent()
-            # xen distros can be ruled out as they won't boot
-            if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
-                # can't PXE Xen
-                continue
             contents = self.write_pxe_file(filename=None, system=None,
                     profile=profile, distro=distro,
                     arch=distro.arch, include_header=False)


Test patch: