diff --git a/devstack/lib/ironic b/devstack/lib/ironic index b712a65377..a4906685bf 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -102,6 +102,7 @@ IRONIC_VM_COUNT=${IRONIC_VM_COUNT:-1} IRONIC_VM_SPECS_CPU=${IRONIC_VM_SPECS_CPU:-1} IRONIC_VM_SPECS_RAM=${IRONIC_VM_SPECS_RAM:-1024} IRONIC_VM_SPECS_DISK=${IRONIC_VM_SPECS_DISK:-10} +IRONIC_VM_SPECS_DISK_FORMAT=${IRONIC_VM_SPECS_DISK_FORMAT:-qcow2} IRONIC_VM_EPHEMERAL_DISK=${IRONIC_VM_EPHEMERAL_DISK:-0} IRONIC_VM_EMULATOR=${IRONIC_VM_EMULATOR:-/usr/bin/qemu-system-x86_64} IRONIC_VM_NETWORK_BRIDGE=${IRONIC_VM_NETWORK_BRIDGE:-brbm} @@ -711,7 +712,7 @@ function create_bridge_and_vms { sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/create-node.sh $vm_name \ $IRONIC_VM_SPECS_CPU $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK \ amd64 $IRONIC_VM_NETWORK_BRIDGE $IRONIC_VM_EMULATOR \ - $vbmc_port $log_arg" >> $IRONIC_VM_MACS_CSV_FILE + $vbmc_port $log_arg $IRONIC_VM_SPECS_DISK_FORMAT" >> $IRONIC_VM_MACS_CSV_FILE vbmc_port=$((vbmc_port+1)) done create_ovs_taps diff --git a/devstack/tools/ironic/scripts/configure-vm.py b/devstack/tools/ironic/scripts/configure-vm.py index 51cee5fbf6..acb915a697 100755 --- a/devstack/tools/ironic/scripts/configure-vm.py +++ b/devstack/tools/ironic/scripts/configure-vm.py @@ -76,6 +76,8 @@ def main(): help='File to log console') parser.add_argument('--emulator', default=None, help='Path to emulator bin for vm template') + parser.add_argument('--disk-format', default='qcow2', + help='Disk format to use.') args = parser.parse_args() with file(templatedir + '/vm.xml', 'rb') as f: source_template = f.read() @@ -90,6 +92,7 @@ def main(): 'network': args.network, 'nicdriver': args.libvirt_nic_driver, 'emulator': args.emulator, + 'disk_format': args.disk_format } if args.emulator: diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh index 4fc9cf01f5..ce3ff1f238 100755 --- a/devstack/tools/ironic/scripts/create-node.sh +++ b/devstack/tools/ironic/scripts/create-node.sh @@ -26,6 +26,7 @@ BRIDGE=$6 EMULATOR=$7 VBMC_PORT=$8 LOGDIR=$9 +DISK_FORMAT=${10} LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"} LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"} @@ -50,7 +51,7 @@ if [ -n "$LOGDIR" ] ; then fi PREALLOC= -if [ -f /etc/debian_version ]; then +if [ -f /etc/debian_version && "$DISK_FORMAT" == "qcow2" ]; then PREALLOC="--prealloc-metadata" fi @@ -59,12 +60,12 @@ if [ -n "$LOGDIR" ] ; then else VM_LOGGING="" fi -VOL_NAME="${NAME}.qcow2" +VOL_NAME="${NAME}.${DISK_FORMAT}" if ! virsh list --all | grep -q $NAME; then virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME && virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL >&2 - virsh vol-create-as $LIBVIRT_STORAGE_POOL ${VOL_NAME} ${DISK}G --format qcow2 $PREALLOC >&2 + virsh vol-create-as $LIBVIRT_STORAGE_POOL ${VOL_NAME} ${DISK}G --format $DISK_FORMAT $PREALLOC >&2 volume_path=$(virsh vol-path --pool $LIBVIRT_STORAGE_POOL $VOL_NAME) # Pre-touch the VM to set +C, as it can only be set on empty files. sudo touch "$volume_path" @@ -72,7 +73,7 @@ if ! virsh list --all | grep -q $NAME; then $TOP_DIR/scripts/configure-vm.py \ --bootdev network --name $NAME --image "$volume_path" \ --arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \ - --emulator $EMULATOR --network $BRIDGE $VM_LOGGING >&2 + --emulator $EMULATOR --network $BRIDGE --disk-format $DISK_FORMAT $VM_LOGGING >&2 # Createa Virtual BMC for the node if IPMI is used if [[ $(type -P vbmc) != "" ]]; then diff --git a/devstack/tools/ironic/templates/vm.xml b/devstack/tools/ironic/templates/vm.xml index 0131e15929..cbfa391927 100644 --- a/devstack/tools/ironic/templates/vm.xml +++ b/devstack/tools/ironic/templates/vm.xml @@ -20,7 +20,7 @@ %(emulator)s - +