diff --git a/bin/xen-create-image b/bin/xen-create-image index 117ff8c..3fc8b1d 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -57,8 +57,8 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. are liable to be used by the new invocation. --fs=fs Specify the filesystem type to use for the new guest. - Valid choices are 'ext2', 'ext3', 'ext4', 'reiserfs', or - 'xfs'. + Valid choices are 'ext2', 'ext3', 'ext4', 'reiserfs', + 'xfs' or 'btrfs'. --image=str Specify whether to create "sparse" or "full" disk images. @@ -1403,6 +1403,7 @@ sub setupDefaultOptions $CONFIG{ 'make_fs_ext4' } = 'mkfs.ext4 -F'; $CONFIG{ 'make_fs_xfs' } = 'mkfs.xfs -f'; $CONFIG{ 'make_fs_reiserfs' } = 'mkfs.reiserfs -f -q'; + $CONFIG{ 'make_fs_btrfs' } = 'mkfs.btrfs'; # # Flags to pass to "mount" to mount our image. @@ -1415,6 +1416,7 @@ sub setupDefaultOptions $CONFIG{ 'mount_fs_ext4' } = '-t ext4'; $CONFIG{ 'mount_fs_xfs' } = '-t xfs'; $CONFIG{ 'mount_fs_reiserfs' } = '-t reiserfs'; + $CONFIG{ 'mount_fs_btrfs' } = '-t btrfs'; # # Network options. @@ -1558,8 +1560,8 @@ sub checkOption message => "must be a valid hostname.\n", }, supportedFs => { - check => qr/^(ext[234]|xfs|reiserfs)$/, - message => "must be a supported filesystem (ext2, ext3, ext4, xfs or reiserfs).\n", + check => qr/^(ext[234]|xfs|reiserfs|btrfs)$/, + message => "must be a supported filesystem (ext2, ext3, ext4, xfs, reiserfs or btrfs).\n", }, yesNo => { check => qr/^yes|no$/i, diff --git a/debian/control b/debian/control index 25d360f..d32895e 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: xen-tools Architecture: all Depends: debootstrap | cdebootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends} Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, rinse, xen-shell, libexpect-perl -Suggests: reiserfsprogs, xfsprogs, xen-utils, cfengine2, evms-cli +Suggests: reiserfsprogs, xfsprogs, xen-utils, cfengine2, evms-cli, btrfs-tools Description: Tools to manage Xen virtual servers This package contains tools to manage Debian based Xen virtual servers. . diff --git a/etc/xen-tools.conf b/etc/xen-tools.conf index cdb99b4..fdc5b71 100644 --- a/etc/xen-tools.conf +++ b/etc/xen-tools.conf @@ -294,6 +294,7 @@ ext3_options = noatime,nodiratime,errors=remount-ro ext2_options = noatime,nodiratime,errors=remount-ro xfs_options = defaults reiserfs_options = defaults +btrfs_options = defaults # # Uncomment if you wish newly created images to boot once they've been diff --git a/hooks/centos-4/90-make-fstab b/hooks/centos-4/90-make-fstab index c6aa722..278d1de 100755 --- a/hooks/centos-4/90-make-fstab +++ b/hooks/centos-4/90-make-fstab @@ -63,6 +63,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -88,6 +89,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -108,6 +112,9 @@ done #if [ $has_reiserfs -eq 1 ]; then # installDebianPackage ${prefix} reiserfsprogs #fi +#if [ $has_btrfs -eq 1 ]; then +# installDebianPackage ${prefix} btrfs-tools +#fi # diff --git a/hooks/centos-5/90-make-fstab b/hooks/centos-5/90-make-fstab index 38dc3bd..6b97069 100755 --- a/hooks/centos-5/90-make-fstab +++ b/hooks/centos-5/90-make-fstab @@ -64,6 +64,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -89,6 +90,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -109,6 +113,9 @@ done #if [ $has_reiserfs -eq 1 ]; then # installDebianPackage ${prefix} reiserfsprogs #fi +#if [ $has_btrfs -eq 1 ]; then +# installDebianPackage ${prefix} btrfs-tools +#fi # diff --git a/hooks/dapper/90-make-fstab b/hooks/dapper/90-make-fstab index 36a2cf0..42d775d 100755 --- a/hooks/dapper/90-make-fstab +++ b/hooks/dapper/90-make-fstab @@ -60,6 +60,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -85,6 +86,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -105,6 +109,9 @@ fi if [ $has_reiserfs -eq 1 ]; then installDebianPackage ${prefix} reiserfsprogs fi +if [ $has_btrfs -eq 1 ]; then + installDebianPackage ${prefix} btrfs-tools +fi # diff --git a/hooks/debian/90-make-fstab b/hooks/debian/90-make-fstab index 94e6398..586e621 100755 --- a/hooks/debian/90-make-fstab +++ b/hooks/debian/90-make-fstab @@ -59,6 +59,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -84,6 +85,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -104,6 +108,9 @@ fi if [ $has_reiserfs -eq 1 ]; then installDebianPackage ${prefix} reiserfsprogs fi +if [ $has_btrfs -eq 1 ]; then + installDebianPackage ${prefix} btrfs-tools +fi # diff --git a/hooks/edgy/90-make-fstab b/hooks/edgy/90-make-fstab index 36a2cf0..42d775d 100755 --- a/hooks/edgy/90-make-fstab +++ b/hooks/edgy/90-make-fstab @@ -60,6 +60,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -85,6 +86,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -105,6 +109,9 @@ fi if [ $has_reiserfs -eq 1 ]; then installDebianPackage ${prefix} reiserfsprogs fi +if [ $has_btrfs -eq 1 ]; then + installDebianPackage ${prefix} btrfs-tools +fi # diff --git a/hooks/fedora-core-6/90-make-fstab b/hooks/fedora-core-6/90-make-fstab index c6aa722..278d1de 100755 --- a/hooks/fedora-core-6/90-make-fstab +++ b/hooks/fedora-core-6/90-make-fstab @@ -63,6 +63,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -88,6 +89,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -108,6 +112,9 @@ done #if [ $has_reiserfs -eq 1 ]; then # installDebianPackage ${prefix} reiserfsprogs #fi +#if [ $has_btrfs -eq 1 ]; then +# installDebianPackage ${prefix} btrfs-tools +#fi # diff --git a/hooks/gentoo/90-make-fstab b/hooks/gentoo/90-make-fstab index 61e5e02..7063c76 100755 --- a/hooks/gentoo/90-make-fstab +++ b/hooks/gentoo/90-make-fstab @@ -60,6 +60,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -85,6 +86,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -105,6 +109,9 @@ done #if [ $has_reiserfs -eq 1 ]; then # installDebianPackage ${prefix} reiserfsprogs #fi +#if [ $has_btrfs -eq 1 ]; then +# installDebianPackage ${prefix} btrfs-tools +#fi # diff --git a/hooks/intrepid/90-make-fstab b/hooks/intrepid/90-make-fstab index 36a2cf0..42d775d 100755 --- a/hooks/intrepid/90-make-fstab +++ b/hooks/intrepid/90-make-fstab @@ -60,6 +60,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -85,6 +86,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -105,6 +109,9 @@ fi if [ $has_reiserfs -eq 1 ]; then installDebianPackage ${prefix} reiserfsprogs fi +if [ $has_btrfs -eq 1 ]; then + installDebianPackage ${prefix} btrfs-tools +fi # diff --git a/hooks/karmic/90-make-fstab b/hooks/karmic/90-make-fstab index 36a2cf0..42d775d 100755 --- a/hooks/karmic/90-make-fstab +++ b/hooks/karmic/90-make-fstab @@ -60,6 +60,7 @@ logMessage "Root device is /dev/$device" # has_xfs=0 has_reiserfs=0 +has_btrfs=0 cat < ${prefix}/etc/fstab # /etc/fstab: static file system information. # @@ -85,6 +86,9 @@ for part in `seq 1 ${NUMPARTITIONS}`; do reiserfs) has_reiserfs=1 ;; + btrfs) + has_btrfs=1 + ;; esac if [ "${partdata2}" = "swap" ]; then @@ -105,6 +109,9 @@ fi if [ $has_reiserfs -eq 1 ]; then installDebianPackage ${prefix} reiserfsprogs fi +if [ $has_btrfs -eq 1 ]; then + installDebianPackage ${prefix} btrfs-tools +fi # diff --git a/misc/xen-tools b/misc/xen-tools index e698353..1a9c069 100644 --- a/misc/xen-tools +++ b/misc/xen-tools @@ -111,7 +111,7 @@ _xen_create_image() return 0 ;; --fs) - COMPREPLY=( $( compgen -W 'xfs ext3 reiserfs' -- "${COMP_WORDS[COMP_CWORD]}" ) ) + COMPREPLY=( $( compgen -W 'ext2 ext3 ext4 xfs reiserfs btrfs' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; --genpass) diff --git a/t/programs.t b/t/programs.t index daecac4..31d327e 100755 --- a/t/programs.t +++ b/t/programs.t @@ -18,7 +18,9 @@ my @required = qw( /bin/ls /bin/dd /bin/mount /bin/cp /bin/tar ); # Files that we might wish to use. # my @optional = qw( /usr/sbin/debootstrap /usr/bin/rpmstrap /usr/sbin/xm - /sbin/mkfs.ext3 /sbin/mkfs.xfs /sbin/mkfs.reiserfs ); + /sbin/mkfs.ext3 /sbin/mkfs.xfs /sbin/mkfs.reiserfs + /sbin/mkfs.btrfs + );