public void enableVncOnHostFirewall() throws Exception { HostFirewallSystemMO firewallMo = getHostFirewallSystemMO(); boolean bRefresh = false; if (firewallMo != null) { HostFirewallInfo firewallInfo = firewallMo.getFirewallInfo(); if (firewallInfo != null && firewallInfo.getRuleset() != null) { for (HostFirewallRuleset rule : firewallInfo.getRuleset()) { if ("vncServer".equalsIgnoreCase(rule.getKey())) { bRefresh = true; firewallMo.enableRuleset("vncServer"); } else if ("gdbserver".equalsIgnoreCase(rule.getKey())) { bRefresh = true; firewallMo.enableRuleset("gdbserver"); } } } if (bRefresh) firewallMo.refreshFirewall(); } }
public HostFirewallInfo getFirewallInfo() throws Exception { return (HostFirewallInfo)_context.getVimClient().getDynamicProperty(_mor, "firewallInfo"); }