mirror of https://github.com/apache/cloudstack.git
Merge branch '2.2.y' of ssh://git.cloud.com/var/lib/git/cloudstack-oss into 2.2.y
This commit is contained in:
commit
c023db10cc
|
|
@ -607,6 +607,8 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
try {
|
||||
task.getLink().send(request.toBytes());
|
||||
//if i can send pingcommand out, means the link is ok
|
||||
setLastPingResponseTime();
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,18 @@ public class FenceCommand extends Command {
|
|||
String vmName;
|
||||
String hostGuid;
|
||||
String hostIp;
|
||||
boolean inSeq;
|
||||
|
||||
public FenceCommand(VirtualMachine vm, Host host) {
|
||||
super();
|
||||
vmName = vm.getInstanceName();
|
||||
hostGuid = host.getGuid();
|
||||
hostIp = host.getPrivateIpAddress();
|
||||
inSeq = false;
|
||||
}
|
||||
|
||||
public void setSeq(boolean inseq) {
|
||||
inSeq = inseq;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
|
|
@ -51,6 +57,6 @@ public class FenceCommand extends Command {
|
|||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
return inSeq;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ import com.cloud.api.ApiConstants;
|
|||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.CommandType;
|
||||
import com.cloud.api.response.RegisterResponse;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
|
@ -50,7 +47,7 @@ public class UpdateHostPasswordCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="the username for the host/cluster")
|
||||
private String username;
|
||||
|
||||
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="the password for the host/cluster")
|
||||
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="the new password for the host/cluster")
|
||||
private String password;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -6644,7 +6644,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
}
|
||||
|
||||
protected HashMap<String, Pair<String, State>> fullClusterSync(Connection conn) {
|
||||
XenServerPoolVms vms = new XenServerPoolVms();
|
||||
synchronized (_cluster.intern()) {
|
||||
s_vms.clear(_cluster);
|
||||
}
|
||||
try {
|
||||
Map<VM, VM.Record> vm_map = VM.getAllRecords(conn); //USE THIS TO GET ALL VMS FROM A CLUSTER
|
||||
for (VM.Record record: vm_map.values()) {
|
||||
|
|
@ -6658,7 +6660,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
String host_uuid = null;
|
||||
if( ! isRefNull(host) ) {
|
||||
host_uuid = host.getUuid(conn);
|
||||
vms.put(_cluster, host_uuid, vm_name, state);
|
||||
synchronized (_cluster.intern()) {
|
||||
s_vms.put(_cluster, host_uuid, vm_name, state);
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("VM " + vm_name + ": powerstate = " + ps + "; vm state=" + state.toString());
|
||||
|
|
@ -6669,7 +6673,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
s_logger.warn(msg, e);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
return vms.getClusterVmState(_cluster);
|
||||
return s_vms.getClusterVmState(_cluster);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ public class XenServer56FP1Resource extends XenServer56Resource {
|
|||
}
|
||||
}
|
||||
}
|
||||
//remove the VM from s_vms
|
||||
synchronized (_cluster.intern()) {
|
||||
s_logger.info("Fence command for VM " + vm.getNameLabel(conn));
|
||||
s_vms.remove(_cluster, _name, vm.getNameLabel(conn));
|
||||
}
|
||||
}
|
||||
return new FenceAnswer(cmd);
|
||||
} catch (XmlRpcException e) {
|
||||
|
|
|
|||
|
|
@ -224,6 +224,11 @@ public class XenServer56Resource extends CitrixResourceBase {
|
|||
for (VM vm : vms) {
|
||||
vm.powerStateReset(conn);
|
||||
vm.destroy(conn);
|
||||
//remove the VM from s_vms
|
||||
synchronized (_cluster.intern()) {
|
||||
s_logger.info("Fence command for VM " + vm.getNameLabel(conn));
|
||||
s_vms.remove(_cluster, _name, vm.getNameLabel(conn));
|
||||
}
|
||||
}
|
||||
return new FenceAnswer(cmd);
|
||||
} catch (XmlRpcException e) {
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class KVMFencer implements FenceBuilder {
|
|||
|
||||
List<HostVO> hosts = _hostDao.listByCluster(host.getClusterId());
|
||||
FenceCommand fence = new FenceCommand(vm, host);
|
||||
fence.setSeq(true);
|
||||
|
||||
for (HostVO h : hosts) {
|
||||
if (h.getHypervisorType() == HypervisorType.KVM) {
|
||||
|
|
|
|||
|
|
@ -4761,18 +4761,10 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
throw new InvalidParameterValueException("You should provide one of cluster id or a host id.");
|
||||
} else if (cmd.getClusterId() == null) {
|
||||
HostVO host = _hostDao.findById(cmd.getHostId());
|
||||
if (host == null){
|
||||
throw new InvalidParameterValueException("The hostId " +cmd.getHostId()+ " doesnt exist");
|
||||
}if (host.getHypervisorType() != HypervisorType.KVM) {
|
||||
throw new InvalidParameterValueException("This operation is not permitted for " + host.getHypervisorType() + " with the parameter hostId");
|
||||
}
|
||||
DetailVO nv = _detailsDao.findDetail(host.getId(), ApiConstants.USERNAME);
|
||||
if (nv.getValue().equals(cmd.getUsername())) {
|
||||
DetailVO nvp = new DetailVO(host.getId(), ApiConstants.PASSWORD, cmd.getPassword());
|
||||
nvp.setValue(cmd.getPassword());
|
||||
_detailsDao.persist(nvp);
|
||||
} else {
|
||||
throw new InvalidParameterValueException("The username is not under use by management server.");
|
||||
if (host != null && host.getHypervisorType() == HypervisorType.XenServer) {
|
||||
throw new InvalidParameterValueException("You should provide cluster id for Xenserver cluster.");
|
||||
}else {
|
||||
throw new InvalidParameterValueException("This operation is not supported for this hypervisor type");
|
||||
}
|
||||
} else {
|
||||
ClusterVO cluster = _clusterDao.findById(cmd.getClusterId());
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||
if(ocs != null) {
|
||||
for(ObjectContent oc : ocs) {
|
||||
DatastoreSummary dsSummary = (DatastoreSummary)VmwareHelper.getPropValue(oc, "summary");
|
||||
if(dsSummary.getMultipleHostAccess() == false) {
|
||||
if(dsSummary.getMultipleHostAccess() == false && dsSummary.isAccessible() && dsSummary.getType().equalsIgnoreCase("vmfs")) {
|
||||
ManagedObjectReference morDs = oc.getObj();
|
||||
String name = (String)VmwareHelper.getPropValue(oc, "name");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue