|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | +package org.apache.cloudstack.command; |
| 18 | + |
| 19 | + |
| 20 | +import com.cloud.agent.api.Answer; |
| 21 | +import com.cloud.agent.api.Command; |
| 22 | +import com.cloud.hypervisor.Hypervisor; |
| 23 | +import org.apache.cloudstack.api.ApiCommandResourceType; |
| 24 | +import org.apache.cloudstack.framework.config.ConfigKey; |
| 25 | + |
| 26 | +import java.util.Arrays; |
| 27 | +import java.util.List; |
| 28 | + |
| 29 | +public interface ReconcileCommandService { |
| 30 | + |
| 31 | + ConfigKey<Boolean> ReconcileCommandsEnabled = new ConfigKey<>("Advanced", Boolean.class, |
| 32 | + "reconcile.commands.enabled", "false", |
| 33 | + "Indicates whether the background task to reconcile the commands is enabled or not", |
| 34 | + false); |
| 35 | + |
| 36 | + ConfigKey<Integer> ReconcileCommandsInterval = new ConfigKey<>("Advanced", Integer.class, |
| 37 | + "reconcile.commands.interval", "60", |
| 38 | + "Interval (in seconds) for the background task to reconcile the commands", |
| 39 | + false); |
| 40 | + ConfigKey<Integer> ReconcileCommandsMaxAttempts = new ConfigKey<>("Advanced", Integer.class, |
| 41 | + "reconcile.commands.max.attempts", "30", |
| 42 | + "The maximum number of attempts to reconcile the commands", |
| 43 | + true); |
| 44 | + |
| 45 | + ConfigKey<Integer> ReconcileCommandsWorkers = new ConfigKey<>("Advanced", Integer.class, |
| 46 | + "reconcile.commands.workers", "100", |
| 47 | + "The Number of worker threads to reconcile the commands", |
| 48 | + false); |
| 49 | + |
| 50 | + List<Hypervisor.HypervisorType> SupportedHypervisorTypes = Arrays.asList(Hypervisor.HypervisorType.KVM); |
| 51 | + |
| 52 | + void persistReconcileCommands(Long hostId, Long requestSequence, Command[] cmd); |
| 53 | + |
| 54 | + boolean updateReconcileCommand(long requestSeq, Command command, Answer answer, Command.State newStateByManagement, Command.State newStateByAgent); |
| 55 | + |
| 56 | + void processCommand(Command pingCommand, Answer pingAnswer); |
| 57 | + |
| 58 | + void processAnswers(long requestSeq, Command[] commands, Answer[] answers); |
| 59 | + |
| 60 | + void updateReconcileCommandToInterruptedByManagementServerId(long managementServerId); |
| 61 | + |
| 62 | + void updateReconcileCommandToInterruptedByHostId(long hostId); |
| 63 | + |
| 64 | + boolean isReconcileResourceNeeded(long resourceId, ApiCommandResourceType resourceType); |
| 65 | +} |
0 commit comments