libvirt: Extract method _guest_add_spice_channel

Closes-Bug: #1494374
Change-Id: I0a8b577a060dc90170403f7ad9bdb89e09cb9fa3
Signed-off-by: Maciej Kucia <maciej@kucia.net>
This commit is contained in:
Maciej Kucia 2017-06-05 00:04:24 +02:00
parent 931503a0d9
commit 0db199b853
1 changed files with 10 additions and 6 deletions

View File

@ -4798,12 +4798,7 @@ class LibvirtDriver(driver.ComputeDriver):
if pointer:
guest.add_device(pointer)
if (CONF.spice.enabled and CONF.spice.agent_enabled and
virt_type not in ('lxc', 'uml', 'xen')):
channel = vconfig.LibvirtConfigGuestChannel()
channel.type = 'spicevmc'
channel.target_name = "com.redhat.spice.0"
guest.add_device(channel)
self._guest_add_spice_channel(guest)
if self._guest_add_video_device(guest):
self._add_video_driver(guest, image_meta, flavor)
@ -4820,6 +4815,15 @@ class LibvirtDriver(driver.ComputeDriver):
return guest
@staticmethod
def _guest_add_spice_channel(guest):
if (CONF.spice.enabled and CONF.spice.agent_enabled
and guest.virt_type not in ('lxc', 'uml', 'xen')):
channel = vconfig.LibvirtConfigGuestChannel()
channel.type = 'spicevmc'
channel.target_name = "com.redhat.spice.0"
guest.add_device(channel)
@staticmethod
def _guest_add_memory_balloon(guest):
virt_type = guest.virt_type