From 570a79c1beb3b49293b667900401728316ebdf81 Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Thu, 15 Sep 2016 15:42:32 +0100 Subject: [PATCH] ciao-launcher: Ceph rootfs consumes 0 MB Ensure that we report the correct statistics for VM instances whose rootfs are stored in a ceph cluster. Signed-off-by: Mark Ryan --- ciao-launcher/qemu.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ciao-launcher/qemu.go b/ciao-launcher/qemu.go index 986a578c0..0480ad4c2 100644 --- a/ciao-launcher/qemu.go +++ b/ciao-launcher/qemu.go @@ -654,7 +654,10 @@ func (q *qemuV) monitorVM(closedCh chan struct{}, connectedCh chan struct{}, return qmpChannel } -func computeInstanceDiskspace(instanceDir string) int { +func (q *qemuV) computeInstanceDiskspace(instanceDir string) int { + if q.cfg.Image == "" { + return 0 + } vmImage := path.Join(instanceDir, "image.qcow2") fi, err := os.Stat(vmImage) if err != nil { @@ -664,7 +667,7 @@ func computeInstanceDiskspace(instanceDir string) int { } func (q *qemuV) stats() (disk, memory, cpu int) { - disk = computeInstanceDiskspace(q.instanceDir) + disk = q.computeInstanceDiskspace(q.instanceDir) memory = -1 cpu = -1