Difference between revisions of "XCP PV templates start"

From Xen
(eliloader)
Line 1: Line 1:
  +
{{TODO|Has this been implemented? If so, it should be moved to Designs in the XAPI Devel Index}}
  +
 
When virtual machine is created by command <code>xe vm-install template=... new-name-label=...</code> and templates of linux system used (like Ubuntu, Debian, CentOS, RHEL, SUSE and so on), following steps occur:
 
When virtual machine is created by command <code>xe vm-install template=... new-name-label=...</code> and templates of linux system used (like Ubuntu, Debian, CentOS, RHEL, SUSE and so on), following steps occur:
   
Line 33: Line 35:
 
Note the last line: set back to pygrub to avoid endless installation.
 
Note the last line: set back to pygrub to avoid endless installation.
   
[[Category: XCP]]
+
[[Category:XAPI Devel]]

Revision as of 13:06, 11 July 2013

Icon todo.png To Do:

Has this been implemented? If so, it should be moved to Designs in the XAPI Devel Index


When virtual machine is created by command xe vm-install template=... new-name-label=... and templates of linux system used (like Ubuntu, Debian, CentOS, RHEL, SUSE and so on), following steps occur:

  1. XCP clones virtual machine (templates is VMs but with flag is-a-template=true)
  2. It process 'disks' record from other-config (sample is self-descriptive:

disks: <provision><disk device="0" size="8589934592" sr="" bootable="true" type="system"/></provision>) and creates required disks.

  1. After user configure VM (adds network interfaces and sets install-repository to correct value) and starts it, it run specified PV-bootloader - eliloader.
  2. And here template specific starts...

eliloader

Eliloader is python script located in /usr/bin/eliloader. It allows XCP to download network installation images (kernel and overgrown initrd) for specified operating system (actual network image is really differ in suse, centos and debian systems). For some legacy and antique systems (like RHEL 4) it to some patching of initrd. Exact path is constructed from type of template (install-distro in other-config) and url, provided by used in other-config: install-repository). After initrd and kernel is extracted they are used as kernel and initrd for virtual machine (and installation started).

Right after successful VM start PV-bootloader is replaced from eliloader to pygrub (to boot to new VM native kernel). Of course, if user stops installation process, at next startup there will be no kernel and vm will not start again.

installation restart

For installation restart PV-bootloader can be set back to eliloader (xe vm-param-set uuid=... PV-bootloader=eliloader), after that installation can be restarted again.

Eliloader replacement

The main problem of eliloader is large initrd, tranferred via internet (or other network). This can be sometimes annoying and can be solved by using pre-downloaded initrd. This will not works for older systems (like RHEL4) which require patching of initrd, but works fine for modern version of ubuntu, opensuse (suse too, I hope), debian. Those files must be placed in /boot/guest directory on every host of the pool (don't forget to check if enough free space is available!).

Here sample for Debian 6 (squeezy), 64 bits:

cd /boot/guest
mkdir squeezy64-install
cd squeezy64-install
wget http://mirror.yandex.ru/debian/dists/Debian6.0.3/main/installer-amd64/current/images/netboot/xen/vmlinuz
wget http://mirror.yandex.ru/debian/dists/Debian6.0.3/main/installer-amd64/current/images/netboot/xen/initrd.gz
(vm-install and vif creating skipped)
xe vm-param-set uuid=... PV-bootloader=
xe vm-param-set uuid=... PV-kernel=/boot/guest/squeezy64/vmlinuz
xe vm-param-set uuid=... PV-ramdisk=/boot/guest/squeezy64/initrd.gz
xe vm-start uuid=...
xe vm-param-set uuid=... PV-bootloader=pygrub

Note the last line: set back to pygrub to avoid endless installation.