bug 8380: use instance name

status  8380: resolved fixed
This commit is contained in:
Chiradeep Vittal 2011-02-22 13:47:42 -08:00
parent 154794d94c
commit c8842c33e7
3 changed files with 13 additions and 4 deletions

View File

@ -234,6 +234,8 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
protected String _storageNetworkName2;
protected String _guestNetworkName;
protected int _wait;
protected String _instance; //instance name (default is usually "VM")
protected IAgentControl _agentControl;
protected Map<String, String> _domrIPMap = new ConcurrentHashMap<String, String>();
@ -638,7 +640,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
if (!_canBridgeFirewall) {
return new Answer(cmd, true, null);
}
String result = callHostPlugin("cleanup_rules");
String result = callHostPlugin("cleanup_rules", "instance", _instance);
int numCleaned = Integer.parseInt(result);
if (result == null || result.isEmpty() || (numCleaned < 0)) {
s_logger.warn("Failed to cleanup rules for host " + _host.ip);
@ -3547,7 +3549,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
}
protected boolean can_bridge_firewall() {
return Boolean.valueOf(callHostPlugin("can_bridge_firewall", "host_uuid", _host.uuid));
return Boolean.valueOf(callHostPlugin("can_bridge_firewall", "host_uuid", _host.uuid, "instance", _instance));
}
protected boolean getHostInfo() throws IllegalArgumentException{
@ -4277,6 +4279,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
_privateNetworkName = (String) params.get("private.network.device");
_publicNetworkName = (String) params.get("public.network.device");
_guestNetworkName = (String)params.get("guest.network.device");
_instance = (String) params.get("instance.name");
_linkLocalPrivateNetworkName = (String) params.get("private.linkLocal.device");
if (_linkLocalPrivateNetworkName == null)

View File

@ -1926,11 +1926,14 @@ def cleanup_rules_for_dead_vms(session):
util.SMlog("Failed to cleanup rules for dead vms!")
@echo
def cleanup_rules(session, args):
instance = args.get('instance')
if not instance:
instance = 'VM'
try:
chainscmd = "iptables-save | grep '^:' | awk '{print $1}' | cut -d':' -f2 | sed 's/-def/-VM/'|sort|uniq"
chainscmd = "iptables-save | grep '^:' | awk '{print $1}' | cut -d':' -f2 | sed 's/-def/-%s/'|sort|uniq" % instance
chains = util.pread2(['/bin/bash', '-c', chainscmd]).split('\n')
cleaned = 0
cleanup = []

View File

@ -87,6 +87,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
protected String _increase;
protected boolean _checkHvm;
protected String _guestNic;
protected String _instance;
@Inject protected AlertManager _alertMgr;
@Inject protected AgentManager _agentMgr;
@ -242,6 +243,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
params.put(Config.Wait.toString().toLowerCase(), Integer.toString(_wait));
details.put(Config.Wait.toString().toLowerCase(), Integer.toString(_wait));
params.put(Config.InstanceName.toString().toLowerCase(), _instance);
try {
resource.configure("Xen Server", params);
} catch (ConfigurationException e) {
@ -441,6 +443,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
_guestNic = _params.get(Config.XenGuestNetwork.key());
_increase = _params.get(Config.XenPreallocatedLunSizeRange.key());
_instance = _params.get(Config.InstanceName.key());
String value = _params.get(Config.Wait.toString());
_wait = NumbersUtil.parseInt(value, Integer.parseInt(Config.Wait.getDefaultValue()));