From c5cc2c2269bf8b33f958c20d26cd5610578988ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Font=C3=A1n=20Mui=C3=B1os?= Date: Thu, 23 Jul 2009 12:19:10 +0000 Subject: [PATCH] Changed tmp dir and oc moves images instead of copying git-svn-id: http://svn.opennebula.org/one/trunk@736 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/oca/ec2/econe-server | 4 ++++ src/oca/rm/image.rb | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/oca/ec2/econe-server b/src/oca/ec2/econe-server index 94fd91e630..4b2bdbe500 100755 --- a/src/oca/ec2/econe-server +++ b/src/oca/ec2/econe-server @@ -1,5 +1,9 @@ #!/bin/bash +eval `grep ^IMAGE_DIR= $ONE_LOCATION/etc/oca.conf ` +export TMPDIR=$IMG_DIR/tmp +mkdir -p $TMPDIR + nohup ruby $ONE_LOCATION/lib/ruby/econe/eco.rb >> $ONE_LOCATION/var/econe.log & diff --git a/src/oca/rm/image.rb b/src/oca/rm/image.rb index f1ce5ede6a..f7cfcb05ec 100644 --- a/src/oca/rm/image.rb +++ b/src/oca/rm/image.rb @@ -61,7 +61,8 @@ module OpenNebula image=Image.new(data) - image.copy_image(path) + # TODO: make copy or movement configurable + image.copy_image(path, true) image.get_image_info image.save @@ -77,8 +78,12 @@ module OpenNebula # Copies the image from the source path to the image repository. # Its name will be the image uuid. It also stores its new location # in the object. - def copy_image(path) - FileUtils.cp(path, image_path) + def copy_image(path, move=false) + if move + FileUtils.mv(path, image_path) + else + FileUtils.cp(path, image_path) + end self.path=image_path end