mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
F #4913: Improve image import code
This commit is contained in:
1 parent
c40a589966
commit
512dc4c7eb
2 files changed
+5
-11
No files matched your search
@@ -155,6 +155,8 @@ end # class StoragePod
|
||||
|
||||
class Datastore < Storage
|
||||
|
||||
attr_accessor :one_item
|
||||
|
||||
def initialize(item, vi_client=nil)
|
||||
if !item.instance_of? RbVmomi::VIM::Datastore
|
||||
raise "Expecting type 'RbVmomi::VIM::Datastore'. " <<
|
||||
@@ -162,6 +164,7 @@ class Datastore < Storage
|
||||
end
|
||||
|
||||
@item = item
|
||||
@one_item = {}
|
||||
end
|
||||
|
||||
def create_virtual_disk(img_name, size, adapter_type, disk_type)
|
||||
@@ -433,17 +436,7 @@ class Datastore < Storage
|
||||
raise "Could not get OpenNebula DatastorePool: #{pool.message}"
|
||||
end
|
||||
|
||||
begin
|
||||
one_ds = VCenterDriver::VIHelper.find_by_ref(OpenNebula::DatastorePool,
|
||||
"TEMPLATE/VCENTER_DS_REF",
|
||||
self["_ref"],
|
||||
vcenter_uuid,
|
||||
dpool)
|
||||
raise "Could not find OpenNebula Datastore" if one_ds.nil?
|
||||
ds_id = one_ds["ID"]
|
||||
rescue Exception => e
|
||||
raise "Error: #{e.message}"
|
||||
end
|
||||
ds_id = @one_item["ID"]
|
||||
|
||||
begin
|
||||
# Create Search Spec
|
||||
|
||||
@@ -518,6 +518,7 @@ def self.import_images(con_ops, ds_name, options)
|
||||
one_ds_ref = one_ds['TEMPLATE/VCENTER_DS_REF']
|
||||
|
||||
ds = VCenterDriver::Datastore.new_from_ref(one_ds_ref, vi_client)
|
||||
ds.one_item = one_ds #Store opennebula template for datastore
|
||||
|
||||
vcenter_uuid = vi_client.vim.serviceContent.about.instanceUuid
|
||||
|
||||
|
||||
Reference in new issue
Block a user