[PATCH v2 4/7] vz: don't fail query domain info in case we don't have valid stats handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
 src/vz/vz_driver.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index b1b6d14..cf4b9e8 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -600,6 +600,7 @@ static int
 vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
 {
     virDomainObjPtr dom;
+    vzDomObjPtr privdom;
     int ret = -1;
 
     if (!(dom = vzDomObjFromDomainRef(domain)))
@@ -611,13 +612,12 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
     info->nrVirtCpu = virDomainDefGetVcpus(dom->def);
     info->cpuTime = 0;
 
-    if (virDomainObjIsActive(dom)) {
+    privdom = dom->privateData;
+
+    if (PRL_INVALID_HANDLE != privdom->stats && virDomainObjIsActive(dom)) {
         unsigned long long vtime;
-        vzDomObjPtr privdom;
         size_t i;
 
-        privdom = dom->privateData;
-
         for (i = 0; i < virDomainDefGetVcpus(dom->def); ++i) {
             if (prlsdkGetVcpuStats(privdom->stats, i, &vtime) < 0) {
                 virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]