[PATCH v2 2/3] cpu: add helper function to reset cpu related variables to none

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

 



The helper function aims to reset cpu related vars to none except
<topology>.
It is named with clear_attrs(). clear() could be saved for later use
of clearing all of them including <topology>.
---
 virtinst/CPU.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/virtinst/CPU.py b/virtinst/CPU.py
index b3d451d..092bc65 100644
--- a/virtinst/CPU.py
+++ b/virtinst/CPU.py
@@ -187,6 +187,15 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
                             get_converter=lambda s, x: _int_or_none(x),
                             xpath="./cpu/topology/@threads")
 
+    def clear_attrs(self):
+        self.match = None
+        self.mode = None
+        self.vendor = None
+        self.model = None
+
+        for feature in self.features:
+            self.remove_feature(feature)
+
     def copy_host_cpu(self):
         """
         Enact the equivalent of qemu -cpu host, pulling all info
-- 
1.7.11.2

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux