You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "slavkap (via GitHub)" <gi...@apache.org> on 2024/01/04 17:09:40 UTC
[PR] Fix KVM import and list unmanaged VMs [cloudstack]
slavkap opened a new pull request, #8445:
URL: https://github.com/apache/cloudstack/pull/8445
### Description
This PR fixes part (issues 2 and3) of #8439
1 - Fix of VM insert for VMs with StorPool volumes
2 - Fix of the list/insert unmanaged VMs with RBD volumes
### 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
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [X] Minor
- [ ] Trivial
### How Has This Been Tested?
manually tested
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1882966796
@shwstppr 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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "nvazquez (via GitHub)" <gi...@apache.org>.
nvazquez commented on code in PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#discussion_r1444699698
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetUnmanagedInstancesCommandWrapper.java:
##########
@@ -203,14 +197,17 @@ private List<UnmanagedInstanceTO.Disk> getUnmanagedInstanceDisks(List<LibvirtVMD
disk.setDatastoreHost(sourceHostPath.first());
disk.setDatastorePath(sourceHostPath.second());
} else {
- disk.setDatastorePath(diskDef.getSourcePath());
+ int pathEnd = diskDef.getSourcePath().lastIndexOf("/");
+ if (pathEnd >= 0) {
+ disk.setDatastorePath(diskDef.getSourcePath().substring(0, pathEnd));
+ }
disk.setDatastoreHost(diskDef.getSourceHost());
}
disk.setDatastoreType(diskDef.getDiskType().toString());
disk.setDatastorePort(diskDef.getSourceHostPort());
- disk.setImagePath(imagePath);
- disk.setDatastoreName(imagePath.substring(imagePath.lastIndexOf("/")));
+ disk.setImagePath(diskDef.getSourcePath());
+ disk.setDatastoreName(disk.getDatastorePath());
Review Comment:
@slavkap I tested your PR on advanced zone on NFS storage and was able to import and list correctly (no regressions). However I found some differences:
In case of NFS the datastore name is set incorrectly as the disk's relative path on the pool (previously was the same as the datastore path):
````
(localcloud) 🐱 > list unmanagedinstances clusterid=e4ac8607-6839-42ef-abb9-fa66d3512b3a
{
"count": 1,
"unmanagedinstance": [
{
"clusterid": "e4ac8607-6839-42ef-abb9-fa66d3512b3a",
"clustername": "p1-c2",
"cpucorepersocket": -1,
"cpunumber": 1,
"cpuspeed": 397,
"disk": [
{
"capacity": 8589934592,
"controller": "virtio",
"datastorehost": "10.0.32.4",
"datastorename": "/ea4b2296-d349-4968-ab72-c8eb523b556e",
"datastorepath": "/acs/primary/ref-trl-6074-k-M7-nicolas-vazquez/ref-trl-6074-k-M7-nicolas-vazquez-kvm-pri1",
"datastoretype": "file",
"id": "0",
"imagepath": "/mnt/97e4c9ed-e3bc-3e26-b103-7967fc9feae1/ea4b2296-d349-4968-ab72-c8eb523b556e",
"label": "vda",
"position": 0
}
],
````
From the VM XML domain:
````
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/mnt/97e4c9ed-e3bc-3e26-b103-7967fc9feae1/ea4b2296-d349-4968-ab72-c8eb523b556e' index='2'/>
````
##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -551,7 +551,7 @@ private StoragePool getStoragePool(final UnmanagedInstanceTO.Disk disk, final Da
List<StoragePoolVO> pools = primaryDataStoreDao.listPoolsByCluster(cluster.getId());
pools.addAll(primaryDataStoreDao.listByDataCenterId(zone.getId()));
for (StoragePool pool : pools) {
- if (pool.getPath().endsWith(dsName)) {
+ if (StringUtils.containsAny(pool.getPath(), dsName, dsPath)) {
Review Comment:
Adding to @DaanHoogland's comment, perhaps we can add a condition to keep the current check for non RBD disks? Raising a concern since the Vmware import of unmanaged instances uses the same code
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1883048374
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8251
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877602080
@shwstppr 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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877479336
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/8445?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`746bae7`)](https://app.codecov.io/gh/apache/cloudstack/commit/746bae740eaa4a1cb2c130fa87c3ee05411228b1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 30.79% compared to head [(`309c09b`)](https://app.codecov.io/gh/apache/cloudstack/pull/8445?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 4.39%.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #8445 +/- ##
============================================
- Coverage 30.79% 4.39% -26.40%
============================================
Files 5341 361 -4980
Lines 374869 28621 -346248
Branches 54520 4992 -49528
============================================
- Hits 115429 1258 -114171
+ Misses 244184 27224 -216960
+ Partials 15256 139 -15117
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/8445/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [simulator-marvin-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8445/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/8445/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.39% <ø> (ø)` | |
| [unit-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8445/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
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/8445?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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877594832
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8202
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1883273412
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8256
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1883157261
@nvazquez 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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1878281920
<b>[SF] Trillian test result (tid-8725)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 46357 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8445-t8725-kvm-centos7.zip
Smoke tests completed. 119 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_02_trigger_shutdown | `Failure` | 336.70 | test_safe_shutdown.py
test_07_deploy_kubernetes_ha_cluster | `Failure` | 3611.63 | test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster | `Failure` | 0.04 | test_kubernetes_clusters.py
test_09_delete_kubernetes_ha_cluster | `Failure` | 0.04 | test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster | `Failure` | 42.62 | test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardown | `Error` | 90.87 | test_kubernetes_clusters.py
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "nvazquez (via GitHub)" <gi...@apache.org>.
nvazquez commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1883153677
@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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr merged PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877513144
@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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#discussion_r1442655296
##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -551,7 +551,7 @@ private StoragePool getStoragePool(final UnmanagedInstanceTO.Disk disk, final Da
List<StoragePoolVO> pools = primaryDataStoreDao.listPoolsByCluster(cluster.getId());
pools.addAll(primaryDataStoreDao.listByDataCenterId(zone.getId()));
for (StoragePool pool : pools) {
- if (pool.getPath().endsWith(dsName)) {
+ if (StringUtils.containsAny(pool.getPath(), dsName, dsPath)) {
Review Comment:
aren't we replacing a bug with a bug here (nitpicking maybe but genuine question)
`path.endswith("bla")` is different from `StringUtils.containsAny(path, "bla", "blob")`
considder paths:
- "bla/blah"
- "bla/blob"
- "bla/bleb"
Neither would match the first condition, and though the first is supposed to match the second condition (as I understand) the other two seem false positives to me.
Am I misinterpreting this @slavkap ?
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877515876
@shwstppr 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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1877600670
@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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#issuecomment-1882965031
@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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "slavkap (via GitHub)" <gi...@apache.org>.
slavkap commented on code in PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#discussion_r1446123642
##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -551,7 +551,7 @@ private StoragePool getStoragePool(final UnmanagedInstanceTO.Disk disk, final Da
List<StoragePoolVO> pools = primaryDataStoreDao.listPoolsByCluster(cluster.getId());
pools.addAll(primaryDataStoreDao.listByDataCenterId(zone.getId()));
for (StoragePool pool : pools) {
- if (pool.getPath().endsWith(dsName)) {
+ if (StringUtils.containsAny(pool.getPath(), dsName, dsPath)) {
Review Comment:
thanks @DaanHoogland, @nvazquez! I've changed it to check only path vs dsPath. Neither for KVM/VMware we need to check for the datastore name in the primary storage path
--
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] Fix KVM import and list unmanaged VMs [cloudstack]
Posted by "nvazquez (via GitHub)" <gi...@apache.org>.
nvazquez commented on code in PR #8445:
URL: https://github.com/apache/cloudstack/pull/8445#discussion_r1446031091
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetUnmanagedInstancesCommandWrapper.java:
##########
@@ -203,14 +197,17 @@ private List<UnmanagedInstanceTO.Disk> getUnmanagedInstanceDisks(List<LibvirtVMD
disk.setDatastoreHost(sourceHostPath.first());
disk.setDatastorePath(sourceHostPath.second());
} else {
- disk.setDatastorePath(diskDef.getSourcePath());
+ int pathEnd = diskDef.getSourcePath().lastIndexOf("/");
+ if (pathEnd >= 0) {
+ disk.setDatastorePath(diskDef.getSourcePath().substring(0, pathEnd));
+ }
disk.setDatastoreHost(diskDef.getSourceHost());
}
disk.setDatastoreType(diskDef.getDiskType().toString());
disk.setDatastorePort(diskDef.getSourceHostPort());
- disk.setImagePath(imagePath);
- disk.setDatastoreName(imagePath.substring(imagePath.lastIndexOf("/")));
+ disk.setImagePath(diskDef.getSourcePath());
+ disk.setDatastoreName(disk.getDatastorePath());
Review Comment:
Sorry, confused the jars while testing. Its working properly after the fix
--
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