1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-12 08:58:17 +03:00

feature #2097: change vlan always in the port group

(cherry picked from commit 0b72e80ca21a60827f1c09e4a3f245ea81839607)
This commit is contained in:
Tino Vazquez 2013-06-20 16:21:51 +02:00 committed by Ruben S. Montero
parent 8836cd8ee6
commit 57a7e19578

View File

@ -79,17 +79,16 @@ class OpenNebulaVMware < OpenNebulaNetwork
# Add port group to switch in host, and sets vlan if available
def add_pg_to_switch(host, pg, switch, vlan)
# Check's first if the vSwitch exists
add_pg_cmd = "(esxcfg-vswitch vSwitch0 -l|grep #{pg})"
add_pg_cmd += "&& #{VCLI_CMD} #{switch} --add-pg #{pg}"
add_pg_cmd = "((esxcfg-vswitch vSwitch0 -l|grep #{pg})"
add_pg_cmd += "&& #{VCLI_CMD} #{switch} --add-pg #{pg})"
if vlan
add_pg_cmd = "&& #{VCLI_CMD} #{switch} -p #{pg} --vlan=#{vlan}"
add_pg_cmd = "; #{VCLI_CMD} #{switch} -p #{pg} --vlan=#{vlan}"
end
do_ssh_action(add_pg_cmd, host)
end
# Performs a remote action in host using ssh
def do_ssh_action(cmd, host)
rc = SSHCommand.run("'#{cmd}'", host, nil, nil)