The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8175

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #8173

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From a422fb7306b1bafb71d5d543de32755b77e8b33b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Sat, 21 Nov 2020 22:49:14 -0500
Subject: [PATCH] lxd/instance/qemu: Always render disk
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #8173

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/instance/drivers/driver_qemu.go | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/lxd/instance/drivers/driver_qemu.go 
b/lxd/instance/drivers/driver_qemu.go
index 3b619f4789..7dabdbf371 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -4364,12 +4364,15 @@ func (vm *qemu) RenderFull() (*api.InstanceFull, 
interface{}, error) {
 
 // RenderState returns just state info about the instance.
 func (vm *qemu) RenderState() (*api.InstanceState, error) {
+       var err error
+
+       status := &api.InstanceState{}
        statusCode := vm.statusCode()
        pid, _ := vm.pid()
 
        if statusCode == api.Running {
                // Try and get state info from agent.
-               status, err := vm.agentGetState()
+               status, err = vm.agentGetState()
                if err != nil {
                        if err != errQemuAgentOffline {
                                logger.Warn("Could not get VM state from 
agent", log.Ctx{"project": vm.Project(), "instance": vm.Name(), "err": err})
@@ -4433,25 +4436,17 @@ func (vm *qemu) RenderState() (*api.InstanceState, 
error) {
                                }
                        }
                }
+       }
 
-               status.Pid = int64(pid)
-               status.Status = statusCode.String()
-               status.StatusCode = statusCode
-               status.Disk, err = vm.diskState()
-               if err != nil && err != storageDrivers.ErrNotSupported {
-                       logger.Warn("Error getting disk usage", 
log.Ctx{"project": vm.Project(), "instance": vm.Name(), "err": err})
-               }
-
-               return status, nil
+       status.Pid = int64(pid)
+       status.Status = statusCode.String()
+       status.StatusCode = statusCode
+       status.Disk, err = vm.diskState()
+       if err != nil && err != storageDrivers.ErrNotSupported {
+               logger.Warn("Error getting disk usage", log.Ctx{"project": 
vm.Project(), "instance": vm.Name(), "err": err})
        }
 
-       // At least return the Status and StatusCode if we couldn't get any
-       // information for the VM agent.
-       return &api.InstanceState{
-               Pid:        int64(pid),
-               Status:     statusCode.String(),
-               StatusCode: statusCode,
-       }, nil
+       return status, nil
 }
 
 // diskState gets disk usage info.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to