Revision 95fc9267 src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb
5 5

  
6 6
class FileHelper
7 7

  
8
    def self.get_img_name(disk, vm_id, vm_name)
8
    def self.get_img_name(disk, vm_id, vm_name, instantiate_as_persistent=false)
9 9
        if disk["PERSISTENT"] == "YES" || disk["TYPE"] == "CDROM"
10 10
            return disk["SOURCE"]
11 11
        else
12 12
            disk_id  = disk["DISK_ID"]
13 13
            if disk["SOURCE"]
14
                image_name = disk["SOURCE"].split(".").first
15
                return "#{image_name}-#{vm_id}-#{disk_id}.vmdk"
14
                if instantiate_as_persistent &&
15
                   disk["OPENNEBULA_MANAGED"] &&
16
                   disk["OPENNEBULA_MANAGED"].upcase == "NO"
17
                    return disk["SOURCE"] # Treat this disk as if was persistent
18
                else
19
                    image_name = disk["SOURCE"].split(".").first
20
                    return "#{image_name}-#{vm_id}-#{disk_id}.vmdk"
21
                end
16 22
            else
17 23
                ds_volatile_dir  = disk["VCENTER_DS_VOLATILE_DIR"] || "one-volatile"
18 24
                return "#{ds_volatile_dir}/#{vm_id}/one-#{vm_id}-#{disk_id}.vmdk"

Also available in: Unified diff