Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
hypervisor:toolstack:domu [2014/06/04 17:10]
admin [Using the Command Line]
hypervisor:toolstack:domu [2014/06/05 10:47]
admin [Templated VM Specific Operations]
Line 197: Line 197:
 </​code>​ </​code>​
  
-=== Create a logical volume for the VM's hard drive ===+=== Install ​the VM using the chosen template ​===
 <​code>​ <​code>​
-sudo lvcreate ​-L8G -nDebianWheezy xenvg+xe template-list | grep Debian 
 +> xe vm-install new-name-label=Debian-Wheezy template="​Debian Wheezy 7.0 (64-bit)"​ 
 +44c68930-1192-a196-b460-5f411a689c85
 </​code>​ </​code>​
  
-=== Create a .cfg file for the new VM === +A VDI will be created in the process, let's label it to avoid later confusion:
-Insert the following:+
 <​code>​ <​code>​
-nano /​root/​PVs/​debian-wheezy/​debian-wheezy.cfg+xe vdi-list 
 +... 
 +uuid ( RO)                : 63e18344-6e0a-4bd5-9cc0-4b32d8de0e11 
 +          name-label ( RW): 0 
 +    name-description ( RW): Created by template provisioner 
 +             ​sr-uuid ( RO): bc5fc2dd-fb0f-1e74-6226-0ece6e90c7a5 
 +        virtual-size ( RO): 8589934592 
 +            sharable ( RO): false 
 +           ​read-only ( RO): false 
 +... 
 +> xe vdi-param-set name-label="​DebianWheezy 0" uuid=63e18344-6e0a-4bd5-9cc0-4b32d8de0e11 
 +</​code>​
  
-kernel ​“/​root/​PVs/​debian-wheezy/​vmlinuz” +A VBD was also created: 
-ramdisk = “/​root/​PVs/​debian-wheezy/​initrd.gz” +<​code>​ 
-extra = “debian-installer/​exit/​always_halt=true ​-- console=hvc0” +> xe vbd-list vm-name-label=Debian-Wheezy 
-vcpus = 2 +uuid ( RO)             : 7b503b0e-ae3b-4f55-ef36-f6c3b8ed7ea3 
-memory = 2048 +          vm-uuid ( RO): 44c68930-1192-a196-b460-5f411a689c85 
-name = “Debian Wheezy +    vm-name-label ( RO): Debian-Wheezy 
-vif = [‘mac=02:00:00:84:​fb:​29,​bridge=xenbr0’] +         vdi-uuid ( RO)63e18344-6e0a-4bd5-9cc0-4b32d8de0e11 
-disk = [‘phy:/​dev/​xenvg/debianwheezy,​xvda,​w’]+            empty ( RO)false 
 +           ​device ( RO):  
 +</code>
  
-device_model_version ​“qemu-xen” +We still need to create the virtual network interface, here we'll specify a MAC address that must be used for compatibility with a given failover IP: 
-device_model_override ​“/​usr/​bin/​qemu” +<​code>​ 
-bios “seabios"​+> xe vif-create vm-uuid=44c68930-1192-a196-b460-5f411a689c85 network-uuid=1ce402ce-e6a1-b496-b967-a00cc586e525 device=0 mac=02:​00:​00:​84:​fb:​29
 </​code>​ </​code>​
  
-The extra property contains directives that can be found on the [[http://​wiki.xen.org/​wiki/​Debian_Guest_Installation_Using_Debian_Installer|Xen Debian ​wiki]]+==== Templated VM Specific Operations ==== 
 +---- 
 +From: [[http://​wiki.xen.org/​wiki/​XCP_PV_templates_start]]:​\\ 
 +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. 
 + 
 +<​code>​ 
 +> xe vm-param-set uuid=44c68930-1192-a196-b460-5f411a689c85 PV-bootloader= 
 +> xe vm-param-set uuid=44c68930-1192-a196-b460-5f411a689c85 PV-kernel=/​root/​PVs/​debian-wheezy/​vmlinuz 
 +> xe vm-param-set uuid=44c68930-1192-a196-b460-5f411a689c85 PV-ramdisk=/​root/​PVs/​debian-wheezy/​initrd.gz 
 +> xe vm-start uuid=44c68930-1192-a196-b460-5f411a689c85 
 +</​code>​ 
 + 
 +To follow the installation process: 
 +<​code>​ 
 +> xe vm-param-get uuid=44c68930-1192-a196-b460-5f411a689c85 param-name=dom-id 
 +
 +> screen -S Wheezy 
 +> /​usr/​lib/​xen-4.1/​bin/​xenconsole 4 
 +</​code>​ 
 + 
 +After initial installation:​ 
 +<​code>​ 
 +> xe vm-param-set uuid=... PV-bootloader=pygrub 
 +</​code>​ 
 + 
 +=== Add Xen Tools === 
 + 
 +At this point you might want to [[http://wiki.strategicz.com/​vhyper/​doku.php?​id=hypervisor:​basestack:​domu&#​install_xen_tools|add the XenTools]] to your VM. 
 + 
 +---- 
 +===== Create Template and Appliance ===== 
 +---- 
 +Reference: [[http://​www.jansipke.nl/​creating-backups-of-running-vms-in-xenserver/​]] 
 + 
 +It seems that this operation can be performed even on a running VM. 
 + 
 +Pick target VM uuid: 
 +<​code>​ 
 +> xe vm-list is-control-domain=false is-a-snapshot=false 
 +</​code>​ 
 + 
 +Create the snapshot: 
 +<​code>​ 
 +> xe vm-snapshot uuid=<​vm-uuid>​ new-name-label=<​snapshotname>​ 
 +<​snapshot-uuid>​ 
 +</​code>​ 
 + 
 +Transform the snapshot into a VM to be able to save it to a file: 
 +<​code>​ 
 +> xe template-param-set is-a-template=false ha-always-run=false uuid=<​snapshot-uuid>​ 
 +> xe vm-export vm=<​snapshot-uuid>​ filename=<​filename>​.xva 
 +Export succeeded 
 +</​code>​ 
 +The export operation can take a while... Be patient until you see the "​Export succeeded"​ message. 
 + 
 +Finally let's get rid of the snapshot: 
 +<​code>​ 
 +> xe vm-uninstall uuid=<​snapshot-uuid>​ force=true 
 +</​code>​
  
 ---- ----