[elbe-devel] [PATCH 7/7] initvmaction: use systemwide libvirt instance
Torben Hohn
torben.hohn at linutronix.de
Fri Apr 13 14:43:16 CEST 2018
this change allows several users to share the initvm, because using
the same filesystem image with more than one user results in hard
to debug deadlocking problems with domain start and creation.
due to soap tcp port conflicts, we can have a single initvm per host,
anyways, so we move it to the system libvirt.
requires that user is member of group "libvirt".
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/initvmaction.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index b9fcdeb6..05ebf877 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -81,7 +81,7 @@ class InitVMAction(object):
def __init__(self, node, initvmNeeded=True):
# The tag initvmNeeded is required in order to be able to run `elbe
# initvm create`
- self.conn = libvirt.open("qemu:///session")
+ self.conn = libvirt.open("qemu:///system")
try:
self.initvm = self.conn.lookupByName(cfg['initvm_domain'])
except libvirt.libvirtError:
@@ -180,7 +180,7 @@ class AttachAction(InitVMAction):
sys.exit(20)
print('Attaching to initvm console.')
- system('virsh console %s' % cfg['initvm_domain'])
+ system('virsh --connect qemu:///system console %s' % cfg['initvm_domain'])
InitVMAction.register(AttachAction)
@@ -227,12 +227,12 @@ class CreateAction(InitVMAction):
print("If you want to build in your old initvm, "
"use `elbe initvm submit <xml>`.")
print("If you want to remove your old initvm from libvirt "
- "run `virsh undefine %s`.\n" % cfg['initvm_domain'])
+ "run `virsh --connect qemu:///system undefine %s`.\n" % cfg['initvm_domain'])
print("Note:")
print("\t1) You can reimport your old initvm via "
- "`virsh define <file>`")
+ "`virsh --connect qemu:///system define <file>`")
print("\t where <file> is the corresponding libvirt.xml")
- print("\t2) virsh undefine does not delete the image "
+ print("\t2) virsh --connect qemu:///system undefine does not delete the image "
"of your old initvm.")
sys.exit(20)
@@ -341,7 +341,7 @@ class CreateAction(InitVMAction):
self.conn.defineXML(xml)
except CommandError:
print('Registering initvm in libvirt failed', file=sys.stderr)
- print('Try `virsh undefine %s` to delete existing initvm' % cfg['initvm_domain'],
+ print('Try `virsh --connect qemu:///system undefine %s` to delete existing initvm' % cfg['initvm_domain'],
file=sys.stderr)
sys.exit(20)
--
2.11.0
More information about the elbe-devel
mailing list