204
204
return optParser.parse_args()
208
if os.path.exists("/var/lib/xend") and os.path.exists("/proc/xen"):
210
elif (os.path.exists("/usr/bin/qemu") or
211
os.path.exists("/usr/bin/qemu-kvm") or
212
os.path.exists("/usr/bin/kvm")):
213
tryuri = "qemu:///system"
217
206
def launch_specific_window(engine, show, uri, uuid):
218
207
if not engine.wait_for_open(uri):
219
208
# Connection failed, don't attempt to continue
238
227
args=(engine, show, uri, uuid),
239
228
name="Launching '%s' window" % show)
241
231
elif show=='summary' or uri:
242
232
engine.connect_to_uri(uri)
244
if engine.config.get_connections() is None \
245
or len(engine.config.get_connections()) == 0:
247
tryuri = default_uri()
248
if tryuri is not None:
249
engine.add_connection(tryuri, autoconnect=True)
250
234
engine.show_manager()
252
236
if not no_conn_auto:
356
340
from virtManager.engine import vmmEngine
357
341
from virtManager.remote import vmmRemote
359
gtk.window_set_default_icon_from_file(icon_dir + "/" + appname + "-icon.svg")
343
gtk.window_set_default_icon_from_file(icon_dir + "/" +
344
appname + "-icon.svg")
361
346
if options.show and options.uri==None:
362
347
raise OptionValueError("can't use --show-* options without --connect")
364
349
engine = vmmEngine(config)
366
if not(options.nodbus) and not( (os.getenv("DBUS_SESSION_BUS_ADDRESS") is None ) and ( os.getenv("DBUS_STARTER_ADDRESS") is None ) ):
351
if (not (options.nodbus) and
352
not ((os.getenv("DBUS_SESSION_BUS_ADDRESS") is None) and
353
(os.getenv("DBUS_STARTER_ADDRESS") is None))):
369
357
if os.getenv("DBUS_STARTER_ADDRESS") is None:
372
360
bus = dbus.StarterBus()
374
dbusProxy = bus.get_object("org.freedesktop.DBus", "/org/freedesktop/DBus")
362
dbusProxy = bus.get_object("org.freedesktop.DBus",
363
"/org/freedesktop/DBus")
375
364
dbusObj = dbus.Interface(dbusProxy, "org.freedesktop.DBus")
377
366
if dbusObj.NameHasOwner("com.redhat.virt.manager"):
378
367
# We're already running, so just talk to existing process
379
managerProxy = bus.get_object("com.redhat.virt.manager", "/com/redhat/virt/manager")
380
managerObj = dbus.Interface(managerProxy, "com.redhat.virt.manager")
382
show_remote(managerObj, options.show, options.uri, options.uuid)
369
managerProxy = bus.get_object("com.redhat.virt.manager",
370
"/com/redhat/virt/manager")
371
managerObj = dbus.Interface(managerProxy,
372
"com.redhat.virt.manager")
374
show_remote(managerObj, options.show,
375
options.uri, options.uuid)
384
377
# yes, we exit completely now - remote service is in charge
378
logging.debug("Connected to already running instance.")
387
382
# Grab the service to allow others to talk to us later
388
383
name = dbus.service.BusName("com.redhat.virt.manager", bus=bus)
389
384
vmmRemote(engine, name)
391
387
# Something went wrong doing dbus setup, just ignore & carry on
392
logging.warning("Could not get connection to session bus, disabling DBus service " + \
393
str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
388
logging.warning("Could not get connection to session bus, "
389
"disabling DBus service " +
390
str(sys.exc_info()[0]) + " " +
391
str(sys.exc_info()[1]))
395
393
# At this point we're either starting a brand new controlling instance,
396
394
# or the dbus comms to existing instance has failed