mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Bug 13662 - OVM host remain in Alert state, Unable to create deployment for OVM instance
Bug 13641 - OVM add host to OVM cluster results in host remaining in state: Alert Bug 13652 - OVM add primary storage to OVM cluster FAIL making Ovm work on Acton status 13662: resolved fixed status 13641: resolved fixed status 13652: resolved fixed reviewed-by: edison
This commit is contained in:
parent
39eed1d36d
commit
ede4c502f2
@ -74,12 +74,11 @@ public class OvmDiscoverer extends DiscovererBase implements Discoverer,
|
||||
}
|
||||
|
||||
private boolean checkIfExisted(String guid) {
|
||||
SearchCriteria2<HostVO, Long> sc = SearchCriteria2.create(HostVO.class,
|
||||
Long.class);
|
||||
SearchCriteria2<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
|
||||
sc.addAnd(sc.getEntity().getGuid(), SearchCriteria.Op.EQ, guid);
|
||||
sc.addAnd(sc.getEntity().getHypervisorType(), SearchCriteria.Op.EQ,
|
||||
HypervisorType.Ovm);
|
||||
List<Long> hosts = sc.list();
|
||||
List<HostVO> hosts = sc.list();
|
||||
return !hosts.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,8 @@ import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.CheckNetworkAnswer;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
import com.cloud.agent.api.CheckVirtualMachineAnswer;
|
||||
import com.cloud.agent.api.CheckVirtualMachineCommand;
|
||||
import com.cloud.agent.api.CleanupNetworkRulesCmd;
|
||||
@ -78,6 +80,7 @@ import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.PhysicalNetworkSetupInfo;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.ovm.object.Connection;
|
||||
@ -106,6 +109,7 @@ import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.trilead.ssh2.SCPClient;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
private static final Logger s_logger = Logger.getLogger(OvmResourceBase.class);
|
||||
@ -125,6 +129,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
String _guestNetworkName;
|
||||
boolean _canBridgeFirewall;
|
||||
static boolean _isHeartBeat = false;
|
||||
List<String> _bridges = null;
|
||||
protected HashMap<String, State> _vms = new HashMap<String, State>(50);
|
||||
static HashMap<String, State> _stateMaps;
|
||||
private final Map<String, Pair<Long, Long>> _vmNetworkStats= new ConcurrentHashMap<String, Pair<Long, Long>>();
|
||||
@ -197,26 +202,25 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
}
|
||||
|
||||
_conn = new Connection(_ip, _agentUserName, _agentPassword);
|
||||
List<String> bridges = null;
|
||||
try {
|
||||
OvmHost.registerAsMaster(_conn);
|
||||
OvmHost.registerAsVmServer(_conn);
|
||||
bridges = OvmBridge.getAllBridges(_conn);
|
||||
_bridges = OvmBridge.getAllBridges(_conn);
|
||||
} catch (XmlRpcException e) {
|
||||
s_logger.debug("Get bridges failed", e);
|
||||
throw new ConfigurationException("Cannot get bridges on host " + _ip + "," + e.getMessage());
|
||||
}
|
||||
|
||||
if (_privateNetworkName != null && !bridges.contains(_privateNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _privateNetworkName + " on host " + _ip + ", all bridges are:" + bridges);
|
||||
if (_privateNetworkName != null && !_bridges.contains(_privateNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _privateNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
|
||||
}
|
||||
|
||||
if (_publicNetworkName != null && !bridges.contains(_publicNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _publicNetworkName + " on host " + _ip + ", all bridges are:" + bridges);
|
||||
if (_publicNetworkName != null && !_bridges.contains(_publicNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _publicNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
|
||||
}
|
||||
|
||||
if (_guestNetworkName != null && !bridges.contains(_guestNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _guestNetworkName + " on host " + _ip + ", all bridges are:" + bridges);
|
||||
if (_guestNetworkName != null && !_bridges.contains(_guestNetworkName)) {
|
||||
throw new ConfigurationException("Cannot find bridge " + _guestNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
|
||||
}
|
||||
|
||||
/* set to false so each time ModifyStoragePoolCommand will re-setup heartbeat*/
|
||||
@ -1225,6 +1229,54 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
return new Answer(cmd);
|
||||
}
|
||||
|
||||
protected CheckNetworkAnswer execute(CheckNetworkCommand cmd) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Checking if network name setup is done on the resource");
|
||||
}
|
||||
|
||||
List<PhysicalNetworkSetupInfo> infoList = cmd.getPhysicalNetworkInfoList();
|
||||
|
||||
boolean errorout = false;
|
||||
String msg = "";
|
||||
for (PhysicalNetworkSetupInfo info : infoList) {
|
||||
if (!isNetworkSetupByName(info.getGuestNetworkName())) {
|
||||
msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Guest Network is not configured on the backend by name "
|
||||
+ info.getGuestNetworkName();
|
||||
errorout = true;
|
||||
break;
|
||||
}
|
||||
if (!isNetworkSetupByName(info.getPrivateNetworkName())) {
|
||||
msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Private Network is not configured on the backend by name "
|
||||
+ info.getPrivateNetworkName();
|
||||
errorout = true;
|
||||
break;
|
||||
}
|
||||
if (!isNetworkSetupByName(info.getPublicNetworkName())) {
|
||||
msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Public Network is not configured on the backend by name "
|
||||
+ info.getPublicNetworkName();
|
||||
errorout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorout) {
|
||||
s_logger.error(msg);
|
||||
return new CheckNetworkAnswer(cmd, false, msg);
|
||||
} else {
|
||||
return new CheckNetworkAnswer(cmd, true, "Network Setup check by names is done");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNetworkSetupByName(String nameTag) {
|
||||
if (nameTag != null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Looking for network setup by name " + nameTag);
|
||||
}
|
||||
return _bridges.contains(nameTag);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer executeRequest(Command cmd) {
|
||||
Class<? extends Command> clazz = cmd.getClass();
|
||||
@ -1282,6 +1334,8 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
return execute((CopyVolumeCommand)cmd);
|
||||
} else if (clazz == DeleteStoragePoolCommand.class) {
|
||||
return execute((DeleteStoragePoolCommand)cmd);
|
||||
} else if (clazz == CheckNetworkCommand.class) {
|
||||
return execute((CheckNetworkCommand)cmd);
|
||||
} else {
|
||||
return Answer.createUnsupportedCommandAnswer(cmd);
|
||||
}
|
||||
|
||||
8
server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
Normal file → Executable file
8
server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
Normal file → Executable file
@ -37,6 +37,7 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> xenAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> vmWareAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> simulatorAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> ovmAllFieldsSearch;
|
||||
|
||||
protected PhysicalNetworkTrafficTypeDaoImpl() {
|
||||
super();
|
||||
@ -69,6 +70,11 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
||||
simulatorAllFieldsSearch.selectField(simulatorAllFieldsSearch.entity().getSimulatorNetworkLabel());
|
||||
simulatorAllFieldsSearch.done();
|
||||
|
||||
ovmAllFieldsSearch = createSearchBuilder(String.class);
|
||||
ovmAllFieldsSearch.and("physicalNetworkId", ovmAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
ovmAllFieldsSearch.and("trafficType", ovmAllFieldsSearch.entity().getTrafficType(), Op.EQ);
|
||||
ovmAllFieldsSearch.selectField(ovmAllFieldsSearch.entity().getSimulatorNetworkLabel());
|
||||
ovmAllFieldsSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,6 +107,8 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
||||
sc = vmWareAllFieldsSearch.create();
|
||||
} else if (hType == HypervisorType.Simulator) {
|
||||
sc = simulatorAllFieldsSearch.create();
|
||||
} else if (hType == HypervisorType.Ovm) {
|
||||
sc = ovmAllFieldsSearch.create();
|
||||
} else {
|
||||
assert(false) : "We don't handle this hypervisor type";
|
||||
return null;
|
||||
|
||||
@ -1978,6 +1978,7 @@ CREATE TABLE `cloud`.`physical_network_traffic_types` (
|
||||
`kvm_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a KVM host',
|
||||
`vmware_network_label` varchar(255) DEFAULT 'vSwitch0' COMMENT 'The network name label of the physical device dedicated to this traffic on a VMware host',
|
||||
`simulator_network_label` varchar(255) COMMENT 'The name labels needed for identifying the simulator',
|
||||
`ovm_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a Ovm host',
|
||||
`vlan` varchar(255) COMMENT 'The vlan tag to be sent down to a VMware host',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_physical_network_traffic_types__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE,
|
||||
|
||||
@ -645,3 +645,5 @@ UPDATE `cloud`.`configuration` SET category = 'Hidden' WHERE name = 'ovm.guest.n
|
||||
UPDATE `cloud`.`configuration` SET category = 'Hidden' WHERE name = 'kvm.public.network.device';
|
||||
UPDATE `cloud`.`configuration` SET category = 'Hidden' WHERE name = 'kvm.private.network.device';
|
||||
UPDATE `cloud`.`configuration` SET category = 'Hidden' WHERE name = 'kvm.guest.network.device';
|
||||
|
||||
ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `ovm_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a Ovm host';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user