Add 'has_videocard' libvirt node attribute
- if 'has_videocard' == True, add <video> device to the libvirt node. Default: True Allows to disable videocard for libvirt VMs if necessary Change-Id: I7a14557016526b6fd1a49b8ef05fb7d111800503
This commit is contained in:
parent
c39a2a996b
commit
0bd5ce25be
|
@ -1081,6 +1081,7 @@ class LibvirtNode(node.Node):
|
|||
vcpu = base.ParamField(default=1)
|
||||
memory = base.ParamField(default=1024)
|
||||
has_vnc = base.ParamField(default=True)
|
||||
has_videocard = base.ParamField(default=True)
|
||||
bootmenu_timeout = base.ParamField(default=0)
|
||||
numa = base.ParamField(default=[])
|
||||
cloud_init_volume_name = base.ParamField()
|
||||
|
@ -1221,6 +1222,7 @@ class LibvirtNode(node.Node):
|
|||
bootmenu_timeout=self.bootmenu_timeout,
|
||||
emulator=emulator,
|
||||
has_vnc=self.has_vnc,
|
||||
has_videocard=self.has_videocard,
|
||||
vnc_password=self.driver.vnc_password,
|
||||
local_disk_devices=local_disk_devices,
|
||||
interfaces=local_interfaces,
|
||||
|
|
|
@ -240,8 +240,8 @@ class LibvirtXMLBuilder(object):
|
|||
def build_node_xml(cls, name, hypervisor, use_host_cpu, vcpu, memory,
|
||||
use_hugepages, hpet, os_type, architecture, boot,
|
||||
reboot_timeout, bootmenu_timeout, emulator,
|
||||
has_vnc, vnc_password, local_disk_devices, interfaces,
|
||||
acpi, numa):
|
||||
has_vnc, has_videocard, vnc_password,
|
||||
local_disk_devices, interfaces, acpi, numa):
|
||||
"""Generate node XML
|
||||
|
||||
:rtype : String
|
||||
|
@ -323,8 +323,9 @@ class LibvirtXMLBuilder(object):
|
|||
cls._build_disk_device(node_xml, **disk_device)
|
||||
for interface in interfaces:
|
||||
cls._build_interface_device(node_xml, **interface)
|
||||
with node_xml.video:
|
||||
node_xml.model(type='vga', vram='9216', heads='1')
|
||||
if has_videocard:
|
||||
with node_xml.video:
|
||||
node_xml.model(type='vga', vram='9216', heads='1')
|
||||
with node_xml.serial(type='pty'):
|
||||
node_xml.target(port='0')
|
||||
with node_xml.console(type='pty'):
|
||||
|
|
|
@ -378,6 +378,7 @@ class TestNodeXml(BaseTestXMLBuilder):
|
|||
bootmenu_timeout=0,
|
||||
emulator='/usr/lib64/xen/bin/qemu-dm',
|
||||
has_vnc=True,
|
||||
has_videocard=True,
|
||||
vnc_password='123456',
|
||||
local_disk_devices=[],
|
||||
interfaces=[],
|
||||
|
@ -442,6 +443,7 @@ class TestNodeXml(BaseTestXMLBuilder):
|
|||
bootmenu_timeout=3000,
|
||||
emulator='/usr/lib64/xen/bin/qemu-dm',
|
||||
has_vnc=True,
|
||||
has_videocard=False,
|
||||
vnc_password=None,
|
||||
local_disk_devices=self.disk_devices,
|
||||
interfaces=self.interfaces,
|
||||
|
@ -508,9 +510,6 @@ class TestNodeXml(BaseTestXMLBuilder):
|
|||
<model type="pcnet"/>
|
||||
<filterref filter="test_filter2"/>
|
||||
</interface>
|
||||
<video>
|
||||
<model heads="1" type="vga" vram="9216"/>
|
||||
</video>
|
||||
<serial type="pty">
|
||||
<target port="0"/>
|
||||
</serial>
|
||||
|
@ -537,6 +536,7 @@ class TestNodeXml(BaseTestXMLBuilder):
|
|||
bootmenu_timeout=3000,
|
||||
emulator='/usr/lib64/xen/bin/qemu-dm',
|
||||
has_vnc=True,
|
||||
has_videocard=True,
|
||||
vnc_password=None,
|
||||
local_disk_devices=[],
|
||||
interfaces=[],
|
||||
|
|
Loading…
Reference in New Issue