add test class

This commit adds a class for testing that creates
a volume on a loopback device.
This commit is contained in:
Dan Bode 2012-10-25 17:42:46 -07:00
parent 630cdb7aa4
commit e67394639e

View File

@ -0,0 +1,28 @@
class cinder::setup_test_volume(
$volume_name = 'cinder-volumes',
$size = '4G',
$loopback_device = '/dev/loop2'
) {
Exec {
cwd => '/tmp/',
}
exec { "/bin/dd if=/dev/zero of=${volume_name} bs=1 count=0 seek=${size}":
unless => "/sbin/vgdisplay ${volume_name}"
} ~>
exec { "/sbin/losetup ${loopback_device} ${volume_name}":
refreshonly => true,
} ~>
exec { "/sbin/pvcreate ${loopback_device}":
refreshonly => true,
} ~>
exec { "/sbin/vgcreate ${volume_name} ${loopback_device}":
refreshonly => true,
}
}