Using libvirt to create a pool

The following script can be used to create a libvirt pool of type “filesystem”. When then pool gets started, the filesystem gets mounted by libvirt. When the pool gets stopped, the filesystem gets unmounted.

#!/bin/bash
#
echo ” define pool ”
read -p “Press [Enter] key to continue…”
#
#virsh pool-define-as pool_fs fs – – /dev/mapper/openvswitch-root – /mnt
#
#
echo ” create the mount point ”
read -p “Press [Enter] key to continue…”
#
#virsh pool-build pool_fs
#
echo ” start the storage pool ”
read -p “Press [Enter] key to continue…”
#
virsh pool-start pool_fs
virsh pool-list –all
#
#
echo ” Turn on auto-tart ”
read -p “Press [Enter] key to continue…”
#
virsh pool-autostart pool_fs
virsh pool-list –all
#
echo ” verify pool ”
read -p “Press [Enter] key to continue…”
#
virsh pool-info pool_fs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s