432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
|
# File 'lib/ucslib/service/ucs/provision.rb', line 432
def set_san_boot_policy(json)
name = JSON.parse(json)['name']
description = JSON.parse(json)['description']
org = JSON.parse(json)['org']
vnic_a = JSON.parse(json)['vhba_a']
vnic_b = JSON.parse(json)['vhba_b']
target_a_1 = JSON.parse(json)['target_a_1']
target_a_2 = JSON.parse(json)['target_a_2']
target_b_1 = JSON.parse(json)['target_b_1']
target_b_2 = JSON.parse(json)['target_b_2']
xml_builder = Nokogiri::XML::Builder.new do |xml|
xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'true'){
xml.inConfigs{
xml.pair('key' => "org-root/org-#{org}/boot-policy-#{name}"){
xml.lsbootPolicy('descr' => "#{description}", 'dn' => "org-root/org-#{org}/boot-policy-#{name}", 'enforceVnicName' => 'no',
'name' => "#{name}", 'rebootOnUpdate' => 'no', 'status' => 'created'){
xml.lsbootStorage('order' => '1', 'rn' => 'storage'){
xml.lsbootSanImage('rn' => 'san-primary', 'status' => 'created', 'type' => 'primary', 'vnicName' => "#{vnic_a}"){
xml.lsbootSanImagePath('lun' => '0', 'rn' => 'path-primary', 'status' => 'created', 'type' => 'primary', 'wwn' => "#{target_a_1}")
xml.lsbootSanImagePath('lun' => '0', 'rn' => 'path-secondary', 'status' => 'created', 'type' => 'secondary', 'wwn' => "#{target_a_2}")
}
xml.lsbootSanImage('rn' => 'san-secondary', 'status' => 'created', 'type' => 'secondary', 'vnicName' => "#{vnic_b}"){
xml.lsbootSanImagePath('lun' => '0', 'rn' => 'path-primary', 'status' => 'created', 'type' => 'primary', 'wwn' => "#{target_b_1}")
xml.lsbootSanImagePath('lun' => '0', 'rn' => 'path-secondary', 'status' => 'created', 'type' => 'secondary', 'wwn' => "#{target_b_2}")
}
}
}
}
}
}
end
set_san_boot_policy_xml = xml_builder.to_xml.to_s
begin
rest_post(set_san_boot_policy_xml,@url)
rescue Exception => e
raise "Error #{e}"
end
end
|