Abbreviated from the official docs. This is the theory but in practice I found it didn't work: Nothing to boot: No such file or directory (http://ipxe.org/err/2d03e1)
Create the VM
Template
- List the Templates to use: xe template-list
- Filter according to a particular distro:
xe template-list | grep "Ubuntu" - Output the storage repo list to a file then use the search feature to open it e.g.
xe template-list > xe-template-list.txt
vi xe-template-list.txt
Then use / to enter a search term e.g. Ubuntu
Storage Repository
- List available storage repositories:
xe sr-list
You need the one with type LVM. Retain the UUID - Check available space eg using UUID from 'Local Storage' in list above.
List mount points: df -h
List Available space: df -h /run/sr-mount/[some UUID]
List used space: du -sh /run/sr-mount/[some UUID]
Create the VM
- Create a VM using the template and storage UUIDs and retain the UUID it returns:
xe vm-install template="[template name(not UUID)]" new-name-label="[hostname]" \sr-uuid=[storage_repository_uuid] - Rename the resulting Virtual Disk:
xe vm-disk-list vm=[hostname]
xe vdi-param-set uuid=[VD UUID] name-label="[hostname] Disk 0 VDI"
Memory and Network
- Increase memory (if needed):
xe vm-param-list uuid=[VM UUID] | grep -i memory (look at memory-static-max)
xe vm-memory-limits-set dynamic-max=2147483648 dynamic-min=2147483648 static-max=2147483648 static-min=2147483648 name-label=[hostname] - Attach a network interface:
- xe network-list (You need the one attached to eth0)
- Create a VIF to connect the new VM to this network:
xe vif-create vm-uuid=[vm_uuid] network-uuid=[network_uuid] mac=random device=0 - List to check:
xe vm-vif-list vm="<VM name>"
Setup the Boot Disk
- Disable boot from VM hard disk (so can boot from mirror):
xe vbd-list vm-uuid=[VM uuid] userdevice=0
xe vbd-param-set uuid=[Device UUID (not VDI UUID)] bootable=false
Boot from ISO
See previous post on setting up ISO share.
- List the available ISOs
xe cd-list - List the existing devices:
xe vbd-list vm-name-label="<VM name>" - Attach the ISO to the VM:
xe vm-cd-add vm="<VM name>" cd-name="<ISO name-lable>" device=1 - Get the UUID of the VBD you've just added:
xe vbd-list vm-name-label="newVM" userdevice=1 - Set the VBD to bootable:
xe vbd-param-set uuid=[VBD device uuid, NOT vdi-uuid] bootable=true - Set the install repo of the VM:
xe vm-param-set uuid=[VM uuid] other-config:install-repository=cdrom
Boot from Network (Doesn't work for me)
- Set the install-repository key of the other-config parameter to the path of the network repository
e.g. http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/vmlinuz
xe vm-param-set uuid=[vm_uuid] \other-config:install-repository=[mirror]
Start the VM
- Start the VM:
xe vm-start uuid=[vm_uuid] - Connect tot he VM console via XenCeter or VNC to complete the installation
Connect to the VM via VNC
- Get the VM domain number:
xe vm-param-list uuid=[VM uuid] | grep dom-id - Get the VNC port for this domain:
xenstore-read /local/domain/<domain number>/console/vnc-port - VNC viewer remote connection. Port = last two digits from previous output:
vncviewer -via root@[xenserver] localhost:<port>
No comments:
Post a Comment