apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.05k stars 1.1k forks source link

Root volume is moved to Allocated state after Reinstall/Restore VM #6373

Closed sureshanaparti closed 2 years ago

sureshanaparti commented 2 years ago

Root volume is Allocated state after Reinstall/Restore VM, in Stopped state (Checked with VM deployed in shared and local storage pools).

ISSUE TYPE
COMPONENT NAME
VM
CLOUDSTACK VERSION
4.17 RC2
OS / ENVIRONMENT

MS: CentOS 7 + Hypervisor: KVM + Storage: NFS, Local

SUMMARY

Reinstall/Restore operation of a Stopped VM (deployed in shared and local storage pool) succeeded, but the ROOT volume is in Allocated state.

Logs =>

2022-05-11 06:05:40,366 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (AsyncJobMgr-Heartbeat-1:ctx-b0e7b96a) (logid:6857341c) Schedule queued job-73
2022-05-11 06:05:40,371 INFO  [o.a.c.f.j.i.AsyncJobMonitor] (Work-Job-Executor-20:ctx-b125231e job-72/job-73) (logid:8520bd75) Add job-73 into job monitoring
2022-05-11 06:05:40,375 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (Work-Job-Executor-20:ctx-b125231e job-72/job-73) (logid:b3a63d7c) Executing AsyncJobVO: {id:73, userId: 2, accountId: 2, instanceType: null, instanceId: null, cmd: com.cloud.vm.VmWorkRestore, cmdInfo: rO0ABXNyABpjb20uY2xvdWQudm0uVm1Xb3JrUmVzdG9yZQK3-6IUa1sTAgABTAAKdGVtcGxhdGVJZHQAEExqYXZhL2xhbmcvTG9uZzt4cgATY29tLmNsb3VkLnZtLlZtV29ya5-ZtlbwJWdrAgAESgAJYWNjb3VudElkSgAGdXNlcklkSgAEdm1JZEwAC2hhbmRsZXJOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7eHAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAV0ABlWaXJ0dWFsTWFjaGluZU1hbmFnZXJJbXBsc3IADmphdmEubGFuZy5Mb25nO4vkkMyPI98CAAFKAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAAAAAAE, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 32988469395986, completeMsid: null, lastUpdated: null, lastPolled: null, created: Wed May 11 06:05:38 UTC 2022, removed: null}
2022-05-11 06:05:40,375 DEBUG [c.c.v.VmWorkJobDispatcher] (Work-Job-Executor-20:ctx-b125231e job-72/job-73) (logid:b3a63d7c) Run VM work job: com.cloud.vm.VmWorkRestore for VM 5, job origin: 72
2022-05-11 06:05:40,377 DEBUG [c.c.v.VmWorkJobHandlerProxy] (Work-Job-Executor-20:ctx-b125231e job-72/job-73 ctx-2be6e84e) (logid:b3a63d7c) Execute VM work job: com.cloud.vm.VmWorkRestore{"templateId":4,"userId":2,"accountId":2,"vmId":5,"handlerName":"VirtualMachineManagerImpl"}
2022-05-11 06:05:40,378 DEBUG [c.c.v.VirtualMachineManagerImpl] (Work-Job-Executor-20:ctx-b125231e job-72/job-73 ctx-2be6e84e) (logid:b3a63d7c) Restoring vm 5 with new templateId 4
...
2022-05-11 06:05:40,444 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (Work-Job-Executor-20:ctx-b125231e job-72/job-73) (logid:b3a63d7c) Done executing com.cloud.vm.VmWorkRestore for job-73
2022-05-11 06:05:40,446 INFO  [o.a.c.f.j.i.AsyncJobMonitor] (Work-Job-Executor-20:ctx-b125231e job-72/job-73) (logid:b3a63d7c) Remove job-73 from job monitoring
2022-05-11 06:05:40,460 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-49:ctx-2eee8785 job-72 ctx-ad490327) (logid:b3a63d7c) Complete async job-72, jobStatus: SUCCEEDED, resultCode: 0, result: org.apache.cloudstack.api.response.UserVmResponse/virtualmachine/{"id":"2f6610ac-72ec-4112-9d30-69d2065c8a3a","name":"NewTestLocalVM09","displayname":"NewTestLocalVM01","account":"admin","userid":"7dbb3d96-cf5d-11ec-b370-1e00ba000212","username":"admin","domainid":"64482588-cf5d-11ec-b370-1e00ba000212","domain":"ROOT","created":"2022-05-09T08:08:23+0000","lastupdated":"2022-05-11T05:57:02+0000","state":"Stopped","haenable":"false","zoneid":"67ecf93f-6958-4b19-bad4-4742c67dc093","zonename":"trl-288-k-M7-suresh-anaparti","templateid":"644b8abf-cf5d-11ec-b370-1e00ba000212","templatename":"CentOS 5.5(64-bit) no GUI (KVM)","templatedisplaytext":"CentOS 5.5(64-bit) no GUI (KVM)","passwordenabled":"false","serviceofferingid":"9ce30249-de75-49f1-92a6-3d6c85532530","serviceofferingname":"Local Instance","diskofferingid":"fb0c363a-0afd-4ac3-bd56-ae24dcd54313","diskofferingname":"Local","cpunumber":"1","cpuspeed":"500","memory":"512","guestosid":"6473e9a7-cf5d-11ec-b370-1e00ba000212","rootdeviceid":"1","rootdevicetype":"DATADISK","securitygroup":[],"nic":[{"id":"eb6aa947-170f-4d93-88fb-87c415274a8f","networkid":"cdb44e7d-898c-4e90-b36d-feb604a1e050","networkname":"testnw01","netmask":"255.255.255.0","gateway":"10.1.1.1","ipaddress":"10.1.1.139","traffictype":"Guest","type":"Isolated","isdefault":"true","macaddress":"02:00:24:76:00:03","secondaryip":[],"extradhcpoption":[],"deviceid":"0"}],"hypervisor":"KVM","instancename":"i-2-5-VM","details":{"memoryOvercommitRatio":"1.0","Message.ReservedCapacityFreed.Flag":"false","cpuOvercommitRatio":"2.0"},"affinitygroup":[],"displayvm":"true","isdynamicallyscalable":"false","ostypeid":"6473e9a7-cf5d-11ec-b370-1e00ba000212","osdisplayname":"CentOS 5.5 (64-bit)","pooltype":"Filesystem","receivedbytes":"0","sentbytes":"0","tags":[],"hasannotations":"false","jobid":"b3a63d7c-2536-43ad-b29f-4e229b4ba6de","jobstatus":"0"}

VM in Local Pool: DB =>

MariaDB [(none)]> SELECT id, uuid, name, state, instance_id, device_id, pool_id, size, updated FROM cloud.volumes WHERE instance_id = 5 ORDER BY device_id;
+----+--------------------------------------+-------------+-----------+-------------+-----------+---------+------------+---------------------+
| id | uuid                                 | name        | state     | instance_id | device_id | pool_id | size       | updated             |
+----+--------------------------------------+-------------+-----------+-------------+-----------+---------+------------+---------------------+
| 12 | 6e567702-a2e4-4cba-bded-5968cd7c4399 | ROOT-5      | Allocated |           5 |         0 |    NULL | 8589934592 | 2022-05-11 06:05:40 |
|  9 | dfd9ebda-24f1-4e49-b010-5405c19086f2 | LocalDATA01 | Ready     |           5 |         1 |       2 | 3221225472 | 2022-05-11 05:39:06 |
+----+--------------------------------------+-------------+-----------+-------------+-----------+---------+------------+---------------------+
2 rows in set (0.00 sec)
ReinstallVM_RootVolumeInAllocatedState

VM in Shared Pool:

MariaDB [(none)]> SELECT id, uuid, name, state, instance_id, device_id, pool_id, size, updated FROM cloud.volumes WHERE instance_id = 7 ORDER BY device_id;;
+----+--------------------------------------+--------+-----------+-------------+-----------+---------+------------+---------------------+
| id | uuid                                 | name   | state     | instance_id | device_id | pool_id | size       | updated             |
+----+--------------------------------------+--------+-----------+-------------+-----------+---------+------------+---------------------+
| 17 | 47c259cf-c232-43bd-89c2-79b1e2c738da | ROOT-7 | Allocated |           7 |         0 |    NULL | 8589934592 | 2022-05-11 07:32:34 |
| 16 | 8cbffab8-5452-48dc-9e04-e5e326c59c47 | DATA-7 | Ready     |           7 |         1 |       4 | 5368709120 | 2022-05-11 07:18:28 |
+----+--------------------------------------+--------+-----------+-------------+-----------+---------+------------+---------------------+
2 rows in set (0.01 sec)
ReinstallVM_RootVolumeInAllocatedState_SharedPool
STEPS TO REPRODUCE
EXPECTED RESULTS

Reinstall VM should succeed with all volumes in Ready state. If fails, should throw relevant error.

ACTUAL RESULTS

Reinstall VM succeeds with Root volume in Allocated state.

weizhouapache commented 2 years ago

@sureshanaparti As I remember, the volume is Allocated state when vm is reinstalled. When vm is started, the volume will be allocated to pool and switch to Ready state

Pearl1594 commented 2 years ago

@sureshanaparti the root volume being in Allocated state when a stopped VM is reinstalled is probably the right behaviour and I have verified the same in older versions of ACS - behviour is consistent. It gets to Ready state on start of the VM. Also, a running VM when reinstalled has its root volume correctly marked as Ready.

sureshanaparti commented 2 years ago

The Root Volume is Created and Ready after VM started and VM is booting, seems to be the expected behavior. Thanks @weizhouapache @Pearl1594. Closing this ticket.