Welcome Guest, Not a member yet? Create Account  




How to build your own VyOS template for XenServer

#1

Hi,

I'm sure every XenServer user remembers very well that once upon a time when Vyatta was released it came along with a preconfigured XenServer template which was very convenient and quick way to get rolling. Then Vyatta discountinued image preparation for free edition but actually it's quite simple to prepare this image yourself and if you tend to have a highly customized environment you may even include some custom settings in the template (like NTP servers, users and passwords etc. but also entire config branches for many services) so that you don't have to configure it manually on each new VM.

I created this manual a while ago and it was even posted on vyatta.org but since it's no longer available, please find this revised guide below. It's tested with VyOS 1.0.4 and XenServer 6.2.

***

1. Start with downloading the ISO file, be sure to download the "virt" version made for virtual environments.

2. Create a new VM in XenServer using "Other install media" template (scroll down the list). Select the VyOS ISO as the installation source. It's enough to assign 512 MB of RAM and 1 vCPU. This is only for the template VM and your actual VM that will be later created based on this template may have other settings. Therefore you also don't need to assign any interfaces. 4 GB disk is enough for the storage.

3. Start the VM and login as vyos/vyos and process with the image installation. It's important to answer "Yes" when setup asks whether to prepare the config files for PV conversion.

Code:
install image

4. Reboot the VM and make sure it boots from the disk (you can unmount the ISO while VM is shut down).

5. Login again and mount XenTools ISO:

Code:
sudo su
mount /dev/cdrom /mnt

6. Now install XenTools:

Code:
/mnt/Linux/install.sh

7. Power off the VM (do not reboot it):

Code:
poweroff

8. Now go to XenServer host console (either via XenCenter or just ssh to the host). We will now convert the VM from HVM to PV.

9. Find the UUID of the template VM and change its boot policy:

Code:
[root@XEN05 ~]# xe vm-list name-label=VyOS_Template
uuid ( RO)           : 6cb4d109-5499-d112-c777-d2a2c8369b39
     name-label ( RW): VYOS_Template
    power-state ( RO): halted

[root@XEN05 ~]# xe vm-param-set uuid=6cb4d109-5499-d112-c777-d2a2c8369b39 HVM-boot-policy=""
[root@XEN05 ~]# xe vm-param-set uuid=6cb4d109-5499-d112-c777-d2a2c8369b39 PV-bootloader=pygrub
[root@XEN05 ~]# xe vm-param-set uuid=6cb4d109-5499-d112-c777-d2a2c8369b39 PV-args="console=hvc0 xencons=hvc"

10. Now find the UUID of the bootable disk's VBD - it's important to grab the identifier of the VBD and not the VDI! Set the VBD as bootable.

Code:
[root@XEN05 ~]# xe vm-disk-list uuid=6cb4d109-5499-d112-c777-d2a2c8369b39
Disk 0 VBD:
uuid ( RO)             : 15ef5e96-9682-2db7-df6e-25f3c1acab80
    vm-name-label ( RO): VYOS_Template
       userdevice ( RW): 0


Disk 0 VDI:
uuid ( RO)             : aeaf3bfa-b396-4e9e-bb33-3b6770a1897a
       name-label ( RW): VYOS_Template
    sr-name-label ( RO): Local B SR
     virtual-size ( RO): 4294967296


[root@XEN05 ~]# xe vbd-param-set uuid=15ef5e96-9682-2db7-df6e-25f3c1acab80 bootable=true

11. Check if the VM boots. It should be up and running just fine. Now let's prepare the VM to save it as a template. We need to make sure the configuration file is "agnostic", e.g. doesn't contain any MAC addresses that most probably won't exist on another system ;) We can edit the configuration via CLI or just open the /config/config.boot file in nano and make changes there. If you edit via CLI make sure to issue "save" when you're done.

12. While doing that we can also make any other configuration customizations like setting the NTP server etc. Also delete the "console ttyS0" configuration entry to prevent frequent error messages in the console (INIT: Id "T0" respawning too fast...).

13. Power off the VM when you're confident the config file is clear and prepared. Do not boot the template VM again. Instead right-click it in XenCenter and select "Convert to template".

***

That's it, you can now clone the template and make new VMs. You can also export this template as an XVA file and import it on another XenServer hosts. I'm happy to help if you have any problems or questions :)

Best regards,
Docent
Reply

#2

Thanks, you helped me a lot :)
Reply

#3

Super Post !!, Thanks a lot
Reply

#4
(This post was last modified: 21/09/2015, 06:30 by bruceg.)

I got as far as trying to boot the VM after running the 3 xe vm-param-set commands and the xe-vbd-param-set command. I then tried to boot the VM and it wouldn't boot with a message, "The bootloader for this VM returned and error -- did the VM installation succeed? Unable to find partition containing kernel

What did I hose up?
Reply

#5

Hi,

Before migrate to VyOS I used a Vyatta XenServer appliance..Today I Install from scratch VyOS on XenServer 6.5 SP1 and moved config from Vyatta to VyOS, but I have a few problems:

- how to disabled this: INIT: Id "T0" respawning too fast: disabled for 5 minutes
- when I turn off a VM VyOS and want turn on again, all the time I get messages: No bootable device. I resolved this problem reattch disk,but is not a resolve...
Reply

#6

(21/09/2015, 06:29)bruceg Wrote: I got as far as trying to boot the VM after running the 3 xe vm-param-set commands and the xe-vbd-param-set command. I then tried to boot the VM and it wouldn't boot with a message, "The bootloader for this VM returned and error -- did the VM installation succeed? Unable to find partition containing kernel

What did I hose up?

I had the same problem, removing the pv cdrom from the dvd drive fixed it for me.
Reply

#7

Registered on the forums just to say, thank you. Performance is so much better with PV enabled.
Reply

#8

(14/06/2016, 13:20)hhegeman Wrote:
(21/09/2015, 06:29)bruceg Wrote: I got as far as trying to boot the VM after running the 3 xe vm-param-set commands and the xe-vbd-param-set command.  I then tried to boot the VM and it wouldn't boot with a message, "The bootloader for this VM returned and error -- did the VM installation succeed?  Unable to find partition containing kernel

What did I hose up?

I had the same problem, removing the pv cdrom from the dvd drive fixed it for me.

Thanks @hhegeman, that worked for me too!

One change here to original post:
Quote:Also delete the "console ttyS0" configuration entry to prevent frequent error messages in the console (INIT: Id "T0" respawning too fast...).
A better option is to change the `console ttyS0` to `console hvc0`. This will allow the console to display properly in XenCenter.

Thanks all!
Reply





Users browsing this thread:
1 Guest(s)