F #4913: Attach-nic requires the XML data of the VM

This information is passed via STDIN and not as a positional argument.
This commit is contained in:
Jaime Melis committed 2017-02-21 10:07:35 +01:00
1 parent 469ff036a7
commit e70caf3715
2 files changed
+8 -7

No files matched your search

+1 -1
View File
@@ -896,7 +896,7 @@ class ExecDriver < VirtualMachineDriver
{
:driver => :vmm,
:action => :attach_nic,
:parameters => [:deploy_id, mac, source, model, vn_mad, target, xml_data]
:parameters => [:deploy_id, mac, source, model, vn_mad, target]
},
# Execute post-boot networking setup
{
+7 -6
View File
@@ -33,11 +33,12 @@ vm_ref = ARGV[0]
mac = ARGV[1]
bridge = ARGV[2]
model = ARGV[3]
xml_data = ARGV[4]
vc_cluster_name = ARGV[-1]
drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(xml_data, 'VM')
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA')
vm_xml = drv_action.retrieve_xmlelements("VM").first
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
host_id = host['ID']
@@ -47,13 +48,13 @@ begin
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
# Setting one_item with info with xml_data including NIC to be added
vm.one_item = drv_action
# Setting one_item with info with the vm_xml including NIC to be added
vm.one_item = vm_xml
nic = {
"MAC" => mac,
"MAC" => mac,
"BRIDGE" => bridge,
"MODEL" => model
"MODEL" => model
}
vm.attach_nic(nic)