Permalink
Browse files

qemu-img: create: rename preexisting image files

  • Loading branch information...
1 parent 6caeeda commit d4b17f21c4ef118f71656d63ecb46a150617562f Guido De Rosa committed Jun 4, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 modules/qemu/lib/onboard/virtualization/qemu/img.rb
@@ -29,6 +29,9 @@ def create(h)
fmt = h[:http_params]['qemu-img']['fmt']
FileUtils.mkdir_p File.join ROOTDIR, name
filepath = "#{ROOTDIR}/#{name}/#{name}.#{fmt}"
+ if File.exists? filepath
+ FileUtils.mv_f filepath, "#{filepath}.old"
+ end
System::Command.run(
"qemu-img create -f #{fmt} '#{filepath}' #{size_str}", :raise_BadRequest)
return filepath

0 comments on commit d4b17f2

Please sign in to comment.