| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…lume that is attached to a vm in starting mode from being migrated
Codecov ReportAttention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## 4.19 #9725 +/- ##
============================================
+ Coverage 15.11% 15.85% +0.73%
- Complexity 11184 11269 +85
============================================
Files 5402 5042 -360
Lines 473120 444385 -28735
Branches 58327 52630 -5697
============================================
- Hits 71507 70441 -1066
+ Misses 393812 366072 -27740
- Partials 7801 7872 +71
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Sorry, something went wrong.
There was a problem hiding this comment.
CLGTM
Sorry, something went wrong.
|
Is there any other state that we should be checking besides starting? migrating, for example? |
Sorry, something went wrong.
Good point, though this is already an improvement; Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."),
Running(false, "VM is running. host id has the host that it is running on."),
Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."),
Stopped(false, "VM is stopped. host id should be null."),
Destroyed(false, "VM is marked for destroy."),
Expunging(true, "VM is being expunged."),
Migrating(true, "VM is being migrated. host id holds to from host"),
Error(false, "VM is in error"),
Unknown(false, "VM state is unknown."),
Shutdown(false, "VM state is shutdown from inside"),
Restoring(true, "VM is being restored from backup");
I think (at least) Stopping, Destroyed, Expunging, Restoring are good candidate VirtualMachine.States to include. Or in reverse, only Running, Stopped, Shutdown and maybe Error or Unknown are good vm states to migrate volumes for. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, I manually tested the PR in a local environment.
I verified that CloudStack doesn't allow the operator to migrate a volume when the virtual machine related to it is starting.
root@cloudstack:~# grep 'logid:d36d1bbc' /var/log/cloudstack/management/management-server.log
2025-01-03 12:36:08,677 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5] (API-Job-Executor-11:[ctx-8017eead, job-200]) (logid:d36d1bbc) Executing AsyncJobVO: {id:200, userId: 2, accountId: 2, instanceType: Volume, instanceId: 27, cmd: org.apache.cloudstack.api.command.admin.volume.MigrateVolumeCmdByAdmin, cmdInfo: {"response":"json","ctxUserId":"2","sessionkey":"7FhCQRxwVcXt_poXEs3mLf8akmA","volumeid":"30b7f14e-1f8f-4e9c-b364-a9887bc254f4","httpmethod":"GET","ctxStartEventId":"398","ctxDetails":"{\"interface com.cloud.storage.StoragePool\":\"10d28cdf-71a7-33ad-802e-f4ec9042e4fd\",\"interface com.cloud.storage.Volume\":\"30b7f14e-1f8f-4e9c-b364-a9887bc254f4\"}","ctxAccountId":"2","livemigrate":"true","cmdEventType":"VOLUME.MIGRATE","storageid":"10d28cdf-71a7-33ad-802e-f4ec9042e4fd"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 227341783673585, completeMsid: null, lastUpdated: null, lastPolled: null, created: null, removed: null}
2025-01-03 12:36:34,413 DEBUG [c.c.s.VolumeApiServiceImpl] (API-Job-Executor-11:[ctx-8017eead, job-200, ctx-ccb65616]) (logid:d36d1bbc) Unable to migrate volume: [ROOT-24] Id: [27] because the VM: [i-2-24-VM] Id: [6375962a-980e-429e-ba7a-8f164a74b597] has not started yet.
2025-01-03 12:36:37,885 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-11:[ctx-8017eead, job-200]) (logid:d36d1bbc) Unexpected exception while executing org.apache.cloudstack.api.command.admin.volume.MigrateVolumeCmdByAdmin com.cloud.utils.exception.CloudRuntimeException: Volume migration is not allowed while the VM is starting.
2025-01-03 12:36:37,888 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-11:[ctx-8017eead, job-200]) (logid:d36d1bbc) Complete async job-200, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Volume migration is not allowed while the VM is starting."}
Sorry, something went wrong.
|
thanks @bernardodemarco @JoaoJandre , do you agree that this PR is good to go, even when more improvements are possible? |
Sorry, something went wrong.
|
@DaanHoogland considering it's an easy change, I don't see why introduce this and change it later. |
Sorry, something went wrong.
Yes, no problem. I'll update the verification to only allow the migration to be performed when the VM is Running, Stopped or Shutdown. |
Sorry, something went wrong.
@DaanHoogland, @rohityadavcloud, @JoaoJandre I've just applied the changes. root@cloudstack:~# grep -a 'logid:bf08211b' /var/log/cloudstack/management/management-server.log
2025-01-06 12:13:48,480 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-7:ctx-8253b178 job-141) (logid:bf08211b) Executing AsyncJobVO: {id:141, userId: 2, accountId: 2, instanceType: Volume, instanceId: 21, cmd: org.apache.cloudstack.api.command.admin.volume.MigrateVolumeCmdByAdmin, cmdInfo: {"response":"json","ctxUserId":"2","sessionkey":"07_Zt7hC_aogIMgiM2EDW7Hs0xk","volumeid":"8dfa4a5e-2e0f-4c57-ad1e-2a19b6a3c6b9","httpmethod":"GET","ctxStartEventId":"273","ctxDetails":"{\"interface com.cloud.storage.Volume\":\"8dfa4a5e-2e0f-4c57-ad1e-2a19b6a3c6b9\",\"interface com.cloud.storage.StoragePool\":\"a0566c34-a49d-31bc-865f-3b57806131d6\"}","ctxAccountId":"2","livemigrate":"false","cmdEventType":"VOLUME.MIGRATE","storageid":"a0566c34-a49d-31bc-865f-3b57806131d6"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 227341783673585, completeMsid: null, lastUpdated: null, lastPolled: null, created: null, removed: null}
2025-01-06 12:13:48,488 DEBUG [c.c.s.VolumeApiServiceImpl] (API-Job-Executor-7:ctx-8253b178 job-141 ctx-fe58e892) (logid:bf08211b) Unable to migrate volume: [ROOT-19] Id: [21] because the VM: [i-2-19-VM] Id: [9228084c-7e2f-4e08-b40d-99a96c2ec23a] is in state [Stopping], which is not supported for migration.
2025-01-06 12:13:48,493 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-7:ctx-8253b178 job-141) (logid:bf08211b) Unexpected exception while executing org.apache.cloudstack.api.command.admin.volume.MigrateVolumeCmdByAdmin
2025-01-06 12:13:48,496 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-7:ctx-8253b178 job-141) (logid:bf08211b) Complete async job-141, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Volume migration is not allowed when the VM is in the Stopping state. Supported states are: [Stopped, Running, Shutdown]."} |
Sorry, something went wrong.
|
@DaanHoogland 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. |
Sorry, something went wrong.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12002 |
Sorry, something went wrong.
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Sorry, something went wrong.
|
[SF] Trillian test result (tid-12056)
|
Sorry, something went wrong.
* 4.19: Restrict the migration of volumes attached to VMs in Starting state (#9725)
…pache#9725) Co-authored-by: Bernardo De Marco Gonçalves <bernardomg2004@gmail.com>
| Back | FazBrowse Home | New Git URL |
Description
This PR restricts users from migrating volumes attached to VMs that are in starting state. Migrating volumes while their VMs are starting shouldn't be allowed because sometimes the VM could end up not actually starting, and if ACS starts migrating its volume, this could lead to other issues.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
ImageHow Has This Been Tested?
I tested this PR by deploying an instance and then trying to migrate its volume while the instance was starting. Before the changes, the volume migration process would start. After the migration, an error is thrown, as expected.