Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B #1841 Improve error message when Import Wild or VM Template with disks without back reference #1849

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,22 @@ def import_vcenter_disks(vc_uuid, dpool, ipool, type, sunstone=false)
allocated_images = []

vc_disks.each do |disk|
datastore_found = VCenterDriver::Storage.get_one_image_ds_by_ref_and_dc(disk[:datastore]._ref,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good, just a style comment, please do not use so many empty lines. for instance, the begin rescue block should look:

begin
ds_ref = disk[:datastore]._ref
rescue
raise "The ISO #{disk[:path_wo_ds].name} cannot be found because the datastore was removed or deleted"
end

ds_ref = nil

begin

ds_ref = disk[:datastore]._ref
rescue

raise "The ISO #{disk[:path_wo_ds].name} cannot be found because the datastore was removed or deleted"
end

datastore_found = VCenterDriver::Storage.get_one_image_ds_by_ref_and_dc(ds_ref,
dc_ref,
vc_uuid,
dpool)

if datastore_found.nil?
error = "\n ERROR: datastore #{disk[:datastore].name}: has to be imported first as an image datastore!\n"

Expand Down Expand Up @@ -522,7 +534,7 @@ def import_vcenter_nics(vc_uuid, npool, hpool, vcenter_instance_name,
def get_vcenter_disk_key(unit_number, controller_key)

key = nil

@item["config.hardware.device"].each do |device|
disk = {}

Expand Down