cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-8939) VM Snapshot size with memory is not correctly calculated in cloud.usage_event (XenServer)
Date Thu, 13 Apr 2017 12:26:42 GMT

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

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

Github user sudhansu7 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/914#discussion_r111375928
  
    --- Diff: plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
---
    @@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection conn, final
VolumeObjectTO v
                 }
             }
             if (volumeTo.getVolumeType() == Volume.Type.ROOT) {
    -            final Map<VM, VM.Record> allVMs = VM.getAllRecords(conn);
    -            // add size of memory snapshot vdi
    -            if (allVMs != null && allVMs.size() > 0) {
    -                for (final VM vmr : allVMs.keySet()) {
    -                    try {
    -                        final String vName = vmr.getNameLabel(conn);
    -                        if (vName != null && vName.contains(vmName) &&
vmr.getIsASnapshot(conn)) {
    -                            final VDI memoryVDI = vmr.getSuspendVDI(conn);
    -                            if (!isRefNull(memoryVDI)) {
    -                                size = size + memoryVDI.getPhysicalUtilisation(conn);
    -                                final VDI pMemoryVDI = memoryVDI.getParent(conn);
    -                                if (!isRefNull(pMemoryVDI)) {
    -                                    size = size + pMemoryVDI.getPhysicalUtilisation(conn);
    +            VM vm = getVM(conn, vmName);
    --- End diff --
    
    LGTM for code change


> 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)

Mime
View raw message