mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
F #4913: No need to specify DC_REF in the datastore template any more
This commit is contained in:
1 parent
31e9fc97e3
commit
b2ca3a547c
2 files changed
+3
-6
No files matched your search
@@ -53,7 +53,6 @@ drv_action.initialize_xml(Base64.decode64(drv_action_enc), 'DS_DRIVER_ACTION_DAT
|
||||
|
||||
ds_ref = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_DS_REF"]
|
||||
host_id = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_CLUSTER"]
|
||||
dc_ref = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_DC_REF"]
|
||||
img_id = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/ID"]
|
||||
adapter_type = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/ADAPTER_TYPE"]
|
||||
disk_type = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/DISK_TYPE"]
|
||||
@@ -66,7 +65,6 @@ check_valid adapter_type, "adapter_type"
|
||||
check_valid disk_type, "disk_type"
|
||||
check_valid size, "size"
|
||||
check_valid ds_ref, "ds_ref"
|
||||
check_valid dc_ref, "dc_ref"
|
||||
|
||||
# TODO path in vCenter? choose a specific directory
|
||||
|
||||
@@ -80,9 +78,8 @@ end
|
||||
begin
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
ds = VCenterDriver::Datastore.new_from_ref(ds_ref, vi_client)
|
||||
dc = VCenterDriver::Datacenter.new_from_ref(dc_ref, vi_client)
|
||||
|
||||
puts ds.create_virtual_disk(dc, img_name, size, adapter_type, disk_type)
|
||||
puts ds.create_virtual_disk(img_name, size, adapter_type, disk_type)
|
||||
rescue Exception => e
|
||||
STDERR.puts "Error creating virtual disk #{img_src}."\
|
||||
" Reason: #{e.message}"
|
||||
|
||||
@@ -74,7 +74,7 @@ class Datastore
|
||||
"USED_MB=#{used_mb}\nFREE_MB=#{free_mb} \nTOTAL_MB=#{total_mb}"
|
||||
end
|
||||
|
||||
def create_virtual_disk(dc, img_name, size, adapter_type, disk_type)
|
||||
def create_virtual_disk(img_name, size, adapter_type, disk_type)
|
||||
ds_name = self['name']
|
||||
|
||||
vmdk_spec = RbVmomi::VIM::FileBackedVirtualDiskSpec(
|
||||
@@ -84,7 +84,7 @@ class Datastore
|
||||
)
|
||||
|
||||
get_vdm.CreateVirtualDisk_Task(
|
||||
:datacenter => dc.item,
|
||||
:datacenter => get_dc.item,
|
||||
:name => "[#{ds_name}] #{img_name}.vmdk",
|
||||
:spec => vmdk_spec
|
||||
).wait_for_completion
|
||||
|
||||
Reference in new issue
Block a user