fuel-main/ci_with_libvirt
2012-05-17 18:39:28 +04:00
..
config_directory_example DOMAIN_BOOT_DEV variables added in ci_with_libvirt 2012-05-17 18:34:12 +04:00
create_node.sh DOMAIN_BOOT_DEV variables added in ci_with_libvirt 2012-05-17 18:34:12 +04:00
destroy_node.sh some fixes in ci_with_libvirt 2012-05-16 19:19:35 +04:00
domain.xml.template some fixes in ci_with_libvirt/domain.xml.template 2012-05-17 18:39:28 +04:00
inject_node.sh some fixes in bootstrap and ci_with_libvirt 2012-05-17 16:51:25 +04:00
README ci_with_libvirt/README edited 2012-05-16 16:37:43 +04:00

# 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