diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-03-07 21:30:20 +0000 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-03-07 21:30:20 +0000 |
| commit | 02e6a17bec06beee5dbffe085073c97281abb586 (patch) | |
| tree | 26dff493d69a44edfc09e52d2e99f6d095161368 /bin | |
| parent | fd95523689b80f53972c59c3738e6b786a7160ff (diff) | |
| download | nova-02e6a17bec06beee5dbffe085073c97281abb586.tar.gz nova-02e6a17bec06beee5dbffe085073c97281abb586.tar.xz nova-02e6a17bec06beee5dbffe085073c97281abb586.zip | |
move the images_dir out of the way when converting
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/nova-manage | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index f8cc6e68e..b97d8b81d 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -846,6 +846,16 @@ class ImageCommands(object): arguments: directory""" machine_images = {} other_images = {} + directory = os.path.abspath(directory) + # NOTE(vish): If we're importing from the images path dir, attempt + # to move the files out of the way before importing + # so we aren't writing to the same directory. This + # may fail if the dir was a mointpoint. + if directory == os.path.abspath(FLAGS.images_path): + new_dir = "%s_bak" % directory + os.move(directory, new_dir) + os.mkdir(directory) + directory = new_dir for fn in glob.glob("%s/*/info.json" % directory): try: image_path = os.path.join(fn.rpartition('/')[0], 'image') |
