You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/10/06 18:18:27 UTC

[jira] [Commented] (CLOUDSTACK-8939) VM Snapshot size with memory is not correctly calculated in cloud.usage_event (XenServer)

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-8939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14945287#comment-14945287 ] 

ASF GitHub Bot commented on CLOUDSTACK-8939:
--------------------------------------------

GitHub user yvsubhash opened a pull request:

    https://github.com/apache/cloudstack/pull/914

    BUG-ID CLOUDSTACK-8939

    Fixing the error  with snapshot size calculation  in a vm with memory

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/yvsubhash/cloudstack CLOUDSTACK-8939

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/914.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #914
    
----
commit 5fecae08d167727437b82c92e26a550ef29bd0b2
Author: subhash yedugundla <ve...@citrix.com>
Date:   2015-10-06T13:58:13Z

    BUG-ID CLOUDSTACK-8939
    Fixing the error  with snapshot size calculation  in a vm with memory

----


> 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.4#6332)