feature #2097: change vlan always in the port group

(cherry picked from commit 0b72e80ca21a60827f1c09e4a3f245ea81839607)
This commit is contained in:
Tino Vazquez authored and Ruben S. Montero committed 2013-07-01 13:45:49 +02:00
1 parent a0e8fa6e0a
commit 32232a1566
1 file changed
+3 -4
+3 -4
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)