qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks
Some guests don't expose memory blocks via sysfs at all. This shouldn't be a failure, instead just return an empty list. For other access failures we still report an error. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
8a0b5421a0
commit
f693fe6ef4
@ -2213,8 +2213,14 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
|
|||||||
|
|
||||||
dp = opendir("/sys/devices/system/memory/");
|
dp = opendir("/sys/devices/system/memory/");
|
||||||
if (!dp) {
|
if (!dp) {
|
||||||
error_setg_errno(errp, errno, "Can't open directory"
|
/* it's ok if this happens to be a system that doesn't expose
|
||||||
"\"/sys/devices/system/memory/\"\n");
|
* memory blocks via sysfs, but otherwise we should report
|
||||||
|
* an error
|
||||||
|
*/
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
error_setg_errno(errp, errno, "Can't open directory"
|
||||||
|
"\"/sys/devices/system/memory/\"\n");
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user