# 1. Create libvirt bridges
cd /etc/libvirt/qemu/networks
cat > product0.xml <<EOF
<network>
<name>product0</name>
<forward mode='nat'/>
<bridge name='product0' stp='off' delay='0' />
<ip address='10.12.0.1' netmask='255.255.255.0'>
</ip>
</network>
EOF
cat > product1.xml <<EOF
<network>
<name>product1</name>
<bridge name='product1' stp='off' delay='0' />
</network>
EOF
virsh net-define product0.xml
virsh net-define product1.xml
virsh net-start product0
virsh net-start product1
virsh net-autostart product0
virsh net-autostart product1
# 2. Create node config directory
# You can use ci_with_libvirt/config_directory_example
# Base disk must use to have chef installed in order to launch chef after booting
mkdir ~/basedir
cp ci_with_libvirt/config_directory_example ~/basedir/node0
cd ~/basedir/node0
cat > ~/basedir/node0/domain.conf <<EOF
DOMAIN_NAME=node0
DOMAIN_BASE_DISK=http://localhost/basedisk.qcow2
DOMAIN_MEMORY=2097152
DOMAIN_BRIDGE0=product0
DOMAIN_BRIDGE1=product1
PURGE_AFTER_DESTROY=true
EOF
# 3. Create cookbooks to inject into vm
# copy cookbooks you want into ~/basedir/node0/cookbooks
# 4. Define which recipes to launch on vm just after booting (default: none)
cat > ~/basedir/node0/scripts/solo.json <<EOF
{
"recipes": [ ]
}
EOF
# 5. Create node and inject cookbooks into vm disk
sudo ci_with_libvirt/create_node.sh ~/basedir/node0
sudo ci_with_libvirt/inject_node.sh ~/basedir/node0
# 6. Define and start vm
sudo virsh define /var/lib/ci_libvirt/node0/domain.xml
sudo virsh start node0