You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "sureshanaparti (via GitHub)" <gi...@apache.org> on 2024/05/03 08:29:50 UTC
[PR] While starting VM with considerlasthost enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
sureshanaparti opened a new pull request, #9037:
URL: https://github.com/apache/cloudstack/pull/9037
### Description
This PR doesn't load host tags/details for the last host when it doesn't exist, while starting VM with considerlasthost enabled.
Fixes #9033
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!--- ******************************************************************************* -->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ******************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] build/CI
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [x] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100476588
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9575
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100355594
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2103168792
<b>[SF] Trillian test result (tid-10196)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40429 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9037-t10196-kvm-centos7.zip
Smoke tests completed. 110 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100354247
> @sureshanaparti #7214 has refactored this code snippet in main/4.20 branch we can consider the backport to 4.18/4.19, and fix the issue like
>
> ```
> private DeployDestination deployInVmLastHost(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids,
> DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
> boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
> HostVO host = _hostDao.findById(vm.getLastHostId());
> + if (host == null) {
> + logger.warn(String.format("The last host [id=%s] does not exist, it may have been removed.", vm.getLastHostId()));
> + return null;
> + }
> _hostDao.loadHostTags(host);
> _hostDao.loadDetails(host);
> ```
@weizhouapache I think, better to fix this issue (no backport for that refactored code). PR #7214 also doesn't fix load tags issue, needs to be fixed here - https://github.com/apache/cloudstack/pull/7214/files#r1593867688
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2102008467
> > > @sureshanaparti right, #7214 does not fix any issue. if no backport (and then fix), this PR will only be applicable for 4.18/4.19, we need a separated pr for 4.20/main
> >
> >
> > correct @weizhouapache , separate PR for 4.20/main (will create one)
>
> ok , it should work @sureshanaparti
PR for 4.20/main here: https://github.com/apache/cloudstack/pull/9063
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100417377
> @sureshanaparti right, #7214 does not fix any issue. if no backport (and then fix), this PR will only be applicable for 4.18/4.19, we need a separated pr for 4.20/main
correct @weizhouapache , separate PR for 4.20/main (will create one)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092555512
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2102012861
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2147197321
@shwstppr , is [this](https://github.com/apache/cloudstack/pull/9037#discussion_r1590673513) concern answered
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#discussion_r1590673513
##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -415,105 +415,107 @@ public DeployDestination planDeployment(VirtualMachineProfile vmProfile, Deploym
s_logger.debug("This VM has last host_id specified, trying to choose the same host: " + vm.getLastHostId());
HostVO host = _hostDao.findById(vm.getLastHostId());
- _hostDao.loadHostTags(host);
- _hostDao.loadDetails(host);
ServiceOfferingDetailsVO offeringDetails = null;
if (host == null) {
s_logger.debug("The last host of this VM cannot be found");
- } else if (avoids.shouldAvoid(host)) {
- s_logger.debug("The last host of this VM is in avoid set");
- } else if (plan.getClusterId() != null && host.getClusterId() != null
- && !plan.getClusterId().equals(host.getClusterId())) {
- s_logger.debug("The last host of this VM cannot be picked as the plan specifies different clusterId: "
- + plan.getClusterId());
- } else if (_capacityMgr.checkIfHostReachMaxGuestLimit(host)) {
- s_logger.debug("The last Host, hostId: " + host.getId() +
- " already has max Running VMs(count includes system VMs), skipping this and trying other available hosts");
- } else if ((offeringDetails = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.vgpuType.toString())) != null) {
- ServiceOfferingDetailsVO groupName = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.pciDevice.toString());
- if(!_resourceMgr.isGPUDeviceAvailable(host.getId(), groupName.getValue(), offeringDetails.getValue())){
- s_logger.debug("The last host of this VM does not have required GPU devices available");
- }
- } else if (volumesRequireEncryption && !Boolean.parseBoolean(host.getDetail(Host.HOST_VOLUME_ENCRYPTION))) {
- s_logger.warn(String.format("The last host of this VM %s does not support volume encryption, which is required by this VM.", host));
} else {
- if (host.getStatus() == Status.Up) {
- if (checkVmProfileAndHost(vmProfile, host)) {
- long cluster_id = host.getClusterId();
- ClusterDetailsVO cluster_detail_cpu = _clusterDetailsDao.findDetail(cluster_id,
- "cpuOvercommitRatio");
- ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id,
- "memoryOvercommitRatio");
- Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue());
- Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue());
-
- boolean hostHasCpuCapability, hostHasCapacity = false;
- hostHasCpuCapability = _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed());
-
- if (hostHasCpuCapability) {
- // first check from reserved capacity
- hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, cpuOvercommitRatio, memoryOvercommitRatio, true);
-
- // if not reserved, check the free capacity
- if (!hostHasCapacity)
- hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true);
- }
-
- boolean displayStorage = getDisplayStorageFromVmProfile(vmProfile);
- if (hostHasCapacity
- && hostHasCpuCapability) {
- s_logger.debug("The last host of this VM is UP and has enough capacity");
- s_logger.debug("Now checking for suitable pools under zone: " + host.getDataCenterId()
- + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId());
-
- Pod pod = _podDao.findById(host.getPodId());
- Cluster cluster = _clusterDao.findById(host.getClusterId());
- if (vm.getHypervisorType() == HypervisorType.BareMetal) {
- DeployDestination dest = new DeployDestination(dc, pod, cluster, host, new HashMap<Volume, StoragePool>(), displayStorage);
- s_logger.debug("Returning Deployment Destination: " + dest);
- return dest;
+ _hostDao.loadHostTags(host);
+ _hostDao.loadDetails(host);
+ if (avoids.shouldAvoid(host)) {
+ s_logger.debug("The last host of this VM is in avoid set");
+ } else if (plan.getClusterId() != null && host.getClusterId() != null
+ && !plan.getClusterId().equals(host.getClusterId())) {
+ s_logger.debug("The last host of this VM cannot be picked as the plan specifies different clusterId: "
+ + plan.getClusterId());
+ } else if (_capacityMgr.checkIfHostReachMaxGuestLimit(host)) {
+ s_logger.debug("The last Host, hostId: " + host.getId() +
+ " already has max Running VMs(count includes system VMs), skipping this and trying other available hosts");
+ } else if ((offeringDetails = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.vgpuType.toString())) != null) {
+ ServiceOfferingDetailsVO groupName = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.pciDevice.toString());
+ if(!_resourceMgr.isGPUDeviceAvailable(host.getId(), groupName.getValue(), offeringDetails.getValue())){
+ s_logger.debug("The last host of this VM does not have required GPU devices available");
+ }
+ } else if (volumesRequireEncryption && !Boolean.parseBoolean(host.getDetail(Host.HOST_VOLUME_ENCRYPTION))) {
+ s_logger.warn(String.format("The last host of this VM %s does not support volume encryption, which is required by this VM.", host));
+ } else {
Review Comment:
Makes sense to load tags/details only for non-null host. Should we also consider refactoring some of the checks in separate methods?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100358551
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092622225
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/9037?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `54.09836%` with `28 lines` in your changes are missing coverage. Please review.
> Project coverage is 12.24%. Comparing base [(`5c9d79e`)](https://app.codecov.io/gh/apache/cloudstack/commit/5c9d79e3fb474c583522bda978a620ffee782975?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`d242123`)](https://app.codecov.io/gh/apache/cloudstack/pull/9037?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
| [Files](https://app.codecov.io/gh/apache/cloudstack/pull/9037?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...om/cloud/deploy/DeploymentPlanningManagerImpl.java](https://app.codecov.io/gh/apache/cloudstack/pull/9037?src=pr&el=tree&filepath=server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fcloud%2Fdeploy%2FDeploymentPlanningManagerImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvY29tL2Nsb3VkL2RlcGxveS9EZXBsb3ltZW50UGxhbm5pbmdNYW5hZ2VySW1wbC5qYXZh) | 54.09% | [13 Missing and 15 partials :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/9037?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.18 #9037 +/- ##
===========================================
Coverage 12.24% 12.24%
- Complexity 9291 9293 +2
===========================================
Files 4698 4698
Lines 414259 414259
Branches 52267 50777 -1490
===========================================
+ Hits 50707 50719 +12
+ Misses 357251 357237 -14
- Partials 6301 6303 +2
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9037/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/9037/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `12.24% <54.09%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/9037?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092654941
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9526
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#discussion_r1593853373
##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -415,105 +415,107 @@ public DeployDestination planDeployment(VirtualMachineProfile vmProfile, Deploym
s_logger.debug("This VM has last host_id specified, trying to choose the same host: " + vm.getLastHostId());
HostVO host = _hostDao.findById(vm.getLastHostId());
- _hostDao.loadHostTags(host);
- _hostDao.loadDetails(host);
ServiceOfferingDetailsVO offeringDetails = null;
if (host == null) {
s_logger.debug("The last host of this VM cannot be found");
- } else if (avoids.shouldAvoid(host)) {
- s_logger.debug("The last host of this VM is in avoid set");
- } else if (plan.getClusterId() != null && host.getClusterId() != null
- && !plan.getClusterId().equals(host.getClusterId())) {
- s_logger.debug("The last host of this VM cannot be picked as the plan specifies different clusterId: "
- + plan.getClusterId());
- } else if (_capacityMgr.checkIfHostReachMaxGuestLimit(host)) {
- s_logger.debug("The last Host, hostId: " + host.getId() +
- " already has max Running VMs(count includes system VMs), skipping this and trying other available hosts");
- } else if ((offeringDetails = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.vgpuType.toString())) != null) {
- ServiceOfferingDetailsVO groupName = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.pciDevice.toString());
- if(!_resourceMgr.isGPUDeviceAvailable(host.getId(), groupName.getValue(), offeringDetails.getValue())){
- s_logger.debug("The last host of this VM does not have required GPU devices available");
- }
- } else if (volumesRequireEncryption && !Boolean.parseBoolean(host.getDetail(Host.HOST_VOLUME_ENCRYPTION))) {
- s_logger.warn(String.format("The last host of this VM %s does not support volume encryption, which is required by this VM.", host));
} else {
- if (host.getStatus() == Status.Up) {
- if (checkVmProfileAndHost(vmProfile, host)) {
- long cluster_id = host.getClusterId();
- ClusterDetailsVO cluster_detail_cpu = _clusterDetailsDao.findDetail(cluster_id,
- "cpuOvercommitRatio");
- ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id,
- "memoryOvercommitRatio");
- Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue());
- Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue());
-
- boolean hostHasCpuCapability, hostHasCapacity = false;
- hostHasCpuCapability = _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed());
-
- if (hostHasCpuCapability) {
- // first check from reserved capacity
- hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, cpuOvercommitRatio, memoryOvercommitRatio, true);
-
- // if not reserved, check the free capacity
- if (!hostHasCapacity)
- hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true);
- }
-
- boolean displayStorage = getDisplayStorageFromVmProfile(vmProfile);
- if (hostHasCapacity
- && hostHasCpuCapability) {
- s_logger.debug("The last host of this VM is UP and has enough capacity");
- s_logger.debug("Now checking for suitable pools under zone: " + host.getDataCenterId()
- + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId());
-
- Pod pod = _podDao.findById(host.getPodId());
- Cluster cluster = _clusterDao.findById(host.getClusterId());
- if (vm.getHypervisorType() == HypervisorType.BareMetal) {
- DeployDestination dest = new DeployDestination(dc, pod, cluster, host, new HashMap<Volume, StoragePool>(), displayStorage);
- s_logger.debug("Returning Deployment Destination: " + dest);
- return dest;
+ _hostDao.loadHostTags(host);
+ _hostDao.loadDetails(host);
+ if (avoids.shouldAvoid(host)) {
+ s_logger.debug("The last host of this VM is in avoid set");
+ } else if (plan.getClusterId() != null && host.getClusterId() != null
+ && !plan.getClusterId().equals(host.getClusterId())) {
+ s_logger.debug("The last host of this VM cannot be picked as the plan specifies different clusterId: "
+ + plan.getClusterId());
+ } else if (_capacityMgr.checkIfHostReachMaxGuestLimit(host)) {
+ s_logger.debug("The last Host, hostId: " + host.getId() +
+ " already has max Running VMs(count includes system VMs), skipping this and trying other available hosts");
+ } else if ((offeringDetails = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.vgpuType.toString())) != null) {
+ ServiceOfferingDetailsVO groupName = _serviceOfferingDetailsDao.findDetail(offering.getId(), GPU.Keys.pciDevice.toString());
+ if(!_resourceMgr.isGPUDeviceAvailable(host.getId(), groupName.getValue(), offeringDetails.getValue())){
+ s_logger.debug("The last host of this VM does not have required GPU devices available");
+ }
+ } else if (volumesRequireEncryption && !Boolean.parseBoolean(host.getDetail(Host.HOST_VOLUME_ENCRYPTION))) {
+ s_logger.warn(String.format("The last host of this VM %s does not support volume encryption, which is required by this VM.", host));
+ } else {
Review Comment:
@shwstppr there was some refactoring done on this code, in PR #7214 , will see if any further refactoring required (if so, that will be targeted to main, on a separate PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092570389
@sureshanaparti
#7214 has refactored this code snippet in main/4.20 branch
we can consider the backport to 4.18/4.19, and fix the issue like
```
private DeployDestination deployInVmLastHost(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids,
DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
HostVO host = _hostDao.findById(vm.getLastHostId());
+ if (host == null) {
+ logger.warn(String.format("The last host [id=%s] does not exist, it may have been removed.", vm.getLastHostId()));
+ return null;
+ }
_hostDao.loadHostTags(host);
_hostDao.loadDetails(host);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2092556422
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2147218182
@DaanHoogland yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2102014222
@sureshanaparti a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100444447
> > @sureshanaparti right, #7214 does not fix any issue. if no backport (and then fix), this PR will only be applicable for 4.18/4.19, we need a separated pr for 4.20/main
>
> correct @weizhouapache , separate PR for 4.20/main (will create one)
ok , it should work @sureshanaparti
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037#issuecomment-2100372952
> > @sureshanaparti #7214 has refactored this code snippet in main/4.20 branch we can consider the backport to 4.18/4.19, and fix the issue like
> > ```
> > private DeployDestination deployInVmLastHost(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids,
> > DeploymentPlanner planner, VirtualMachine vm, DataCenter dc, ServiceOffering offering, int cpuRequested, long ramRequested,
> > boolean volumesRequireEncryption) throws InsufficientServerCapacityException {
> > HostVO host = _hostDao.findById(vm.getLastHostId());
> > + if (host == null) {
> > + logger.warn(String.format("The last host [id=%s] does not exist, it may have been removed.", vm.getLastHostId()));
> > + return null;
> > + }
> > _hostDao.loadHostTags(host);
> > _hostDao.loadDetails(host);
> > ```
>
> @weizhouapache I think, better to fix this issue (no backport for that refactored code). PR #7214 also doesn't fix load tags issue, needs to be fixed here - https://github.com/apache/cloudstack/pull/7214/files#r1593867688
@sureshanaparti
right, #7214 does not fix any issue.
if no backport (and then fix), this PR will only be applicable for 4.18/4.19, we need a separated pr for 4.20/main
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] While starting VM with 'considerlasthost' enabled, don't load host tags/details for the last host when it doesn't exist [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland merged PR #9037:
URL: https://github.com/apache/cloudstack/pull/9037
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org