Skip to content

[Bug] "Get guests stats" API call returns 10000 for the maximum number of CPUs instead of the real number #922

@Bischoff

Description

@Bischoff

How to reproduce

Call GET /guests/stats?userid=<guest> where <guest> is the name of one of the guest VMs.

What happens

The returned value contains:

            "max_cpu_limit": 10000,

while the maximum number of CPUs is supposed to be no greater than 64.

What should happen

This call should return the maximum number of CPUs as defined at time of creation of guest.

This number can be seen in the directory entry for the guest:

   MACHINE ESA 32

First debugging

The issue can be reproduced from the command line:

# smcli System_Image_Performance_Query --addRCheader -T TEST 
...
Minimum CPU count: "2" 
Max CPU limit: "10000" 
Processor share: "200" 
....

This values are extracted from the structure defined in zthin-parts/zthin/include/vmapiSystem.h

* System_Image_Performance_Query */
typedef struct _vmApiSystemImagePerformanceRecord {
    unsigned int        recordVersion;
    unsigned int        guestFlags;
    unsigned long long  usedCPUTime;
    unsigned long long  elapsedTime;
    unsigned long long  minMemory;
    unsigned long long  maxMemory;
    unsigned long long  sharedMemory;
    unsigned long long  usedMemory;
    unsigned int        activeCPUsInCEC;
    unsigned int        logicalCPUsInVM;
    unsigned int        guestCPUs;
    unsigned int        minCPUCount;
    unsigned int        maxCPULimit;
    unsigned int        processorShare;
    unsigned int        samplesCPUInUse;
    unsigned int        samplesCPUDelay;
    unsigned int        samplesPageWait;
    unsigned int        samplesIdle;
    unsigned int        samplesOther;
    unsigned int        samplesTotal;
    char*               guestName;
} vmApiSystemImagePerformanceRecord;

The problem is obviously that we read field processorShare (10000) instead of field maxCPULimit (32). We are off by one field.

How to fix

Find the correct documentation for System Image Performance Record data structure.

Implement it in this header file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions