/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jetbrains.buildServer.clouds.vmware.vmrun; import java.util.Collection; import jetbrains.buildServer.clouds.CloudException; import jetbrains.buildServer.clouds.CloudInstanceUserData; import jetbrains.buildServer.clouds.QuotaException; import jetbrains.buildServer.clouds.vmware.settings.VMImageInfo; import jetbrains.buildServer.clouds.vmware.vmrun.remote.Timeout; import org.jetbrains.annotations.NotNull; /** * @author Eugene Petrenko * Created: 07.12.2009 19:27:36 */ public interface VMRun { /** * Protocol version */ int VERSION = 42; /** * @return information about current client. Should be system-unique */ @NotNull String getLocationId(); /** * @return machine host name to be shown in web ui */ @NotNull String getHostName(); /** * Command to start the VM. Image may not * be started if it was not yet downloaded * to the local machine. * * @param instance instance information to start * @param data instace stat data * @throws jetbrains.buildServer.clouds.CloudException on error * @throws jetbrains.buildServer.clouds.QuotaException if there is not change of running one extra machine */ @Timeout(15* 60 * 1000L) void startMachine(@NotNull VMRunParameters instance, @NotNull CloudInstanceUserData data) throws CloudException, QuotaException; /** * Terminates running image on the machine * @param image image */ @Timeout(5* 60 * 1000L) void terminateMachine(@NotNull VMImageInfo image); /** * @return returns only running images back. */ @Timeout(60 * 1000L) @NotNull Collection getRunningImages(); /** * Downloading of an image may take too much time. * * @return returns list of images that are ready to start on the machine. */ @NotNull Collection getLocalImages(); /** * @return number of virtual machines that allowed to run on the host */ int getAllowedMachinesToRun(); /** * method for checking client and server versions * @param serverVersion * @return client version */ int getVersion(int serverVersion); }