mkdir -p /cloud/xml
mkdir -p /cloud/volumes
mkdir -p /cloud/images
wget -O /cloud/images/centos7.iso http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
virsh pool-define-as --name volumes --type dir --target /cloud/volumes
virsh pool-autostart volumes
virsh pool-start volumes
echo "<network>
<name>network-mgt</name>
</network>" > /cloud/xml/network-mgt.xml
virsh net-define /cloud/network-mgt.xml
virsh net-autostart network-mgt
virsh net-start network-mgt
echo "<network>
<name>network-san</name>
</network>" > /cloud/xml/network-san.xml
virsh net-define /cloud/network-san.xml
virsh net-autostart network-san
virsh net-start network-san
echo "<domain type='kvm'>
<name>vm-cp</name>
<os>
<type machine='q35'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
<bootmenu enable='yes'/>
</os>
<vcpu>2</vcpu>
<memory unit='G'>6</memory>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<clock offset='utc'>
<timer name='rtc' track='guest'/>
</clock>
<devices>
<disk type='volume'>
<driver type='qcow2'/>
<source
pool = 'volumes'
volume = 'vm-cp-vda'
/>
<target
dev = 'vda'
bus = 'virtio'
/>
</disk>
<disk
type = 'file'
device = 'cdrom'
>
<target
dev = 'sda'
bus = 'usb'
removable = 'on'
/>
</disk>
<interface type='network'>
<source network='default'/>
<model type='virtio'/>
</interface>
<interface type='network'>
<source network='network-mgt'/>
<model type='virtio'/>
</interface>
<graphics
type = 'vnc'
listen = '0.0.0.0'
port = '5001'
/>
</devices>
</domain>" > /cloud/xml/vm-cp.xml
virsh vol-create-as --pool volumes --name vm-cp-vda --capacity 20G --format qcow2
virsh define /cloud/xml/vm-cp.xml
virsh change-media --domain vm-cp --path sda --source /cloud/images/centos7.iso --insert --config
virsh start vm-cp
Connect using VNC client to port 5001 and install CentOS7, configuring eth1 with a static 192.168.1.1/24 IP. Once the install is complete, reboot the VM.
virsh destroy vm-cp
virsh change-media --domain vm-cp --path sda --eject --live --config
virsh start vm-cp
echo "<domain type='kvm'>
<name>vm-hv1</name>
<os>
<type machine='q35'>hvm</type>
</os>
<vcpu>1</vcpu>
<memory unit='G'>3</memory>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<cpu mode='host-passthrough'/>
<clock offset='utc'>
<timer name='rtc' track='guest'/>
</clock>
<devices>
<disk type='volume'>
<driver type='qcow2'/>
<source
pool = 'volumes'
volume = 'vm-hv1-sda'
/>
<target
dev = 'sda'
bus = 'sata'
/>
</disk>
<disk type='volume'>
<driver type='qcow2'/>
<source
pool = 'volumes'
volume = 'vm-hv1-sdb'
/>
<target
dev = 'sdb'
bus = 'sata'
/>
</disk>
<interface type='network'>
<source network='network-mgt'/>
<model type='e1000e'/>
<boot order='1'/>
</interface>
<interface type='network'>
<source network='network-san'/>
<model type='e1000e'/>
</interface>
<graphics
type = 'vnc'
listen = '0.0.0.0'
port = '5002'
/>
</devices>
</domain>" > /cloud/xml/vm-hv1.xml
virsh vol-create-as --pool volumes --name vm-hv1-sda --capacity 20G --format qcow2
virsh vol-create-as --pool volumes --name vm-hv1-sdb --capacity 20G --format qcow2
virsh define /cloud/xml/vm-hv1.xml
Install and configure OnApp CP (with CloudBoot) on vm-cp, once ready launch vm-hv1 and use it as CloudBoot Hypervisor.