Просмотр исходного кода

实现计算节点CPU型号透传

James Iter 8 лет назад
Родитель
Сommit
f8da6baee7
2 измененных файлов с 9 добавлено и 4 удалено
  1. 2 2
      docs/todo.md
  2. 7 2
      models/guest_xml.py

+ 2 - 2
docs/todo.md

@@ -48,5 +48,5 @@
 - [ ] 前端页面校验字段有效值
 - [x] 加入手动清除已经离线的宿主机功能
 - [x] 显示计算节点离线时间
-- [ ] 系统模板加入是否为Windows类系统的标记
-- [ ] 系统模板为 Windows 时,时钟偏移值设定为 localtime,否则为 utc
+- [x] 系统模板加入是否为Windows类系统的标记
+- [x] 系统模板为 Windows 时,时钟偏移值设定为 localtime,否则为 utc

+ 7 - 2
models/guest_xml.py

@@ -36,9 +36,10 @@ class GuestXML(object):
             {5}
             {6}
             {7}
+            {8}
             </domain>
-        """.format(self.get_features(), self.get_clock(), self.get_name(), self.get_uuid(), self.get_vcpu(),
-                   self.get_memory(), self.get_os(), self.get_devices())
+        """.format(self.get_features(), self.get_cpu_mode(), self.get_clock(), self.get_name(), self.get_uuid(),
+                   self.get_vcpu(), self.get_memory(), self.get_os(), self.get_devices())
 
     @staticmethod
     def get_features():
@@ -49,6 +50,10 @@ class GuestXML(object):
             </features>
         """
 
+    @staticmethod
+    def get_cpu_mode():
+        return """<cpu mode='host-passthrough'/>"""
+
     def get_clock(self):
         # clock 参考链接:https://libvirt.org/formatdomain.html#elementsTime
         # Windows Guest 设为 localtime,非 Windows Guest 都设为 utc