Bug 1279248

Summary: Restarting libvirtd powers off VMs started outside oVirt
Product: [oVirt] vdsm Reporter: Christopher Pereira <kripper>
Component: CoreAssignee: Dan Kenigsberg <danken>
Status: CLOSED NOTABUG QA Contact: Aharon Canan <acanan>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 4.17.11CC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-08 21:21:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christopher Pereira 2015-11-08 20:50:46 UTC
== Problem Description ==

Restarting vdsmd or libvirtd powers off VMs started outside oVirt.

QEMU logs show:

	qemu: terminating on signal 15 from pid 22346 (libvirtd)
	2015-11-04 16:07:30.121+0000: shutting down

== How reproducible ==

1) Start a VM via virsh
2) Restart vdsmd or libvirtd

== Expected results ==

VMs started outside oVirt shouldn't be powered off

== Additional info ==

VMs started inside oVirt are not powered off.
We had to start some VM outside oVirt (virsh start) because of issue #1240649.
We cannot stop those VMs because they are in production and there is currently no way to live import the VMs back into oVirt.
There are some situations were vdsmd and libvirtd are restarted (e.g. due to sanlock renewal errors) which is ok as long as external VMs are not powered off.

== Question ==

Is there any workaround to prevent oVirt shutting down this unregistered external VMs?

Comment 1 Christopher Pereira 2015-11-08 21:21:29 UTC
According to http://wiki.libvirt.org/page/FAQ:

Q: Will restarting the libvirt daemon stop my virtual machines?
A: NO, as of version 0.6.0 (Jan 2009). Versions older than this will kill VMs if the libvirtd daemon is stopped, so beware.

I did some more debugging and found out that the VMs are powered off because of the virtio-serial channel entries that were left off from the original oVirt XML dumps:

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channels/0082f61b-fc41-40fe-a254-4868ad928853.com.redhat.rhevm.vdsm'/>
      <target type='virtio' name='com.redhat.rhevm.vdsm'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channels/0082f61b-fc41-40fe-a254-4868ad928853.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

After removing this entries, libvirtd is not killing the VMs anymore.