use of org.ovirt.engine.core.common.action.HostStoragePoolParametersBase in project ovirt-engine by oVirt.
the class VdsEventListener method processStorageOnVdsInactive.
private void processStorageOnVdsInactive(final VDS vds) {
// anymore.
if (!Guid.Empty.equals(vds.getStoragePoolId())) {
// when vds is being moved to maintenance, this is the part in which we disconnect it from the pool
// and the storage server. it should be synced with the host autorecovery mechanism to try to avoid
// leaving the host with storage/pool connection when it's on maintenance.
EngineLock lock = new EngineLock(Collections.singletonMap(vds.getId().toString(), new Pair<>(LockingGroup.VDS_POOL_AND_STORAGE_CONNECTIONS.toString(), EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED.toString())), null);
try {
lockManager.acquireLockWait(lock);
clearDomainCache(vds);
StoragePool storage_pool = storagePoolDao.get(vds.getStoragePoolId());
if (StoragePoolStatus.Uninitialized != storage_pool.getStatus()) {
vdsBroker.runVdsCommand(VDSCommandType.DisconnectStoragePool, new DisconnectStoragePoolVDSCommandParameters(vds.getId(), vds.getStoragePoolId(), vds.getVdsSpmId()));
HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(storage_pool, vds);
backend.runInternalAction(ActionType.DisconnectHostFromStoragePoolServers, params);
}
} finally {
lockManager.releaseLock(lock);
}
}
}
use of org.ovirt.engine.core.common.action.HostStoragePoolParametersBase in project ovirt-engine by oVirt.
the class VdsEventListener method vdsUpEvent.
@Override
public boolean vdsUpEvent(final VDS vds) {
HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds);
CommandContext commandContext = new CommandContext(new EngineContext()).withoutExecutionContext();
commandContext.getExecutionContext().setJobRequired(true);
boolean isSucceeded = backend.runInternalAction(ActionType.InitVdsOnUp, params, commandContext).getSucceeded();
if (isSucceeded) {
ThreadPoolUtil.execute(() -> {
try {
// migrate vms that its their default vds and failback
// is on
List<VmStatic> vmsToMigrate = vmStaticDao.getAllWithFailbackByVds(vds.getId());
if (!vmsToMigrate.isEmpty()) {
CommandContext ctx = new CommandContext(new EngineContext());
ctx.getExecutionContext().setMonitored(true);
backend.runInternalMultipleActions(ActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds, null)), ctx);
}
} catch (RuntimeException e) {
log.error("Failed to initialize Vds on up: {}", e.getMessage());
log.error("Exception", e);
}
});
}
return isSucceeded;
}
Aggregations