Skip to content

Commit

Permalink
Merge branch 'master' into bug-2077666
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtiomDivak authored Jul 20, 2022
2 parents 803da05 + 218dd7e commit ab07078
Show file tree
Hide file tree
Showing 167 changed files with 2,447 additions and 1,648 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# Default to all maintainers if nothing more specific matches
* @ahadas @bennyz @emesika @mwperina @michalskrivanek @oliel @sgratch @smelamud @didib
* @ahadas @bennyz @emesika @mwperina @michalskrivanek @oliel @sgratch @smelamud @didib @ljelinkova

packaging/dbscripts/ @emesika @mwperina
*Dao*.java @emesika @mwperina
Expand All @@ -21,7 +21,7 @@ backend/manager/modules/**/org/ovirt/engine/core/bll/snapshots/ @bennyz @ahadas
backend/manager/modules/**/org/ovirt/engine/core/common/businessentities/storage/ @bennyz @ahadas
backend/manager/modules/**/org/ovirt/engine/core/bll/validator/storage/ @bennyz @ahadas

**/*vms* @ahadas
**/*vms* @ahadas @ljelinkova @smelamud

restapi/ @oliel @mwperina

Expand Down
34 changes: 34 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -608,3 +608,37 @@ Build minimal rpm package for Firefox::
Build minimal rpm package for Chrome or Safari::

$ rpmbuild -D"ovirt_build_minimal 1" -D"ovirt_build_user_agent safari" -tb @tarball@

=== Ansible Lint

To use ansible-lint locally you need to install it from PyPI in a python virtualenv/venv, e.g.:
```
sudo dnf install python3-virtualenv
mkdir -p $HOME/venv
python3 -m venv $HOME/venv/ansible-lint
. $HOME/venv/ansible-lint/bin/activate
pip3 install "ansible-lint>=6.0.0,<7.0.0"
```

Run of the lint:

$ ansible-lint -c build/ansible-lint.conf packaging/ansible-runner-service-project/project/roles/*

== Branch/release management

Git branch `master` should always have the latest version.

Releases should be done from stable branches. So-called "bump patches", to
increase the version, should be created using the script `bump_release.sh`.
This creates two git commits - one for doing the release, which should be
tagged, and the next one for getting back to development builds, which
have a timestamp+git-hash in their RPMs names.

When branching stable branches, master branch should be bumped to the next
Y or Z version. There is currently no script for doing that. It can be done
using something like:
```
find . -name pom.xml -exec sed -i "s:4.5.1.3-SNAPSHOT:4.5.2-SNAPSHOT:" {} +
```
Replace `4.5.1.3` with the current version, and `4.5.2` with the version you
want to bump to.
2 changes: 1 addition & 1 deletion backend/manager/dependencies/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.ovirt.engine.core.manager</groupId>
<artifactId>dependencies</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>common-dependencies</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>dependencies</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/dependencies/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.ovirt.engine.core.manager</groupId>
<artifactId>dependencies</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>tools-dependencies</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/extensions-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>extensions-tool</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/logutils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>logutils</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/modules/aaa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager-modules</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>aaa</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/modules/auth-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager-modules</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>auth-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion backend/manager/modules/bll/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.ovirt.engine.core</groupId>
<artifactId>manager-modules</artifactId>
<version>4.5.1.3-SNAPSHOT</version>
<version>4.5.2-SNAPSHOT</version>
</parent>

<artifactId>bll</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ public void doPolling(Guid cmdId, List<Guid> childCmdIds) {

AnsibleReturnValue ret = new AnsibleReturnValue(AnsibleReturnCode.ERROR);
ret.setLogFile(runnerClient.getLogger().getLogFile());
String msg = "";
int totalEvents;
// Get the current status of the playbook:
AnsibleRunnerClient.PlaybookStatus playbookStatus = runnerClient.getPlaybookStatus(playUuid);
String status = playbookStatus.getStatus();
msg = playbookStatus.getMsg();
String msg = playbookStatus.getMsg();
// Process the events if the playbook is running:
totalEvents = runnerClient.getTotalEvents(playUuid);

log.debug("LastEventId: {} totalEvents: {} playbookStatus: {}", command.getParameters().getLastEventId(), totalEvents, playbookStatus);
if (msg.equalsIgnoreCase("running") || msg.equalsIgnoreCase("successful")
&& command.getParameters().getLastEventId() < totalEvents) {
command.getParameters().setLastEventId(runnerClient.processEvents(
Expand All @@ -82,9 +81,6 @@ public void doPolling(Guid cmdId, List<Guid> childCmdIds) {
ret.setAnsibleReturnCode(AnsibleReturnCode.OK);
command.setSucceeded(true);
command.setCommandStatus(CommandStatus.SUCCEEDED);
} else if (status.equalsIgnoreCase("unknown")) {
// ignore and continue:
return;
} else {
// Playbook failed:
command.setSucceeded(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ protected void executeCommand() {
} else {
getParameters().setPlayUuid(ansibleReturnValue.getPlayUuid());
getParameters().setLogFile(ansibleReturnValue.getLogFile().toString());
getParameters().setLastEventId(ansibleReturnValue.getLastEventId());
persistCommand(getParameters().getParentCommand(), true);
setSucceeded(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ private static boolean isSupported(ArchCapabilitiesVerb archCapabilitiesVerb,
switch (archCapabilitiesVerb) {
case GetMigrationSupport:
return FeatureSupported.isMigrationSupported(architecture, version);
case GetMemorySnapshotSupport:
return FeatureSupported.isMemorySnapshotSupportedByArchitecture(architecture, version);
case GetSuspendSupport:
return FeatureSupported.isSuspendSupportedByArchitecture(architecture, version);
case GetMemoryHotUnplugSupport:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.ovirt.engine.core.bll.memory.MemoryDisks;
import org.ovirt.engine.core.bll.memory.MemoryStorageHandler;
import org.ovirt.engine.core.bll.memory.MemoryUtils;
import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator;
import org.ovirt.engine.core.bll.storage.disk.image.DisksFilter;
import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil;
import org.ovirt.engine.core.bll.validator.VmValidator;
Expand Down Expand Up @@ -60,6 +61,8 @@ public class HibernateVmCommand<T extends VmOperationParameterBase> extends VmOp
private SnapshotDao snapshotDao;
@Inject
private CommandCoordinatorUtil commandCoordinatorUtil;
@Inject
protected SnapshotsValidator snapshotsValidator;

/**
* Constructor for command creation when compensation is applied on startup
Expand Down Expand Up @@ -99,7 +102,7 @@ public Guid getStorageDomainId() {
MemoryUtils.METADATA_SIZE_IN_BYTES);
StorageDomain storageDomain = memoryStorageHandler.findStorageDomainForMemory(
getStoragePoolId(), diskDummiesForMemSize,
DisksFilter.filterImageDisks(diskDao.getAllForVm(getVmId())), getVm());
DisksFilter.filterImageDisks(diskDao.getAllForVm(getVmId())), getVm(), getUserId());
if (storageDomain != null) {
cachedStorageDomainId = storageDomain.getId();
}
Expand Down Expand Up @@ -231,6 +234,12 @@ protected boolean validate() {
return false;
}

// we block hibernating a vm in preview mode because there is a bug that
// would result in keeping the hibernation metadata volume
if (!validate(snapshotsValidator.vmNotInPreview(getVm().getId()))) {
return false;
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ protected boolean validate() {
valid = failValidation(EngineMessage.HOT_PLUG_CPU_CONFLICT,
String.format("%1$s", getVm().getCpuPinningPolicy().name()));
}
if (getVm().getCpuPinningPolicy().isExclusive()) {
valid = failValidation(EngineMessage.HOT_PLUG_CPU_IS_NOT_SUPPORTED_DEDICATED,
String.format("$policy %1$s", getVm().getCpuPinningPolicy().name()));
}

return valid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ private boolean handlePositiveEnforcingAffinityGroup(Guid vdsId, List<VM> runnin
return true;
}

// Only VM-to-VM hard affinity is checked here. Other affinity types, including VM-to-host hard affinity are
// probed by SchedulingManager.canSchedule() call in execution phase of the command.
List<AffinityGroup> affinityGroups =
affinityGroupDao.getPositiveEnforcingAffinityGroupsByRunningVmsOnVdsId(vdsId);
if (!affinityGroups.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.ovirt.engine.core.bll.tasks.interfaces.CommandCallback;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.VdcObjectType;
import org.ovirt.engine.core.common.action.ActionReturnValue;
import org.ovirt.engine.core.common.action.ActionType;
import org.ovirt.engine.core.common.action.MaintenanceVdsParameters;
import org.ovirt.engine.core.common.action.MigrateMultipleVmsParameters;
Expand Down Expand Up @@ -89,7 +90,12 @@ protected void executeCommand() {
}
}

setSucceeded(migrateAllVms(getExecutionContext()));
ActionReturnValue returnValue = migrateAllVms(getExecutionContext());
setSucceeded(returnValue.getSucceeded());
if (!returnValue.getSucceeded() && !returnValue.isValid()) {
getReturnValue().setValid(false);
getReturnValue().getValidationMessages().addAll(returnValue.getValidationMessages());
}

// if non responsive move directly to maintenance
if (getVds().getStatus() == VDSStatus.NonResponsive
Expand Down Expand Up @@ -120,17 +126,14 @@ protected void orderListOfRunningVmsOnVds(Guid vdsId) {
/**
* Note: you must call {@link #orderListOfRunningVmsOnVds(Guid)} before calling this method
*/
protected boolean migrateAllVms(ExecutionContext parentContext) {
protected ActionReturnValue migrateAllVms(ExecutionContext parentContext) {
return migrateAllVms(parentContext, false);
}

/**
* Note: you must call {@link #orderListOfRunningVmsOnVds(Guid)} before calling this method
*/
protected boolean migrateAllVms(ExecutionContext parentContext, boolean HAOnly) {

boolean succeeded = true;

protected ActionReturnValue migrateAllVms(ExecutionContext parentContext, boolean HAOnly) {
if (shouldSetMigrationClientCerts()) {
runAnsibleMigrationCerts();
}
Expand All @@ -143,17 +146,19 @@ protected boolean migrateAllVms(ExecutionContext parentContext, boolean HAOnly)
}
}

if (!migrateVms(vmsToMigrate, parentContext)) {
succeeded = false;
ActionReturnValue returnValue = migrateVms(vmsToMigrate, parentContext);
if (!returnValue.getSucceeded()) {
// There is no way to find out which VMs failed to migrate, so the error message is general.
log.error("Failed to migrate one or more VMs.");
}
return succeeded;
return returnValue;
}

private boolean migrateVms(List<VM> vms, ExecutionContext parentContext) {
private ActionReturnValue migrateVms(List<VM> vms, ExecutionContext parentContext) {
if (vms.isEmpty()) {
return true;
ActionReturnValue returnValue = new ActionReturnValue();
returnValue.setSucceeded(true);
return returnValue;
}

boolean forceMigration = !getParameters().isInternal();
Expand All @@ -177,8 +182,7 @@ private boolean migrateVms(List<VM> vms, ExecutionContext parentContext) {
parameters.setReason(MessageBundler.getMessage(AuditLogType.MIGRATION_REASON_HOST_IN_MAINTENANCE));
return runInternalAction(ActionType.MigrateMultipleVms,
parameters,
createMigrateVmsContext(parentContext))
.getSucceeded();
createMigrateVmsContext(parentContext));
}

protected CommandContext createMigrateVmsContext(ExecutionContext parentContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected boolean validate() {
.hostBlackList(getHostBlackList())
.hostWhiteList(getHostWhiteList())
.ignoreHardVmToVmAffinity(getParameters().isCanIgnoreHardVmAffinity())
// TODO - Use error messages from scheduling
.outputMessages(getReturnValue().getValidationMessages())
.canSchedule(getVms());

possibleVmsToMigrate = new ArrayList<>(getVms().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,7 @@ protected List<Guid> getPredefinedVdsIdListToRunOn() {
protected boolean shouldRestoreMemory() {
// If the memory from the snapshot could have been restored already, the disks might be
// non coherent with the memory, thus we don't want to try to restore the memory again
return !memoryFromSnapshotUsed &&
(getFlow() == RunVmFlow.RESUME_HIBERNATE ||
FeatureSupported.isMemorySnapshotSupportedByArchitecture(
getVm().getClusterArch(),
getVm().getCompatibilityVersion())) &&
getActiveSnapshot().containsMemory();
return !memoryFromSnapshotUsed && getActiveSnapshot().containsMemory();
}

/**
Expand Down
Loading

0 comments on commit ab07078

Please sign in to comment.