diff options
author | Michael Marineau <marineam@gentoo.org> | 2008-12-02 03:38:10 +0000 |
---|---|---|
committer | Michael Marineau <marineam@gentoo.org> | 2008-12-02 03:38:10 +0000 |
commit | 851bda415c5397f18f6c6197972ba9a9bf1adeb2 (patch) | |
tree | bb2754bbac136ab652f39dc1211c8d99f13bc5fb /app-emulation/virt-manager/files | |
parent | Stable for HPPA too. (diff) | |
download | historical-851bda415c5397f18f6c6197972ba9a9bf1adeb2.tar.gz historical-851bda415c5397f18f6c6197972ba9a9bf1adeb2.tar.bz2 historical-851bda415c5397f18f6c6197972ba9a9bf1adeb2.zip |
Allow user access without policykit
Package-Manager: portage-2.1.4.5
Diffstat (limited to 'app-emulation/virt-manager/files')
-rw-r--r-- | app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch b/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch new file mode 100644 index 000000000000..f270810dd27a --- /dev/null +++ b/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch @@ -0,0 +1,77 @@ +--- virt-manager-0.6.0/src/virtManager/connection.py.orig 2008-09-10 15:37:12.000000000 -0400 ++++ virt-manager-0.6.0/src/virtManager/connection.py 2008-12-01 22:33:34.000000000 -0500 +@@ -38,11 +38,6 @@ + from virtManager.netdev import vmmNetDevice + from virtManager.storagepool import vmmStoragePool + +-LIBVIRT_POLICY_FILES = [ +- "/usr/share/PolicyKit/policy/libvirtd.policy", +- "/usr/share/PolicyKit/policy/org.libvirt.unix.policy" +-] +- + def get_local_hostname(): + try: + (host, aliases, ipaddrs) = gethostbyaddr(gethostname()) +@@ -139,15 +134,6 @@ + self.uri = "xen:///" + + self.readOnly = readOnly +- if not self.is_remote() and os.getuid() != 0 and self.uri != "qemu:///session": +- hasPolkit = False +- for f in LIBVIRT_POLICY_FILES: +- if os.path.exists(f): +- hasPolkit = True +- +- if not hasPolkit: +- self.readOnly = True +- + self.state = self.STATE_DISCONNECTED + self.vmm = None + self.storage_capable = None +@@ -464,8 +450,7 @@ + logging.error(self.connectError) + return -1 + +- def _open_thread(self): +- logging.debug("Background thread is running") ++ def _try_open(self): + try: + flags = 0 + if self.readOnly: +@@ -478,12 +463,34 @@ + libvirt.VIR_CRED_EXTERNAL], + self._do_creds, + None], flags) ++ except: ++ exc_info = sys.exc_info() ++ ++ # If the previous attempt was read/write try to fall back ++ # on read-only connection, otherwise report the error. ++ if not self.readOnly: ++ try: ++ self.vmm = libvirt.openReadOnly(self.uri) ++ self.readOnly = True ++ logging.info("Read/write connection failed to %s," ++ "falling back on read-only." % self.uri) ++ return ++ except: ++ pass ++ ++ return exc_info + ++ def _open_thread(self): ++ logging.debug("Background thread is running") ++ ++ open_error = self._try_open() ++ ++ if not open_error: + self.state = self.STATE_ACTIVE +- except: ++ else: + self.state = self.STATE_DISCONNECTED + +- (type, value, stacktrace) = sys.exc_info () ++ (type, value, stacktrace) = open_error + # Detailed error message, in English so it can be Googled. + self.connectError = \ + ("Unable to open connection to hypervisor URI '%s':\n" % |