[
https://issues.apache.org/jira/browse/CLOUDSTACK-8939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15954965#comment-15954965
]
ASF GitHub Bot commented on CLOUDSTACK-8939:
--------------------------------------------
Github user niteshsarda commented on the issue:
https://github.com/apache/cloudstack/pull/914
I have tested this and **LGTM** for test.
Following are the test results :
**Before applying fix :**
[root@xenserver-jay ~]# xe vbd-list vm-name-label=i-2-120-VM empty=false
params=vdi-uuid
vdi-uuid ( RO) : 674c2c07-954e-4fa0-943a-979a71748727
[root@xenserver-jay ~]# xe vdi-list
params=physical-utilisation,sm-config,is-a-snapshot
uuid=674c2c07-954e-4fa0-943a-979a71748727
is-a-snapshot ( RO) : false
physical-utilisation ( RO): 81256448
sm-config (MRO):
host_OpaqueRef:a3c1c534-b5e3-6cb5-10af-b56dead63fc0: RW; vhd-parent:
1aac168d-22d2-4796-8669-48a3f4361dfc
[root@xenserver-jay ~]# xe vdi-list
params=physical-utilisation,sm-config,is-a-snapshot
uuid=1aac168d-22d2-4796-8669-48a3f4361dfc
is-a-snapshot ( RO) : false
physical-utilisation ( RO): 233251328
sm-config (MRO): vhd-blocks:
eJxjYEAB7AykARFGPc1cN4UVJGqDAUYG5tZJF0ymbpi4bYUCAxPJ+nn2sDQLMGwTYzzI0OvAQob1AgIBip6BrAIrG0jWDAEAQmQNjA==;
vhd-parent: 55943089-24fa-4fbe-a44e-e57fe9a080ed
[root@xenserver-jay ~]# xe vdi-list name-label=Suspend\ image params=all
uuid ( RO) : 105fbe1d-973b-4d8d-82e7-96246669a769
name-label ( RW): Suspend image
name-description ( RW): Suspend image
is-a-snapshot ( RO): true
snapshot-of ( RO): <not in database>
snapshots ( RO):
snapshot-time ( RO): 20170401T07:49:50Z
allowed-operations (SRO): forget; generate_config; update; resize;
destroy; clone; copy; snapshot
current-operations (SRO):
sr-uuid ( RO): 99b84794-d0d6-46c6-fa42-07af5b423b8c
sr-name-label ( RO): d2fecabd-61cf-3458-a120-ea01a4f91c29
vbd-uuids (SRO):
crashdump-uuids (SRO):
virtual-size ( RO): 782237696
physical-utilisation ( RO): 6144
location ( RO): 105fbe1d-973b-4d8d-82e7-96246669a769
type ( RO): Suspend
sharable ( RO): false
read-only ( RO): false
storage-lock ( RO): false
managed ( RO): true
parent ( RO): <not in database>
missing ( RO): false
other-config (MRW): content_id:
842a46b4-bffd-70fb-b00a-47c39de8959b
xenstore-data (MRO):
sm-config (MRO): vhd-parent:
638118a6-5f85-4c35-9aa8-d19793a144a8
on-boot ( RW): persist
allow-caching ( RW): false
metadata-latest ( RO): false
metadata-of-pool ( RO): <not in database>
tags (SRW):
[root@xenserver-jay ~]# xe vdi-list
uuid=638118a6-5f85-4c35-9aa8-d19793a144a8 params=all
uuid ( RO) : 638118a6-5f85-4c35-9aa8-d19793a144a8
name-label ( RW): base copy
name-description ( RW):
is-a-snapshot ( RO): false
snapshot-of ( RO): <not in database>
snapshots ( RO):
snapshot-time ( RO): 19700101T00:00:00Z
allowed-operations (SRO): forget; generate_config; update; resize;
destroy; clone; copy; snapshot
current-operations (SRO):
sr-uuid ( RO): 99b84794-d0d6-46c6-fa42-07af5b423b8c
sr-name-label ( RO): d2fecabd-61cf-3458-a120-ea01a4f91c29
vbd-uuids (SRO):
crashdump-uuids (SRO):
virtual-size ( RO): 782237696
physical-utilisation ( RO): 548430336
location ( RO): 638118a6-5f85-4c35-9aa8-d19793a144a8
type ( RO): User
sharable ( RO): false
read-only ( RO): true
storage-lock ( RO): false
managed ( RO): false
parent ( RO): <not in database>
missing ( RO): false
other-config (MRW):
xenstore-data (MRO):
sm-config (MRO): vhd-blocks: eJz7/x8/+MGAAgD69CDZ
on-boot ( RW): persist
allow-caching ( RW): false
metadata-latest ( RO): false
metadata-of-pool ( RO): <not in database>
tags (SRW):
mysql> select * from cloud.usage_event where resource_name like
"i-2-120-VM%" \G
*************************** 1. row ***************************
id: 84
type: VMSNAPSHOT.CREATE
account_id: 2
created: 2017-04-01 07:50:42
zone_id: 2
resource_id: 120
resource_name: i-2-120-VM_VS_20170401074841
offering_id: NULL
template_id: 120
size: 233272320
resource_type: NULL
processed: 0
virtual_size: NULL
**After applying fix :**
[root@xenserver-jay ~]# xe vbd-list vm-name-label=i-2-120-VM empty=false
params=vdi-uuid
vdi-uuid ( RO) : 674c2c07-954e-4fa0-943a-979a71748727
[root@xenserver-jay ~]# xe vdi-list
params=physical-utilisation,sm-config,is-a-snapshot
uuid=674c2c07-954e-4fa0-943a-979a71748727
is-a-snapshot ( RO) : false
physical-utilisation ( RO): 4215296
sm-config (MRO): vhd-parent:
1aac168d-22d2-4796-8669-48a3f4361dfc;
host_OpaqueRef:a3c1c534-b5e3-6cb5-10af-b56dead63fc0: RW
[root@xenserver-jay ~]# xe vdi-list
params=physical-utilisation,sm-config,is-a-snapshot
uuid=1aac168d-22d2-4796-8669-48a3f4361dfc
is-a-snapshot ( RO) : false
physical-utilisation ( RO): 258466304
sm-config (MRO): vhd-blocks:
eJxjYEAB7AykARHFfZa5bgqrSNQGA4wMzK2TLphM3TBx2wqFBcwk65fZw9oswLBNjPEgQ68DCxnWCwhcUPQMZBVYOYFkzRAAAKErD5A=;
vhd-parent: 55943089-24fa-4fbe-a44e-e57fe9a080ed
[root@xenserver-jay ~]# xe vdi-list name-label=Suspend\ image params=all
uuid ( RO) : e186191b-e3a6-40d8-9086-2cbca2f2f6c5
name-label ( RW): Suspend image
name-description ( RW): Suspend image
is-a-snapshot ( RO): true
snapshot-of ( RO): <not in database>
snapshots ( RO):
snapshot-time ( RO): 20170401T09:03:24Z
allowed-operations (SRO): forget; generate_config; update; resize;
destroy; clone; copy; snapshot
current-operations (SRO):
sr-uuid ( RO): 99b84794-d0d6-46c6-fa42-07af5b423b8c
sr-name-label ( RO): d2fecabd-61cf-3458-a120-ea01a4f91c29
vbd-uuids (SRO):
crashdump-uuids (SRO):
virtual-size ( RO): 782237696
physical-utilisation ( RO): 6144
location ( RO): e186191b-e3a6-40d8-9086-2cbca2f2f6c5
type ( RO): Suspend
sharable ( RO): false
read-only ( RO): false
storage-lock ( RO): false
managed ( RO): true
parent ( RO): <not in database>
missing ( RO): false
other-config (MRW): content_id:
5dd927ff-af42-776e-5ba4-652344aaec84
xenstore-data (MRO):
sm-config (MRO): vhd-parent:
14b415ba-95bf-4fc0-b584-d6a8b0a97c6b
on-boot ( RW): persist
allow-caching ( RW): false
metadata-latest ( RO): false
metadata-of-pool ( RO): <not in database>
tags (SRW):
[root@xenserver-jay ~]# xe vdi-list
uuid=14b415ba-95bf-4fc0-b584-d6a8b0a97c6b params=all
uuid ( RO) : 14b415ba-95bf-4fc0-b584-d6a8b0a97c6b
name-label ( RW): base copy
name-description ( RW):
is-a-snapshot ( RO): false
snapshot-of ( RO): <not in database>
snapshots ( RO):
snapshot-time ( RO): 19700101T00:00:00Z
allowed-operations (SRO): forget; generate_config; update; resize;
destroy; clone; copy; snapshot
current-operations (SRO):
sr-uuid ( RO): 99b84794-d0d6-46c6-fa42-07af5b423b8c
sr-name-label ( RO): d2fecabd-61cf-3458-a120-ea01a4f91c29
vbd-uuids (SRO):
crashdump-uuids (SRO):
virtual-size ( RO): 782237696
physical-utilisation ( RO): 548430336
location ( RO): 14b415ba-95bf-4fc0-b584-d6a8b0a97c6b
type ( RO): User
sharable ( RO): false
read-only ( RO): true
storage-lock ( RO): false
managed ( RO): false
parent ( RO): <not in database>
missing ( RO): false
other-config (MRW):
xenstore-data (MRO):
sm-config (MRO): vhd-blocks: eJz7/x8/+MGAAgD69CDZ
on-boot ( RW): persist
allow-caching ( RW): false
metadata-latest ( RO): false
metadata-of-pool ( RO): <not in database>
tags (SRW):
select * from cloud.usage_event where resource_name like "i-2-120-VM%" \G
*************************** 1. row ***************************
id: 87
type: VMSNAPSHOT.CREATE
account_id: 2
created: 2017-04-01 09:04:52
zone_id: 2
resource_id: 120
resource_name: i-2-120-VM_VS_20170401090220
offering_id: NULL
template_id: 120
size: 775463895
resource_type: NULL
processed: 0
virtual_size: NULL
> VM Snapshot size with memory is not correctly calculated in cloud.usage_event
> (XenServer)
> -----------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-8939
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8939
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Affects Versions: 4.5.2
> Reporter: subhash yedugundla
>
> 1. created a VM snapshot with memory on a VM with 512 MB RAM
> list all the VBDs for the VM
> xe vbd-list vm-name-label=i-2-43-VM empty=false params=vdi-uuid
> vdi-uuid ( RO) : fbe638dd-02c5-42f5-96b2-7b3d73e68658
> Verify the size of the snapshot disk and its parent (I understand from the
> code we only check one parent in the chain)
> # xe vdi-list params=physical-utilisation,sm-config,is-a-snapshot
> uuid=fbe638dd-02c5-42f5-96b2-7b3d73e68658
> is-a-snapshot ( RO) : false
> physical-utilisation ( RO): 38124032 <-------------
> sm-config (MRO):
> host_OpaqueRef:52c1ec01-cef6-d4fd-7d81-68795a853ee0: RW; vhd-parent:
> 993e3859-8be9-414c-819b-61095ab2eff1
> parent:
> # xe vdi-list params=physical-utilisation,sm-config,is-a-snapshot
> uuid=993e3859-8be9-414c-819b-61095ab2eff1
> is-a-snapshot ( RO) : false
> physical-utilisation ( RO): 119816704 <-------------
> sm-config (MRO): vhd-blocks:
> eJxrYAAB0QcMWAELduFBDwSgNAsaHxcQARGMNHMOQfsJARFGRgkGRkWgOxmxGiWCwz5c9qLLU+o+YoGooIBUp6CgIJ2sIxnQKxzoZQ8M0Dof09s/1AMALcYD3A==;
> vhd-parent: 4b7ee66c-de53-47bb-b3d5-306d40a0ea08
> At this stage, not counting the "suspend VDI", the size looks as follows:
> 38124032 + 119816704 = 157940736 = 150.6 MB
> Now, let's calulate the "suspend VDI" size and add it to the above value:
> Note my test VM has 512 MB of RAM
> # xe vdi-list name-label=Suspend\ image params=all
> uuid ( RO) : e2ae7a47-c410-479b-9e2b-5f05c01f1b4f
> name-label ( RW): Suspend image
> name-description ( RW): Suspend image
> is-a-snapshot ( RO): true
> physical-utilisation ( RO): 6144
> <---------------------------------------
> sm-config (MRO): vhd-parent:
> c286583b-dd47-4a21-a5fe-ba2f671f1163
> Looking at the parent
> # xe vdi-list uuid=c286583b-dd47-4a21-a5fe-ba2f671f1163 params=all
> uuid ( RO) : c286583b-dd47-4a21-a5fe-ba2f671f1163
> name-label ( RW): base copy
> is-a-snapshot ( RO): false
> virtual-size ( RO): 782237696
> physical-utilisation ( RO): 252154368
> <---------------------------------------
> sm-config (MRO): vhd-blocks: eJz7/x8ZNDA0MEDAASiNyucAAHMeEPs=
>
> So the "suspend VDI" + its parent has "physical utilisation" of 6144 +
> 252154368 = 252160512 = 17.55 MB
> Now, if we add it to the previously calculated disk sizes, we'll get:
> xapi (phys util): 157940736 (non-memory snap disks)+ 252160512 (memory snap
> disks) = 410101248 = 391.1 MB
> Let's verify the size in cloud.usage_event now:
> select * from cloud.usage_event where resource_name like "i-2-43-VM%" \G
>
>
> id: 528
>
>
> type: VMSNAPSHOT.CREATE
>
>
> account_id: 2
>
>
> created: 2015-04-14 11:48:56
> zone_id: 1
> resource_id: 43
> resource_name: i-2-43-VM_VS_20150414114830
> offering_id: NULL
> template_id: 64
> size: 119863296 <-------------
> resource_type: NULL
> processed: 0
> virtual_size: NULL
> 1 row in set (0.01 sec)
> Overall, the snapshot size in cloud.usage_event != size calculated from xapi
> objects based on the code
> xapi (phys util): 157940736 (non-memory snap disks)+ 252160512 (memory snap
> disks) = 410101248 = 391.1 MB
> but:
> usage_event: 119863296 = 114.3 MB
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)