virt-manager/virtman-detach-yast.diff

51 lines
2.1 KiB
Diff

Index: virt-manager--devel/src/virt-manager.py.in
===================================================================
--- virt-manager--devel.orig/src/virt-manager.py.in
+++ virt-manager--devel/src/virt-manager.py.in
@@ -188,6 +188,8 @@ def main():
optParser = OptionParser()
optParser.add_option("--profile", dest="profile", help="Generate runtime performance profile stats", metavar="FILE")
optParser.set_defaults(uuid=None)
+ optParser.add_option("-y", "--yast", dest="fork", action="store_true",
+ help="Allow yast parent to exit")
optParser.add_option("-c", "--connect", dest="uri",
help="Connect to hypervisor at URI", metavar="URI")
optParser.add_option("--no-dbus", action="store_true", dest="nodbus",
@@ -239,6 +241,23 @@ def main():
logging.warning("Could not connection to session bus, disabling DBus service " + \
str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
+ if options.fork:
+ # Don't have to completely daemonize; just fork off and close
+ # stdin/stdout/stderr to let yast parent die happily.
+ pid = os.fork()
+ if pid == 0:
+ for fd in (0, 1, 2):
+ try:
+ os.close(fd)
+ except:
+ continue
+ os.open('/dev/null', os.O_RDWR)
+ if os.fork():
+ os._exit(0)
+ else:
+ os.waitpid(pid, 0)
+ os._exit(0)
+
# Finally start the app for real
show_engine(engine, options.show, options.uri, options.uuid)
if options.profile != None:
Index: virt-manager--devel/src/virtManager/engine.py
===================================================================
--- virt-manager--devel.orig/src/virtManager/engine.py
+++ virt-manager--devel/src/virtManager/engine.py
@@ -285,7 +285,7 @@ class vmmEngine:
return self.connections[uri]["windowDetails"][uuid]
def show_manager(self, uri):
- con = self.get_connection(uri)
+ con = self.get_connection(uri, False)
if self.connections[uri]["windowManager"] == None:
manager = vmmManager(self.get_config(),