Skip to content

Commit

Permalink
bugfix the backup image file is deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
k-oyakata committed Oct 24, 2012
1 parent 4621a0b commit ddb9e7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions dcmgr/lib/dcmgr/drivers/linux_local_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def deploy_image(inst,ctx)
raise "Image file is not ready: #{ctx.os_devpath}" unless File.exist?(ctx.os_devpath)

ensure
unless Dcmgr.conf.local_store.enable_image_caching && @ctx.inst[:image][:is_cacheable]
unless Dcmgr.conf.local_store.enable_image_caching && @ctx.inst[:image][:is_cacheable] || @bkst_drv_class.include?(BackupStorage::CommandAPI)
File.unlink(vmimg_cache_path()) rescue nil
end
end
Expand Down Expand Up @@ -179,11 +179,10 @@ def vmimg_cache_path(basename=nil)
basename ||= begin
@ctx.inst[:image][:backup_object][:uuid] + (@suffix ? @suffix : "")
end
if @bkst_drv_class.include?(BackupStorage::CommandAPI)
URI.parse(@ctx.inst[:image][:backup_object][:uri]).path
else
if (Dcmgr.conf.local_store.enable_image_caching && @ctx.inst[:image][:is_cacheable]) || !@bkst_drv_class.include?(BackupStorage::CommandAPI)
File.expand_path(basename, (Dcmgr.conf.local_store.enable_image_caching && @ctx.inst[:image][:is_cacheable] ? vmimg_cache_dir : download_tmp_dir))
dir = Dcmgr.conf.local_store.enable_image_caching && @ctx.inst[:image][:is_cacheable] ? vmimg_cache_dir : download_tmp_dir
else
URI.parse(@ctx.inst[:image][:backup_object][:uri]).path
end
end

Expand Down

0 comments on commit ddb9e7e

Please sign in to comment.