Vitor de Lima has uploaded a new change for review. Change subject: core: Memory hotunplug ......................................................................
core: Memory hotunplug Support for decreasing the total VM memory size to any arbitrary value that is multiple of 256 MiB and is not inferior than the baseline memory size that was given to the VM when it first started. This is achieved by unplugging a set of memory modules with a total size of at least the desired amount that needs to be unplugged and the plugging again the remaining amount that is given by the difference between the total unplugged memory and the desired decrease in total memory size. The set of memory modules is picked in order to minimize this difference by using brute force search. This feature (and the memory hotplug feature) requires the pc-i440fx-2.1 QEMU machine type. Change-Id: I53fd56fc1cede366759bd1a3283a75d683bad431 Signed-off-by: Vitor de Lima <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotSetAmountOfMemoryCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties A backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/HotUnplugMemoryVDSCommand.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/SetAmountOfMemoryVDSCommand.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 21 files changed, 190 insertions(+), 18 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/41294/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotSetAmountOfMemoryCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotSetAmountOfMemoryCommand.java index d01c7dc..eb71475 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotSetAmountOfMemoryCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotSetAmountOfMemoryCommand.java @@ -2,9 +2,11 @@ import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.ovirt.engine.core.bll.context.CommandContext; import org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter; import org.ovirt.engine.core.bll.quota.QuotaVdsDependent; @@ -27,9 +29,12 @@ import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.vdsbroker.SetAmountOfMemoryVDSCommand; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @NonTransactiveCommandAttribute public class HotSetAmountOfMemoryCommand<T extends HotSetAmountOfMemoryParameters> extends VmManagementCommandBase<T> implements QuotaVdsDependent { + private static final Logger log = LoggerFactory.getLogger(HotSetAmountOfMemoryCommand.class); public static final String LOGABLE_FIELD_NEW_MEMORY = "newMem"; public static final String LOGABLE_FIELD_PREVIOUS_MEMORY = "previousMem"; @@ -38,6 +43,7 @@ public static final String DEVICE_NODE_FIELD_KEY = "node"; int memoryToConsume; + List<VmDevice> memDevices; public HotSetAmountOfMemoryCommand(T parameters) { this(parameters, null); @@ -71,49 +77,115 @@ LocalizedVmStatus.from(getVm().getStatus())); } + memDevices = getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.MEMORY); + + // (un)plugged memory should be multiply of 256mb + if (Math.abs(memoryToConsume) % Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb) != 0) { + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION, + "$multiplicationSize " + Config.getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb).toString()); + } + if (getParameters().getPlugAction() == PlugAction.PLUG) { if (!FeatureSupported.hotPlugMemory(getVm().getVdsGroupCompatibilityVersion(), getVm().getClusterArch())) { return failCanDoAction(VdcBllMessages.HOT_PLUG_MEMORY_IS_NOT_SUPPORTED); } // check max slots - List<VmDevice> memDevices = getVmDeviceDao().getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.MEMORY); if (memDevices.size() == Config.<Integer>getValue(ConfigValues.MaxMemorySlots)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_MORE_MEMORY_SLOTS, "$maxMemSlots " + Config.getValue(ConfigValues.MaxMemorySlots).toString()); } - // plugged memory should be multiply of 256mb - if (memoryToConsume % Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb) != 0) { - return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION, - "$multiplicationSize " + Config.getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb).toString()); + + } else if (getParameters().getPlugAction() == PlugAction.UNPLUG) { + if (!FeatureSupported.hotUnplugMemory(getVm().getVdsGroupCompatibilityVersion(), getVm().getClusterArch())) { + return failCanDoAction(VdcBllMessages.HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED); } - } else if (!FeatureSupported.hotUnplugMemory(getVm().getVdsGroupCompatibilityVersion(), getVm().getClusterArch())) { - return failCanDoAction(VdcBllMessages.HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED); + + int totalHotpluggedMemory = 0; + + for (VmDevice module : memDevices) { + totalHotpluggedMemory += (Integer)module.getSpecParams().get("size"); + } + + if (totalHotpluggedMemory < Math.abs(memoryToConsume)) { + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT); + } } return true; } - @Override - protected void executeCommand() { - VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.SetAmountOfMemory, + private boolean hotplugVDScommand(VDSCommandType command, VmDevice device) { + VDSReturnValue vdsReturnValue = runVdsCommand(command, new SetAmountOfMemoryVDSCommand.Params( getVm().getRunOnVds(), getVm().getId(), - createMemoryDevice())); + device)); if (vdsReturnValue.getSucceeded()) { - setSucceeded(true); + return true; } else { VdcFault fault = new VdcFault(); fault.setError(vdsReturnValue.getVdsError().getCode()); fault.setMessage(vdsReturnValue.getVdsError().getMessage()); getReturnValue().setFault(fault); + return false; } } - private VmDevice createMemoryDevice() { + @Override + protected void executeCommand() { + if (getParameters().getPlugAction() == PlugAction.PLUG) { + if (hotplugVDScommand(VDSCommandType.SetAmountOfMemory, createMemoryDevice(memoryToConsume))) { + setSucceeded(true); + } + } else { + int [] sizes = new int[memDevices.size()]; + + int i = 0; + + for (VmDevice module : memDevices) { + sizes[i] = (Integer)module.getSpecParams().get("size"); + i++; + } + + HotPlugSolver solver = new HotPlugSolver(sizes, Math.abs(memoryToConsume)); + + ArrayList<VmDevice> toBeUnplugged = new ArrayList<>(); + + int [] solution = solver.findSolution(); + + int toBeUnpluggedSize = 0; + + for (int j = 0; j < solution.length; j++) { + if (solution[j] == 1) { + VmDevice module = memDevices.get(j); + + toBeUnplugged.add(module); + toBeUnpluggedSize += (Integer)module.getSpecParams().get("size"); + } + } + + for (VmDevice module: toBeUnplugged) { + if (!hotplugVDScommand(VDSCommandType.HotUnplugMemory, module)) { + return; + } + } + + int mustBeReplugged = toBeUnpluggedSize - Math.abs(memoryToConsume); + + if (mustBeReplugged > 0) { + if (!hotplugVDScommand(VDSCommandType.SetAmountOfMemory, createMemoryDevice(mustBeReplugged))) { + return; + } + } + + setSucceeded(true); + } + } + + private VmDevice createMemoryDevice(int moduleSize) { Map<String, Object> specParams = new HashMap<>(); - specParams.put(DEVICE_SIZE_FIELD_KEY, memoryToConsume); + specParams.put(DEVICE_SIZE_FIELD_KEY, moduleSize); specParams.put(DEVICE_NODE_FIELD_KEY, getParameters().getNumaNode()); return new VmDevice(new VmDeviceId(Guid.newGuid(), getVmId()), VmDeviceGeneralType.MEMORY, @@ -171,4 +243,46 @@ } } + + private class HotPlugSolver { + + int minSum; + int[] values; + int[] x; + int T; + int[] bestSolution; + + HotPlugSolver(int[] values, int T) { + this.values = values; + this.T = T; + x = new int[values.length]; + } + + int[] findSolution() { + bestSolution = null; + minSum = Integer.MAX_VALUE; + tryValue(0); + return bestSolution; + } + + void tryValue(int index) { + if (index < values.length) { + x[index] = 0; + tryValue(index+1); + x[index] = 1; + tryValue(index+1); + } else { + int sum = 0; + + for (int i=0; i < values.length; i++) { + sum += values[i] * x[i]; + } + + if (sum >= T && sum < minSum) { + minSum = sum; + bestSolution = Arrays.copyOf(x, x.length); + } + } + } + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java index 604feae..0ac1b87 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java @@ -332,7 +332,7 @@ List<String> canDos = getBackend().getErrorsTranslator(). TranslateErrorText(setAmountOfMemoryResult.getCanDoActionMessages()); logable.addCustomValue(HotSetAmountOfMemoryCommand.LOGABLE_FIELD_ERROR_MESSAGE, StringUtils.join(canDos, ",")); - auditLogDirector.log(logable, AuditLogType.FAILED_HOT_SET_NUMBER_OF_CPUS); + auditLogDirector.log(logable, AuditLogType.FAILED_HOT_SET_MEMORY); } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index 4be5040..47d7d94 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -1828,7 +1828,7 @@ HotPlugMemorySupported, @TypeConverterAttribute(Map.class) - @DefaultValueAttribute("{\"x86_64\":\"false\",\"ppc64\":\"false\"}") + @DefaultValueAttribute("{\"x86_64\":\"true\",\"ppc64\":\"false\"}") HotUnplugMemorySupported, @TypeConverterAttribute(String.class) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java index ae4ab74..9ab7b41 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java @@ -56,6 +56,7 @@ hwInfoErr(57), ResizeErr(58), hotplugMem(66), + hotunplugMem(67), HOT_PLUG_UNPLUG_CPU_ERROR(60), recovery(99), GeneralException(100), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 7a8b3b0..bb71cf8 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -864,6 +864,7 @@ HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_NO_MORE_MEMORY_SLOTS(ErrorType.CONFLICT), ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION(ErrorType.CONFLICT), + ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT(ErrorType.CONFLICT), UNLINKING_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_UNLINKING_OF_PASSTHROUGH_VNIC_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), HOT_PLUG_DISK_SNAPSHOT_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java index 756218d..1574f61 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java @@ -186,6 +186,7 @@ SetNumberOfCpus("org.ovirt.engine.core.vdsbroker"), SetAmountOfMemory("org.ovirt.engine.core.vdsbroker"), + HotUnplugMemory("org.ovirt.engine.core.vdsbroker"), UpdateVmPolicy("org.ovirt.engine.core.vdsbroker"), GetVmsFromExternalProvider("org.ovirt.engine.core.vdsbroker.vdsbroker"), List("org.ovirt.engine.core.vdsbroker.vdsbroker"), // get a list of VMs with status only diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 8492065..ab8b52f 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -1039,6 +1039,7 @@ HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED=Hot un-plugging memory is not supported for cluster version ${clusterVersion} and architecture ${architecture}. ACTION_TYPE_FAILED_NO_MORE_MEMORY_SLOTS=Cannot ${action} ${type}. Exceeded maximum number of available memory slots: ${maxMemSlots}. ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION=Cannot ${action} ${type}. Plugged memory must be multiplication of ${multiplicationSize}. +ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT=Cannot ${action} ${type}. The amount of memory to be hot unplugged must be at most the same amount of previously hot plugged memory. HOT_PLUG_DISK_SNAPSHOT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Activation/Deactivation of Disk Snapshot is not supported for clusters of version ${clusterVersion}. HOT_PLUG_IDE_DISK_IS_NOT_SUPPORTED=Cannot ${action} ${diskAlias} to ${vmName}. Hot plugging a disk to an IDE interface is not supported. UNLINKING_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Link state is set to 'Down' on the virtual machine's interface, this is not supported for clusters of version ${clusterVersion}. diff --git a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties index efc822a..96effe6 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties @@ -115,6 +115,7 @@ nonresp=Guest agent non responsive noVM=Desktop does not exist hotplugMem=Failed to hotplug memory +hotunplugMem=Failed to hotunplug memory noVmType=Unsupported VM type outOfMem=Not enough free memory to create Desktop hwInfoErr=Failed to read hardware information diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/HotUnplugMemoryVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/HotUnplugMemoryVDSCommand.java new file mode 100644 index 0000000..e6d448c --- /dev/null +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/HotUnplugMemoryVDSCommand.java @@ -0,0 +1,19 @@ +package org.ovirt.engine.core.vdsbroker; + +public class HotUnplugMemoryVDSCommand <P extends SetAmountOfMemoryVDSCommand.Params> extends SetAmountOfMemoryVDSCommand<P> { + public HotUnplugMemoryVDSCommand(P parameters) { + super(parameters); + } + + @Override + protected void executeVdsBrokerCommand() { + try { + status = getBroker().hotunplugMemory(buildData()); + proceedProxyReturnValue(); + } catch (RuntimeException e) { + setVdsRuntimeError(e); + // prevent exception handler from rethrowing an exception + getVDSReturnValue().setExceptionString(null); + } + } +} diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/SetAmountOfMemoryVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/SetAmountOfMemoryVDSCommand.java index 38b5875..adae470 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/SetAmountOfMemoryVDSCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/SetAmountOfMemoryVDSCommand.java @@ -28,7 +28,7 @@ } } - private Map<String, Object> buildData() { + protected Map<String, Object> buildData() { Map<String, Object> data = new HashMap<>(); Map<String, Object> memDeviceData = new HashMap<>(); VmDevice vmDevice = getParameters().getMemoryDevice(); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java index 8d65eac..a438fc8 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcVdsServer.java @@ -1716,6 +1716,18 @@ return new StatusOnlyReturnForXmlRpc(response); } + @Override + public StatusOnlyReturnForXmlRpc hotunplugMemory(Map info) { + JsonRpcRequest request = + new RequestBuilder("VM.hotunplugMemory") + .withParameter("vmID", getVmId(info)) + .withParameter("params", info) + .build(); + Map<String, Object> response = + new FutureMap(this.client, request); + return new StatusOnlyReturnForXmlRpc(response); + } + @SuppressWarnings("rawtypes") @Override public StatusOnlyReturnForXmlRpc updateVmPolicy(Map params) { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java index e27580c..0789712 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java @@ -398,6 +398,8 @@ StatusOnlyReturnForXmlRpc hotplugMemory(Map info); + StatusOnlyReturnForXmlRpc hotunplugMemory(Map info); + StatusOnlyReturnForXmlRpc updateVmPolicy(Map info); VMListReturnForXmlRpc getExternalVmList(String uri, String username, String password); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java index 1dc06de..c3c179b 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java @@ -375,6 +375,8 @@ public Map<String, Object> hotplugMemory(Map<String, Object> info); + public Map<String, Object> hotunplugMemory(Map<String, Object> info); + public Map<String, Object> updateVmPolicy(Map info); public Map<String, Object> getExternalVMs(String uri, String username, String password); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java index 0806efc..8808ef5 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java @@ -1650,6 +1650,15 @@ } @Override + public StatusOnlyReturnForXmlRpc hotunplugMemory(Map info) { + try { + return new StatusOnlyReturnForXmlRpc(vdsServer.hotunplugMemory(info)); + } catch (UndeclaredThrowableException ute) { + throw new XmlRpcRunTimeException(ute); + } + } + + @Override public StatusOnlyReturnForXmlRpc updateVmPolicy(Map info) { try { return new StatusOnlyReturnForXmlRpc(vdsServer.updateVmPolicy(info)); diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index 357f09d..2282470 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -2792,6 +2792,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Plugged memory must be multiplication of ${multiplicationSize}.") String ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION(); + @DefaultStringValue("Cannot ${action} ${type}. The amount of memory to be hot unplugged must be at most the same amount of previously hot plugged memory.") + String ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT(); + @DefaultStringValue("Cannot ${action} ${type}. Activation/Deactivation of Disk Snapshot is not supported for clusters of version ${clusterVersion}.") String HOT_PLUG_DISK_SNAPSHOT_IS_NOT_SUPPORTED(); diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java index 1d6eb2c..ec8ed89 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java @@ -231,6 +231,8 @@ String hotplugMem(); + String hotunplugMem(); + String noVmType(); String outOfMem(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index e51fac1..d4c9291 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -927,6 +927,7 @@ HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED=Hot un-plugging memory is not supported for cluster version ${clusterVersion} and architecture ${architecture}. ACTION_TYPE_FAILED_NO_MORE_MEMORY_SLOTS=Cannot ${action} ${type}. Exceeded maximum number of available memory slots: ${maxMemSlots}. ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION=Cannot ${action} ${type}. Plugged memory must be multiplication of ${multiplicationSize}. +ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT=Cannot ${action} ${type}. The amount of memory to be hot unplugged must be at most the same amount of previously hot plugged memory. HOT_PLUG_DISK_SNAPSHOT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Activation/Deactivation of Disk Snapshot is not supported for clusters of version ${clusterVersion}. HOT_PLUG_IDE_DISK_IS_NOT_SUPPORTED=Cannot ${action} ${diskAlias} to ${vmName}. Hot plugging a disk to an IDE interface is not supported. UNLINKING_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Link state is set to 'Down' on the virtual machine's interface, this is not supported for clusters of version ${clusterVersion}. diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties index 7fbd106..87204b3 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties @@ -112,6 +112,7 @@ nonresp=Guest agent non responsive noVM=Desktop does not exist hotplugMem=Failed to hotplug memory +hotunplugMem=Failed to hotunplug memory noVmType=Unsupported VM type outOfMem=Not enough free memory to create Desktop recovery=Recovering from crash or Initializing diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 9f28274..b678f07 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -1029,6 +1029,7 @@ HOT_UNPLUG_MEMORY_IS_NOT_SUPPORTED=Hot un-plugging memory is not supported for cluster version ${clusterVersion} and architecture ${architecture}. ACTION_TYPE_FAILED_NO_MORE_MEMORY_SLOTS=Cannot ${action} ${type}. Exceeded maximum number of available memory slots: ${maxMemSlots}. ACTION_TYPE_FAILED_MEMORY_MUST_BE_MULTIPLICATION=Cannot ${action} ${type}. Plugged memory must be multiplication of ${multiplicationSize}. +ACTION_TYPE_FAILED_CANNOT_UNPLUG_AMOUNT=Cannot ${action} ${type}. The amount of memory to be hot unplugged must be at most the same amount of previously hot plugged memory. HOT_PLUG_DISK_SNAPSHOT_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Activation/Deactivation of Disk Snapshot is not supported for clusters of version ${clusterVersion}. HOT_PLUG_IDE_DISK_IS_NOT_SUPPORTED=Cannot ${action} ${diskAlias} to ${vmName}. Hot plugging a disk to an IDE interface is not supported. UNLINKING_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Link state is set to 'Down' on the virtual machine's interface, this is not supported for clusters of version ${clusterVersion}. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties index 20176a1..bc82638 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties @@ -112,6 +112,7 @@ nonresp=Guest agent non responsive noVM=Desktop does not exist hotplugMem=Failed to hotplug memory +hotunplugMem=Failed to hotunplug memory noVmType=Unsupported VM type outOfMem=Not enough free memory to create Desktop recovery=Recovering from crash or Initializing diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index 812998e..bd813c9 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -201,7 +201,7 @@ select fn_db_add_config_value_for_versions_up_to('HotPlugCpuSupported', '{"x86_64":"true","ppc64":"false"}', '3.6'); select fn_db_add_config_value_for_versions_up_to('HotUnplugCpuSupported', '{"x86_64":"false","ppc64":"false"}', '3.6'); select fn_db_add_config_value_for_versions_up_to('HotPlugMemorySupported', '{"x86_64":"false","ppc64":"false"}', '3.5'); -select fn_db_add_config_value_for_versions_up_to('HotUnplugMemorySupported', '{"x86_64":"false","ppc64":"false"}', '3.6'); +select fn_db_add_config_value_for_versions_up_to('HotUnplugMemorySupported', '{"x86_64":"false","ppc64":"false"}', '3.5'); select fn_db_add_config_value('MaxMemorySlots','16','general'); select fn_db_add_config_value('HotPlugMemoryMultiplicationSizeMb','256','general'); -- To view, visit https://gerrit.ovirt.org/41294 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I53fd56fc1cede366759bd1a3283a75d683bad431 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vitor de Lima <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
