CLOUDSTACK-2567 - Check whether DMC - dynamic memory control is enabled for the hyervisor before trying to scale the vm. If its not then dont scale and instead throw and exception.

This commit is contained in:
Nitin Mehta 2013-05-21 16:36:10 +05:30
parent 2adc8e9a03
commit a58ee74e1c
2 changed files with 11 additions and 1 deletions

View File

@ -660,6 +660,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Connection conn = getConnection();
Set<VM> vms = VM.getByNameLabel(conn, vmName);
Host host = Host.getByUuid(conn, _host.uuid);
// If DMC is not enable then dont execute this command.
if (isDmcEnabled(conn, host)) {
String msg = "Unable to scale the vm: " + vmName + " as DMC - Dynamic memory control is not enabled for the XenServer:" + _host.uuid + " ,check your license and hypervisor version.";
s_logger.info(msg);
return new ScaleVmAnswer(cmd, false, msg);
}
// stop vm which is running on this host or is in halted state
Iterator<VM> iter = vms.iterator();
while ( iter.hasNext() ) {

View File

@ -58,7 +58,10 @@ public class CitrixResourceBaseTest {
super.scaleVM(conn, vm, vmSpec, host);
}
@Override
protected boolean isDmcEnabled(Connection conn, Host host) throws Types.XenAPIException, XmlRpcException {
return true;
}
};
@Mock XsHost _host;
@Mock Host host;