@@ -3951,7 +3951,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
39513951 DiskOfferingVO diskOffering = _diskOfferingDao .findById (diskOfferingId );
39523952 volumesSize += verifyAndGetDiskSize (diskOffering , diskSize );
39533953 }
3954- UserVm vm = getCheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
3954+ UserVm vm = getCheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , userDataId , userDataDetails , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
39553955
39563956 _securityGroupMgr .addInstanceToGroups (vm .getId (), securityGroupIdList );
39573957
@@ -3962,13 +3962,13 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
39623962 CallContext .current ().putContextParameter (VirtualMachine .class , vm .getUuid ());
39633963 return vm ;
39643964 }
3965- private UserVm getCheckedUserVmResource (DataCenter zone , String hostName , String displayName , Account owner , Long diskOfferingId , Long diskSize , List <NetworkVO > networkList , List <Long > securityGroupIdList , String group , HTTPMethod httpmethod , String userData , List <String > sshKeyPairs , Account caller , Map <Long , IpAddresses > requestedIps , IpAddresses defaultIps , Boolean isDisplayVm , String keyboard , List <Long > affinityGroupIdList , Map <String , String > customParameters , String customId , Map <String , Map <Integer , String >> dhcpOptionMap , Map <Long , DiskOffering > datadiskTemplateToDiskOfferringMap , Map <String , String > userVmOVFPropertiesMap , boolean dynamicScalingEnabled , String vmType , VMTemplateVO template , HypervisorType hypervisorType , long accountId , ServiceOfferingVO offering , boolean isIso , Long rootDiskOfferingId , long volumesSize ) throws ResourceAllocationException , StorageUnavailableException , InsufficientCapacityException {
3965+ private UserVm getCheckedUserVmResource (DataCenter zone , String hostName , String displayName , Account owner , Long diskOfferingId , Long diskSize , List <NetworkVO > networkList , List <Long > securityGroupIdList , String group , HTTPMethod httpmethod , String userData , Long userDataId , String userDataDetails , List <String > sshKeyPairs , Account caller , Map <Long , IpAddresses > requestedIps , IpAddresses defaultIps , Boolean isDisplayVm , String keyboard , List <Long > affinityGroupIdList , Map <String , String > customParameters , String customId , Map <String , Map <Integer , String >> dhcpOptionMap , Map <Long , DiskOffering > datadiskTemplateToDiskOfferringMap , Map <String , String > userVmOVFPropertiesMap , boolean dynamicScalingEnabled , String vmType , VMTemplateVO template , HypervisorType hypervisorType , long accountId , ServiceOfferingVO offering , boolean isIso , Long rootDiskOfferingId , long volumesSize ) throws ResourceAllocationException , StorageUnavailableException , InsufficientCapacityException {
39663966 if (!VirtualMachineManager .ResourceCountRunningVMsonly .value ()) {
39673967 try (CheckedReservation vmReservation = new CheckedReservation (owner , ResourceType .user_vm , 1l , reservationDao , resourceLimitService );
39683968 CheckedReservation cpuReservation = new CheckedReservation (owner , ResourceType .cpu , Long .valueOf (offering .getCpu ()), reservationDao , resourceLimitService );
39693969 CheckedReservation memReservation = new CheckedReservation (owner , ResourceType .memory , Long .valueOf (offering .getRamSize ()), reservationDao , resourceLimitService );
39703970 ) {
3971- return getUncheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
3971+ return getUncheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , userDataId , userDataDetails , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
39723972 } catch (ResourceAllocationException | CloudRuntimeException e ) {
39733973 throw e ;
39743974 } catch (Exception e ) {
@@ -3977,11 +3977,11 @@ private UserVm getCheckedUserVmResource(DataCenter zone, String hostName, String
39773977 }
39783978
39793979 } else {
3980- return getUncheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
3980+ return getUncheckedUserVmResource (zone , hostName , displayName , owner , diskOfferingId , diskSize , networkList , securityGroupIdList , group , httpmethod , userData , userDataId , userDataDetails , sshKeyPairs , caller , requestedIps , defaultIps , isDisplayVm , keyboard , affinityGroupIdList , customParameters , customId , dhcpOptionMap , datadiskTemplateToDiskOfferringMap , userVmOVFPropertiesMap , dynamicScalingEnabled , vmType , template , hypervisorType , accountId , offering , isIso , rootDiskOfferingId , volumesSize );
39813981 }
39823982 }
39833983
3984- private UserVm getUncheckedUserVmResource (DataCenter zone , String hostName , String displayName , Account owner , Long diskOfferingId , Long diskSize , List <NetworkVO > networkList , List <Long > securityGroupIdList , String group , HTTPMethod httpmethod , String userData , List <String > sshKeyPairs , Account caller , Map <Long , IpAddresses > requestedIps , IpAddresses defaultIps , Boolean isDisplayVm , String keyboard , List <Long > affinityGroupIdList , Map <String , String > customParameters , String customId , Map <String , Map <Integer , String >> dhcpOptionMap , Map <Long , DiskOffering > datadiskTemplateToDiskOfferringMap , Map <String , String > userVmOVFPropertiesMap , boolean dynamicScalingEnabled , String vmType , VMTemplateVO template , HypervisorType hypervisorType , long accountId , ServiceOfferingVO offering , boolean isIso , Long rootDiskOfferingId , long volumesSize ) throws ResourceAllocationException , StorageUnavailableException , InsufficientCapacityException {
3984+ private UserVm getUncheckedUserVmResource (DataCenter zone , String hostName , String displayName , Account owner , Long diskOfferingId , Long diskSize , List <NetworkVO > networkList , List <Long > securityGroupIdList , String group , HTTPMethod httpmethod , String userData , Long userDataId , String userDataDetails , List <String > sshKeyPairs , Account caller , Map <Long , IpAddresses > requestedIps , IpAddresses defaultIps , Boolean isDisplayVm , String keyboard , List <Long > affinityGroupIdList , Map <String , String > customParameters , String customId , Map <String , Map <Integer , String >> dhcpOptionMap , Map <Long , DiskOffering > datadiskTemplateToDiskOfferringMap , Map <String , String > userVmOVFPropertiesMap , boolean dynamicScalingEnabled , String vmType , VMTemplateVO template , HypervisorType hypervisorType , long accountId , ServiceOfferingVO offering , boolean isIso , Long rootDiskOfferingId , long volumesSize ) throws ResourceAllocationException , StorageUnavailableException , InsufficientCapacityException {
39853985 try (CheckedReservation volumeReservation = new CheckedReservation (owner , ResourceType .volume , (isIso || diskOfferingId == null ? 1l : 2 ), reservationDao , resourceLimitService );
39863986 CheckedReservation primaryStorageReservation = new CheckedReservation (owner , ResourceType .primary_storage , volumesSize , reservationDao , resourceLimitService )) {
39873987
0 commit comments