forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
QoS Support (Capacity IOPS on the pool, Create Offering with QoS and Resize Changes for IOPS) #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
suryag1201
wants to merge
14
commits into
main
Choose a base branch
from
feature/CSTACKEX-279
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
37fdde9
[CSTACKEX-279] Add Capacity IOPS for Storage Pool
c14488b
[CSTACKEX-279] QoS for Disk and Compute Offering
f0c41f8
[CSTACKEX-279] Added QoS Client
5df2947
[CSTACKEX-279] Fix CustomIOPS bug
0f49f1c
[CSTACKEX-279] Volume Resize QoS
1dc2a20
[CSTACKEX-279] Refactoring
fc20ff3
[CSTACKEX-279] Refactoring
8b626f3
[CSTACKEX-279] Refactoring
71dd7fc
[CSTACKEX-279] Refactoring
7075e88
[CSTACKEX-279] Resync the code and fix the QoS issue for ROOT volume
7cff76a
[CSTACKEX-279] Resync the code and fix the QoS issue for ROOT volume
d6cb3fa
[CSTACKEX-279] Fix build issues
29669a4
[CSTACKEX-279] UI Fixes
9e8fe3e
[CSTACKEX-279] Resolved Review Comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
...ation/src/test/java/org/apache/cloudstack/engine/orchestration/CloudOrchestratorTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you 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 org.apache.cloudstack.engine.orchestration; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; | ||
|
|
||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||
| import com.cloud.offering.DiskOfferingInfo; | ||
| import com.cloud.service.ServiceOfferingVO; | ||
| import com.cloud.service.dao.ServiceOfferingDao; | ||
| import com.cloud.storage.DiskOfferingVO; | ||
| import com.cloud.storage.VMTemplateVO; | ||
| import com.cloud.storage.dao.DiskOfferingDao; | ||
| import com.cloud.storage.dao.VMTemplateDao; | ||
| import com.cloud.utils.component.ComponentContext; | ||
| import com.cloud.vm.VMInstanceVO; | ||
| import com.cloud.vm.VirtualMachineManager; | ||
| import com.cloud.vm.VmDetailConstants; | ||
| import com.cloud.vm.dao.VMInstanceDao; | ||
| import com.cloud.vm.dao.VMInstanceDetailsDao; | ||
| import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import org.junit.runner.RunWith; | ||
| import org.mockito.ArgumentCaptor; | ||
| import org.mockito.InjectMocks; | ||
| import org.mockito.Mock; | ||
| import org.mockito.MockedStatic; | ||
| import org.mockito.Mockito; | ||
| import org.mockito.junit.MockitoJUnitRunner; | ||
|
|
||
| @RunWith(MockitoJUnitRunner.class) | ||
| public class CloudOrchestratorTest { | ||
|
|
||
| private static final long VM_ID = 1L; | ||
| private static final long SERVICE_OFFERING_ID = 2L; | ||
| private static final long ROOT_DISK_OFFERING_ID = 3L; | ||
| private static final String TEMPLATE_ID = "4"; | ||
|
|
||
| @InjectMocks | ||
| private CloudOrchestrator cloudOrchestrator = new CloudOrchestrator(); | ||
|
|
||
| @Mock | ||
| private VirtualMachineManager _itMgr; | ||
| @Mock | ||
| private VMTemplateDao _templateDao; | ||
| @Mock | ||
| private VMInstanceDao _vmDao; | ||
| @Mock | ||
| private VMInstanceDetailsDao _vmInstanceDetailsDao; | ||
| @Mock | ||
| private ServiceOfferingDao _serviceOfferingDao; | ||
| @Mock | ||
| private DiskOfferingDao _diskOfferingDao; | ||
|
|
||
| @Test | ||
| public void createVirtualMachineSetsCustomIopsFromVmDetails() throws Exception { | ||
| VMInstanceVO vm = Mockito.mock(VMInstanceVO.class); | ||
| ServiceOfferingVO serviceOffering = Mockito.mock(ServiceOfferingVO.class); | ||
| DiskOfferingVO rootDiskOffering = Mockito.mock(DiskOfferingVO.class); | ||
| VMTemplateVO template = Mockito.mock(VMTemplateVO.class); | ||
| VirtualMachineEntityImpl vmEntity = Mockito.mock(VirtualMachineEntityImpl.class); | ||
|
|
||
| Mockito.when(_vmDao.findByUuid("vm-uuid")).thenReturn(vm); | ||
| Mockito.when(vm.getId()).thenReturn(VM_ID); | ||
| Mockito.when(vm.getServiceOfferingId()).thenReturn(SERVICE_OFFERING_ID); | ||
| Mockito.when(vm.getInstanceName()).thenReturn("i-1-1-VM"); | ||
| Mockito.when(_serviceOfferingDao.findById(VM_ID, SERVICE_OFFERING_ID)).thenReturn(serviceOffering); | ||
| Mockito.when(_diskOfferingDao.findById(ROOT_DISK_OFFERING_ID)).thenReturn(rootDiskOffering); | ||
| Mockito.when(rootDiskOffering.isCustomizedIops()).thenReturn(true); | ||
| Mockito.when(_templateDao.findById(Long.valueOf(TEMPLATE_ID))).thenReturn(template); | ||
|
|
||
| Map<String, String> details = new HashMap<>(); | ||
| details.put(VmDetailConstants.MIN_IOPS, "100"); | ||
| details.put(VmDetailConstants.MAX_IOPS, "1000"); | ||
| Mockito.when(_vmInstanceDetailsDao.listDetailsKeyPairs(VM_ID)).thenReturn(details); | ||
|
|
||
| try (MockedStatic<ComponentContext> componentContext = Mockito.mockStatic(ComponentContext.class)) { | ||
| componentContext.when(() -> ComponentContext.inject(VirtualMachineEntityImpl.class)).thenReturn(vmEntity); | ||
|
|
||
| cloudOrchestrator.createVirtualMachine("vm-uuid", "owner", TEMPLATE_ID, "host", "display", HypervisorType.KVM.name(), | ||
| 1, 1000, 1024, null, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), null, | ||
| null, null, null, null, ROOT_DISK_OFFERING_ID, null, null, null, null); | ||
| } | ||
|
|
||
| ArgumentCaptor<DiskOfferingInfo> rootDiskOfferingInfo = ArgumentCaptor.forClass(DiskOfferingInfo.class); | ||
| Mockito.verify(_itMgr).allocate(Mockito.eq("i-1-1-VM"), Mockito.eq(template), Mockito.eq(serviceOffering), rootDiskOfferingInfo.capture(), | ||
| Mockito.anyList(), Mockito.anyList(), Mockito.any(LinkedHashMap.class), Mockito.isNull(), Mockito.eq(HypervisorType.KVM), | ||
| Mockito.isNull(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull()); | ||
|
|
||
| Assert.assertEquals(Long.valueOf(100), rootDiskOfferingInfo.getValue().getMinIops()); | ||
| Assert.assertEquals(Long.valueOf(1000), rootDiskOfferingInfo.getValue().getMaxIops()); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check for setters also for iops specific statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From community, someone already raised the PR so i copied the same code as per the PR, will check the setter and update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the code and it is setting the value like deployVmData['details[0].minIops'] = this.minIops
deployVmData['details[0].maxIops'] = this.maxIops
So, the issue was with get only