- # Create a temporary disk image
- qemu_img_cmd = "qemu-img create -f qcow2 %(diskimage)s %(disk_size)s" % locals()
- node.host_commands(qemu_img_cmd)
+ # Create a temporary disk image if it doesnt already exist or we are reinstalling
+ img_check_cmd = "ls -ld %(diskimage)s" % locals()
+ (status, output) = node.host_commands(img_check_cmd, False)
+ if status != 0 or node['boot_state'] in ['rins', 'inst']:
+ qemu_img_cmd = "qemu-img create -f qcow2 %(diskimage)s %(disk_size)s" % locals()
+ node.host_commands(qemu_img_cmd)