With LXC domain, the 'current' attribute of 'vcpu' element is not
always present, but the code is still depending on it.

Signed-off-by: Martin Kletzander <[email protected]>
---

Notes:
    TBH, I haven;t gone through all the code to realize what _exactly_
    'self._startup_vcpus' means, but this is my best guess.

 virtManager/domain.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 4ff156e..d099176 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1036,7 +1036,10 @@ class vmmDomain(vmmLibvirtObject):
         return int(self.get_xmlobj().maxmemory)

     def vcpu_count(self):
-        return int(self.get_xmlobj().curvcpus)
+        guest = self.get_xmlobj()
+        return int(guest.curvcpus or
+                   self._startup_vcpus or
+                   guest.vcpus)
     def vcpu_max_count(self):
         guest = self.get_xmlobj()
         has_xml_max = (guest.curvcpus != guest.vcpus)
-- 
1.8.4

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to