# Xen New VM

Find ISO SR UUID

```
xe sr-list
```

> uuid ( RO) : XXXXXXXX-XXXXX-XXX-XXXX-XXXXXXXX  
> name-label ( RW): data01  
> host ( RO): &lt;shared&gt;  
> type ( RO): nfs  
> content-type ( RO): user

Find name of template

```
xe template-list
```

```
xe vm-install template="<template_name>" new-name-label=<name_for_vm> sr-uuid=<storage_repository_uuid>
```

Example

```
xe vm-install template="Ubuntu Bionic Beaver 18.04" new-name-label=test.myhypervisor.ca sr-uuid=<storage_repository_uuid>
```

Find UUID for VM

```
xe vm-list
```

> uuid ( RO) : XXXXXXXXXXXXXXXXXXXXX  
> name-label ( RW): test.myhypervisor.ca  
> power-state ( RO): halted

Find ISO UUID

```
xe cd-list
```

> uuid ( RO) : XXXXXXXXXXXXXXXXXXXXXXXXX  
> name-label ( RW): ubuntu-18.04.2-live-server-amd64.iso

Find network UUID

```
xe network-list bridge=xenbr0 --minimal
```

List virtual drive

```
xe vm-disk-list vm=<vm-uuid>
```

VDB is the ISO assigned on the VM, VDI is the virtual drive

> Disk 0 VBD:  
> uuid ( RO) : XXXXXXXXXXXXXXXXXXXXXxx  
> vm-name-label ( RO): test.myhypervisor.ca  
> userdevice ( RW): 0
> 
>   
> Disk 0 VDI:  
> uuid ( RO) : XXXXXXXXXXXXXXXXXXXXXxx  
> name-label ( RW): 0  
> sr-name-label ( RO): data01  
> virtual-size ( RO): 10737418240

Add ISO

```
xe vm-cd-add uuid=<vm-uuid> cd-name=ubuntu-18.04.2-live-server-amd64.iso device=1
xe vm-param-set HVM-boot-policy="BIOS order" uuid=<vm_uuid>
```

Add network on VM

```
xe vif-create vm-uuid=<vm_uuid> network-uuid=<network_uuid> device=0
```

Add VM RAM

```
xe vm-memory-limits-set uuid=<uuid of the valid VM> static-min=<nn>GiB/MiB dynamic-min=<nn>GiB/MiB dynamic-max=<nn>GiB/MiB static-max=<nn>GiB/MiB
```

Increase VDI

```
xe vdi-resize uuid=<vdi-uuid> disk-size=15GiB
```

Start VM

```
xe vm-start uuid=<vm-uuid>
```

Get id

```
list_domains | grep <vm-uuid>
```

> 3 | XXXXXXXXXXXXXX | B H

First number is the domid

```
xl console <dom-id>
```