public class VmHandler extends Object
Modifier and Type | Field and Description |
---|---|
static ObjectIdentityChecker |
mUpdateVmsStatic |
Constructor and Description |
---|
VmHandler() |
Modifier and Type | Method and Description |
---|---|
static void |
checkStatusAndLockVm(Guid vmId)
Lock VM after check its status, If VM status is locked, we throw an exception.
|
static void |
checkStatusAndLockVm(Guid vmId,
CompensationContext compensationContext)
Lock VM with compensation, after checking its status, If VM status is locked, we throw an exception.
|
static void |
Init()
Initialize static list containers, for identity and permission check.
|
static boolean |
isMemorySizeLegal(VmOsType osType,
int memSizeInMB,
ArrayList<String> reasons,
String clsuter_version)
Checks the validity of the given memory size according to OS type.
|
static boolean |
IsNotDuplicateInterfaceName(List<VmNetworkInterface> interfaces,
String interfaceName,
List<String> messages)
Check if the interface name is not duplicate in the list of interfaces.
|
static boolean |
isVmWithSameNameExistStatic(String vmName) |
static void |
LockVm(Guid vmId) |
static void |
LockVm(VmDynamic vm,
CompensationContext compensationContext)
Lock the VM in a new transaction, saving compensation data of the old status.
|
static void |
MarkVmAsIllegal(Guid vmId) |
static void |
QueueAndLockVm(Guid vmId) |
static void |
UnLockVm(Guid vmId) |
static void |
unlockVm(VmDynamic vm,
CompensationContext compensationContext)
Unlock the VM in a new transaction, saving compensation data of the old status.
|
static void |
updateDisksFromDb(VM vm) |
static void |
UpdateVmGuestAgentVersion(VM vm)
Updates the
VM 's VM.getGuestAgentVersion() and VM.getSpiceDriverVersion() based on the
VM's VM.getapp_list() property. |
static boolean |
VerifyAddVm(ArrayList<String> reasons,
int vmsCount,
Object vmTemplateId,
Guid storagePoolId,
Guid storageDomainId,
boolean checkVmTemplateImages,
boolean checkTemplateLock,
int vmPriority)
Verifies the add vm command .
|
public static ObjectIdentityChecker mUpdateVmsStatic
public static void Init()
Backend.InitHandlers()
public static boolean VerifyAddVm(ArrayList<String> reasons, int vmsCount, Object vmTemplateId, Guid storagePoolId, Guid storageDomainId, boolean checkVmTemplateImages, boolean checkTemplateLock, int vmPriority)
reasons
- The reasons.vmsCount
- The VMS count.vmTemplateId
- The vm template id.public static boolean isVmWithSameNameExistStatic(String vmName)
public static void QueueAndLockVm(Guid vmId)
public static void LockVm(VmDynamic vm, CompensationContext compensationContext)
vm
- The VM to lock.compensationContext
- Used to save the old VM status, for compensation purposes.public static void checkStatusAndLockVm(Guid vmId)
status
- - The status of the VMvmId
- - The ID of the VM.public static void checkStatusAndLockVm(Guid vmId, CompensationContext compensationContext)
status
- - The status of the VMvmId
- - The ID of the VM, which we want to lock.compensationContext
- - Used to save the old VM status for compensation purposes.public static void LockVm(Guid vmId)
public static void unlockVm(VmDynamic vm, CompensationContext compensationContext)
vm
- The VM to unlock.compensationContext
- Used to save the old VM status, for compensation purposes.public static void UnLockVm(Guid vmId)
public static void MarkVmAsIllegal(Guid vmId)
public static void updateDisksFromDb(VM vm)
public static void UpdateVmGuestAgentVersion(VM vm)
VM
's VM.getGuestAgentVersion()
and VM.getSpiceDriverVersion()
based on the
VM's VM.getapp_list()
property.vm
- the VMpublic static boolean isMemorySizeLegal(VmOsType osType, int memSizeInMB, ArrayList<String> reasons, String clsuter_version)
osType
- Type of the os.memSizeInMB
- The mem size in MB.reasons
- The reasons.VdsGroupspublic static boolean IsNotDuplicateInterfaceName(List<VmNetworkInterface> interfaces, String interfaceName, List<String> messages)
interfaces
- - List of interfaces the VM/Template got.interfaceName
- - Candidate for interface name.messages
- - Messages for CanDoAction().Copyright © 2012. All Rights Reserved.