mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Summary: Begone pesky tabs
This commit is contained in:
parent
f09d453efe
commit
2d69a1855d
@ -86,7 +86,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||||||
vlanId = broadcastUri.getHost();
|
vlanId = broadcastUri.getHost();
|
||||||
}
|
}
|
||||||
else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
||||||
throw new InternalErrorException("Nicira NVP Logicalswitches are not supported by the BridgeVifDriver");
|
throw new InternalErrorException("Nicira NVP Logicalswitches are not supported by the BridgeVifDriver");
|
||||||
}
|
}
|
||||||
String trafficLabel = nic.getName();
|
String trafficLabel = nic.getName();
|
||||||
if (nic.getType() == Networks.TrafficType.Guest) {
|
if (nic.getType() == Networks.TrafficType.Guest) {
|
||||||
|
|||||||
@ -364,7 +364,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
private int _dom0MinMem;
|
private int _dom0MinMem;
|
||||||
|
|
||||||
protected enum BridgeType {
|
protected enum BridgeType {
|
||||||
NATIVE, OPENVSWITCH
|
NATIVE, OPENVSWITCH
|
||||||
}
|
}
|
||||||
|
|
||||||
protected enum defineOps {
|
protected enum defineOps {
|
||||||
@ -483,10 +483,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
|
|
||||||
String bridgeType = (String) params.get("network.bridge.type");
|
String bridgeType = (String) params.get("network.bridge.type");
|
||||||
if (bridgeType == null) {
|
if (bridgeType == null) {
|
||||||
_bridgeType = BridgeType.NATIVE;
|
_bridgeType = BridgeType.NATIVE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_bridgeType = BridgeType.valueOf(bridgeType.toUpperCase());
|
_bridgeType = BridgeType.valueOf(bridgeType.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
params.put("domr.scripts.dir", domrScriptsDir);
|
params.put("domr.scripts.dir", domrScriptsDir);
|
||||||
@ -664,19 +664,18 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
|
|
||||||
LibvirtConnection.initialize(_hypervisorURI);
|
LibvirtConnection.initialize(_hypervisorURI);
|
||||||
Connect conn = null;
|
Connect conn = null;
|
||||||
try {
|
try {
|
||||||
conn = LibvirtConnection.getConnection();
|
conn = LibvirtConnection.getConnection();
|
||||||
|
|
||||||
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
||||||
if (conn.getLibVirVersion() < (9 * 1000 + 11)) {
|
if (conn.getLibVirVersion() < (9 * 1000 + 11)) {
|
||||||
throw new ConfigurationException(
|
throw new ConfigurationException("LibVirt version 0.9.11 required for openvswitch support, but version "
|
||||||
"LibVirt version 0.9.11 required for openvswitch support, but version "
|
+ conn.getLibVirVersion() + " detected");
|
||||||
+ conn.getLibVirVersion() + " detected");
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (LibvirtException e) {
|
||||||
} catch (LibvirtException e) {
|
throw new CloudRuntimeException(e.getMessage());
|
||||||
throw new CloudRuntimeException(e.getMessage());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Does node support HVM guest? If not, exit */
|
/* Does node support HVM guest? If not, exit */
|
||||||
if (!IsHVMEnabled(conn)) {
|
if (!IsHVMEnabled(conn)) {
|
||||||
@ -720,14 +719,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (_bridgeType) {
|
switch (_bridgeType) {
|
||||||
case NATIVE:
|
|
||||||
getPifs();
|
|
||||||
break;
|
|
||||||
case OPENVSWITCH:
|
case OPENVSWITCH:
|
||||||
getOvsPifs();
|
getOvsPifs();
|
||||||
break;
|
break;
|
||||||
|
case NATIVE:
|
||||||
|
default:
|
||||||
|
getPifs();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pifs.get("private") == null) {
|
if (_pifs.get("private") == null) {
|
||||||
s_logger.debug("Failed to get private nic name");
|
s_logger.debug("Failed to get private nic name");
|
||||||
throw new ConfigurationException("Failed to get private nic name");
|
throw new ConfigurationException("Failed to get private nic name");
|
||||||
@ -786,31 +786,29 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
// Load the vif driver
|
// Load the vif driver
|
||||||
String vifDriverName = (String) params.get("libvirt.vif.driver");
|
String vifDriverName = (String) params.get("libvirt.vif.driver");
|
||||||
if (vifDriverName == null) {
|
if (vifDriverName == null) {
|
||||||
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
||||||
s_logger.info("No libvirt.vif.driver specififed. Defaults to OvsVifDriver.");
|
s_logger.info("No libvirt.vif.driver specififed. Defaults to OvsVifDriver.");
|
||||||
vifDriverName = "com.cloud.hypervisor.kvm.resource.OvsVifDriver";
|
vifDriverName = "com.cloud.hypervisor.kvm.resource.OvsVifDriver";
|
||||||
}
|
} else {
|
||||||
else {
|
s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver.");
|
||||||
s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver.");
|
vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver";
|
||||||
vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver";
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
params.put("libvirt.computing.resource", (Object) this);
|
params.put("libvirt.computing.resource", (Object) this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName(vifDriverName);
|
Class<?> clazz = Class.forName(vifDriverName);
|
||||||
_vifDriver = (VifDriver) clazz.newInstance();
|
_vifDriver = (VifDriver) clazz.newInstance();
|
||||||
_vifDriver.configure(params);
|
_vifDriver.configure(params);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e);
|
throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e);
|
throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e);
|
throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,15 +832,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getOvsPifs() {
|
private void getOvsPifs() {
|
||||||
String cmdout = Script.runSimpleBashScript("ovs-vsctl list-br | sed '{:q;N;s/\\n/%/g;t q}'");
|
String cmdout = Script.runSimpleBashScript("ovs-vsctl list-br | sed '{:q;N;s/\\n/%/g;t q}'");
|
||||||
s_logger.debug("cmdout was " + cmdout);
|
s_logger.debug("cmdout was " + cmdout);
|
||||||
List<String> bridges = Arrays.asList(cmdout.split("%"));
|
List<String> bridges = Arrays.asList(cmdout.split("%"));
|
||||||
for (String bridge : bridges) {
|
for (String bridge : bridges) {
|
||||||
s_logger.debug("looking for pif for bridge " + bridge);
|
s_logger.debug("looking for pif for bridge " + bridge);
|
||||||
//String pif = getOvsPif(bridge);
|
// String pif = getOvsPif(bridge);
|
||||||
// Not really interested in the pif name at this point for ovs bridges
|
// Not really interested in the pif name at this point for ovs
|
||||||
|
// bridges
|
||||||
String pif = bridge;
|
String pif = bridge;
|
||||||
if(_publicBridgeName != null && bridge.equals(_publicBridgeName)){
|
if (_publicBridgeName != null && bridge.equals(_publicBridgeName)) {
|
||||||
_pifs.put("public", pif);
|
_pifs.put("public", pif);
|
||||||
}
|
}
|
||||||
if (_guestBridgeName != null && bridge.equals(_guestBridgeName)) {
|
if (_guestBridgeName != null && bridge.equals(_guestBridgeName)) {
|
||||||
@ -850,7 +849,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
}
|
}
|
||||||
_pifs.put(bridge, pif);
|
_pifs.put(bridge, pif);
|
||||||
}
|
}
|
||||||
s_logger.debug("done looking for pifs, no more bridges");
|
s_logger.debug("done looking for pifs, no more bridges");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPif(String bridge) {
|
private String getPif(String bridge) {
|
||||||
@ -875,10 +874,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
if (_bridgeType == BridgeType.OPENVSWITCH) {
|
||||||
return checkOvsNetwork(networkName);
|
return checkOvsNetwork(networkName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return checkBridgeNetwork(networkName);
|
return checkBridgeNetwork(networkName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,11 +896,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkOvsNetwork(String networkName) {
|
private boolean checkOvsNetwork(String networkName) {
|
||||||
s_logger.debug("Checking if network " + networkName + " exists as openvswitch bridge");
|
s_logger.debug("Checking if network " + networkName + " exists as openvswitch bridge");
|
||||||
if (networkName == null) {
|
if (networkName == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Script command = new Script("/bin/sh", _timeout);
|
Script command = new Script("/bin/sh", _timeout);
|
||||||
command.add("-c");
|
command.add("-c");
|
||||||
command.add("ovs-vsctl br-exists " + networkName);
|
command.add("ovs-vsctl br-exists " + networkName);
|
||||||
|
|||||||
@ -700,27 +700,27 @@ public class LibvirtVMDef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setVirtualPortType(String virtualPortType) {
|
public void setVirtualPortType(String virtualPortType) {
|
||||||
_virtualPortType = virtualPortType;
|
_virtualPortType = virtualPortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVirtualPortType() {
|
public String getVirtualPortType() {
|
||||||
return _virtualPortType;
|
return _virtualPortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVirtualPortInterfaceId(String virtualPortInterfaceId) {
|
public void setVirtualPortInterfaceId(String virtualPortInterfaceId) {
|
||||||
_virtualPortInterfaceId = virtualPortInterfaceId;
|
_virtualPortInterfaceId = virtualPortInterfaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVirtualPortInterfaceId() {
|
public String getVirtualPortInterfaceId() {
|
||||||
return _virtualPortInterfaceId;
|
return _virtualPortInterfaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVlanTag(int vlanTag) {
|
public void setVlanTag(int vlanTag) {
|
||||||
_vlanTag = vlanTag;
|
_vlanTag = vlanTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVlanTag() {
|
public int getVlanTag() {
|
||||||
return _vlanTag;
|
return _vlanTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -742,14 +742,14 @@ public class LibvirtVMDef {
|
|||||||
netBuilder.append("<model type='" + _model + "'/>\n");
|
netBuilder.append("<model type='" + _model + "'/>\n");
|
||||||
}
|
}
|
||||||
if (_virtualPortType != null) {
|
if (_virtualPortType != null) {
|
||||||
netBuilder.append("<virtualport type='" + _virtualPortType + "'>\n");
|
netBuilder.append("<virtualport type='" + _virtualPortType + "'>\n");
|
||||||
if (_virtualPortInterfaceId != null) {
|
if (_virtualPortInterfaceId != null) {
|
||||||
netBuilder.append("<parameters interfaceid='" + _virtualPortInterfaceId + "'/>\n");
|
netBuilder.append("<parameters interfaceid='" + _virtualPortInterfaceId + "'/>\n");
|
||||||
}
|
}
|
||||||
netBuilder.append("</virtualport>\n");
|
netBuilder.append("</virtualport>\n");
|
||||||
}
|
}
|
||||||
if (_vlanTag != -1) {
|
if (_vlanTag != -1) {
|
||||||
netBuilder.append("<vlan trunk='no'>\n<tag id='" + _vlanTag + "'/>\n</vlan>");
|
netBuilder.append("<vlan trunk='no'>\n<tag id='" + _vlanTag + "'/>\n</vlan>");
|
||||||
}
|
}
|
||||||
netBuilder.append("</interface>\n");
|
netBuilder.append("</interface>\n");
|
||||||
return netBuilder.toString();
|
return netBuilder.toString();
|
||||||
|
|||||||
@ -36,16 +36,15 @@ import com.cloud.utils.script.OutputInterpreter;
|
|||||||
import com.cloud.utils.script.Script;
|
import com.cloud.utils.script.Script;
|
||||||
|
|
||||||
public class OvsVifDriver extends VifDriverBase {
|
public class OvsVifDriver extends VifDriverBase {
|
||||||
private static final Logger s_logger = Logger
|
private static final Logger s_logger = Logger.getLogger(OvsVifDriver.class);
|
||||||
.getLogger(OvsVifDriver.class);
|
|
||||||
private int _timeout;
|
private int _timeout;
|
||||||
private String _modifyVlanPath;
|
private String _modifyVlanPath;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(Map<String, Object> params) throws ConfigurationException {
|
public void configure(Map<String, Object> params) throws ConfigurationException {
|
||||||
super.configure(params);
|
super.configure(params);
|
||||||
|
|
||||||
String networkScriptsDir = (String) params.get("network.scripts.dir");
|
String networkScriptsDir = (String) params.get("network.scripts.dir");
|
||||||
if (networkScriptsDir == null) {
|
if (networkScriptsDir == null) {
|
||||||
networkScriptsDir = "scripts/vm/network/vnet";
|
networkScriptsDir = "scripts/vm/network/vnet";
|
||||||
}
|
}
|
||||||
@ -58,12 +57,12 @@ public class OvsVifDriver extends VifDriverBase {
|
|||||||
throw new ConfigurationException("Unable to find modifyvlan.sh");
|
throw new ConfigurationException("Unable to find modifyvlan.sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
createControlNetwork(_bridges.get("linklocal"));
|
createControlNetwork(_bridges.get("linklocal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InterfaceDef plug(NicTO nic, String guestOsType)
|
public InterfaceDef plug(NicTO nic, String guestOsType)
|
||||||
throws InternalErrorException, LibvirtException {
|
throws InternalErrorException, LibvirtException {
|
||||||
s_logger.debug("plugging nic=" + nic);
|
s_logger.debug("plugging nic=" + nic);
|
||||||
|
|
||||||
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
|
LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
|
||||||
@ -76,7 +75,7 @@ public class OvsVifDriver extends VifDriverBase {
|
|||||||
vlanId = broadcastUri.getHost();
|
vlanId = broadcastUri.getHost();
|
||||||
}
|
}
|
||||||
else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
||||||
logicalSwitchUuid = nic.getBroadcastUri().getSchemeSpecificPart();
|
logicalSwitchUuid = nic.getBroadcastUri().getSchemeSpecificPart();
|
||||||
}
|
}
|
||||||
String trafficLabel = nic.getName();
|
String trafficLabel = nic.getName();
|
||||||
if (nic.getType() == Networks.TrafficType.Guest) {
|
if (nic.getType() == Networks.TrafficType.Guest) {
|
||||||
@ -91,11 +90,11 @@ public class OvsVifDriver extends VifDriverBase {
|
|||||||
intf.setVlanTag(Integer.parseInt(vlanId));
|
intf.setVlanTag(Integer.parseInt(vlanId));
|
||||||
}
|
}
|
||||||
} else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
} else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
|
||||||
s_logger.debug("nic " + nic + " needs to be connected to LogicalSwitch " + logicalSwitchUuid);
|
s_logger.debug("nic " + nic + " needs to be connected to LogicalSwitch " + logicalSwitchUuid);
|
||||||
intf.setVirtualPortInterfaceId(nic.getUuid());
|
intf.setVirtualPortInterfaceId(nic.getUuid());
|
||||||
String brName = (trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("private");
|
String brName = (trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("private");
|
||||||
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType));
|
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
intf.defBridgeNet(_bridges.get("guest"), null, nic.getMac(), getGuestNicModel(guestOsType));
|
intf.defBridgeNet(_bridges.get("guest"), null, nic.getMac(), getGuestNicModel(guestOsType));
|
||||||
}
|
}
|
||||||
@ -127,11 +126,11 @@ public class OvsVifDriver extends VifDriverBase {
|
|||||||
return intf;
|
return intf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unplug(InterfaceDef iface) {
|
public void unplug(InterfaceDef iface) {
|
||||||
// Libvirt apparently takes care of this, see BridgeVifDriver unplug
|
// Libvirt apparently takes care of this, see BridgeVifDriver unplug
|
||||||
}
|
}
|
||||||
|
|
||||||
private String setVnetBrName(String pifName, String vnetId) {
|
private String setVnetBrName(String pifName, String vnetId) {
|
||||||
String brName = "br" + pifName + "-"+ vnetId;
|
String brName = "br" + pifName + "-"+ vnetId;
|
||||||
String oldStyleBrName = "cloudVirBr" + vnetId;
|
String oldStyleBrName = "cloudVirBr" + vnetId;
|
||||||
@ -167,14 +166,13 @@ public class OvsVifDriver extends VifDriverBase {
|
|||||||
NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway());
|
NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createControlNetwork(String privBrName) {
|
private void createControlNetwork(String privBrName) {
|
||||||
deleteExitingLinkLocalRoutTable(privBrName);
|
deleteExitingLinkLocalRoutTable(privBrName);
|
||||||
if (!isBridgeExists(privBrName)) {
|
if (!isBridgeExists(privBrName)) {
|
||||||
Script.runSimpleBashScript("ovs-vsctl add-br " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " +
|
Script.runSimpleBashScript("ovs-vsctl add-br " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " +
|
||||||
privBrName + " 169.254.0.1", _timeout);
|
privBrName + " 169.254.0.1", _timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBridgeExists(String bridgeName) {
|
private boolean isBridgeExists(String bridgeName) {
|
||||||
|
|||||||
@ -38,10 +38,10 @@ public class KVMStoragePoolManager {
|
|||||||
private final Map<String, StorageAdaptor> _storageMapper = new HashMap<String, StorageAdaptor>();
|
private final Map<String, StorageAdaptor> _storageMapper = new HashMap<String, StorageAdaptor>();
|
||||||
|
|
||||||
private StorageAdaptor getStorageAdaptor(StoragePoolType type) {
|
private StorageAdaptor getStorageAdaptor(StoragePoolType type) {
|
||||||
// type can be null: LibVirtComputingResource:3238
|
// type can be null: LibVirtComputingResource:3238
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return _storageMapper.get("libvirt");
|
return _storageMapper.get("libvirt");
|
||||||
}
|
}
|
||||||
StorageAdaptor adaptor = _storageMapper.get(type.toString());
|
StorageAdaptor adaptor = _storageMapper.get(type.toString());
|
||||||
if (adaptor == null) {
|
if (adaptor == null) {
|
||||||
// LibvirtStorageAdaptor is selected by default
|
// LibvirtStorageAdaptor is selected by default
|
||||||
|
|||||||
@ -200,56 +200,58 @@ public class Script implements Callable<String> {
|
|||||||
s_executors.execute(task);
|
s_executors.execute(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
if (_process.waitFor() == 0) {
|
if (_process.waitFor() == 0) {
|
||||||
_logger.debug("Execution is successful.");
|
_logger.debug("Execution is successful.");
|
||||||
if (interpreter != null) {
|
if (interpreter != null) {
|
||||||
return interpreter.drain() ? task.getResult() : interpreter.interpret(ir);
|
return interpreter.drain() ? task.getResult() : interpreter.interpret(ir);
|
||||||
}
|
} else {
|
||||||
else {
|
// null return is ok apparently
|
||||||
// null return is ok apparently
|
return (_process.exitValue() == 0) ? "Ok" : "Failed, exit code " + _process.exitValue();
|
||||||
return (_process.exitValue() == 0) ? "Ok" : "Failed, exit code " + _process.exitValue();
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
} catch (InterruptedException e) {
|
if (!_isTimeOut) {
|
||||||
if (!_isTimeOut) {
|
/*
|
||||||
/* This is not timeout, we are interrupted by others, continue */
|
* This is not timeout, we are interrupted by others,
|
||||||
_logger.debug("We are interrupted but it's not a timeout, just continue");
|
* continue
|
||||||
continue;
|
*/
|
||||||
}
|
_logger.debug("We are interrupted but it's not a timeout, just continue");
|
||||||
|
continue;
|
||||||
TimedOutLogger log = new TimedOutLogger(_process);
|
}
|
||||||
Task timedoutTask = new Task(log, ir);
|
|
||||||
|
|
||||||
timedoutTask.run();
|
TimedOutLogger log = new TimedOutLogger(_process);
|
||||||
if (!_passwordCommand) {
|
Task timedoutTask = new Task(log, ir);
|
||||||
_logger.warn("Timed out: " + buildCommandLine(command) + ". Output is: " + timedoutTask.getResult());
|
|
||||||
} else {
|
|
||||||
_logger.warn("Timed out: " + buildCommandLine(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ERR_TIMEOUT;
|
timedoutTask.run();
|
||||||
} finally {
|
if (!_passwordCommand) {
|
||||||
if (future != null) {
|
_logger.warn("Timed out: " + buildCommandLine(command) + ". Output is: " + timedoutTask.getResult());
|
||||||
future.cancel(false);
|
} else {
|
||||||
}
|
_logger.warn("Timed out: " + buildCommandLine(command));
|
||||||
Thread.interrupted();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.debug("Exit value is " + _process.exitValue());
|
return ERR_TIMEOUT;
|
||||||
|
} finally {
|
||||||
|
if (future != null) {
|
||||||
|
future.cancel(false);
|
||||||
|
}
|
||||||
|
Thread.interrupted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.debug("Exit value is " + _process.exitValue());
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(_process.getInputStream()), 128);
|
BufferedReader reader = new BufferedReader(new InputStreamReader(_process.getInputStream()), 128);
|
||||||
|
|
||||||
String error;
|
String error;
|
||||||
if (interpreter != null) {
|
if (interpreter != null) {
|
||||||
error = interpreter.processError(reader);
|
error = interpreter.processError(reader);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error = "Non zero exit code : " + _process.exitValue();
|
error = "Non zero exit code : " + _process.exitValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logger.isDebugEnabled()) {
|
if (_logger.isDebugEnabled()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user