[et-mgmt-tools] [PATCH] readOnly flags for virConnectOpenAuth

Saori Fukuta fukuta.saori at jp.fujitsu.com
Wed Feb 20 08:02:56 UTC 2008


Hello,

I cannot connect to localhost Xen with non-root user. The virt-manager
says the following message,
  Unable to open connection to hypervisor URI 'xen:///':
  <class 'libvirt.libvirtError'> virConnectOpenAuth() failed
  Traceback (most recent call last):
    File "/usr/share/virt-manager/virtManager/connection.py", line 414, in _open_thread 
      None], flags)
    File "/usr/lib/python2.5/site-packages/libvirt.py", line 94, in openAuth
      if ret is None:raise libvirtError('virConnectOpenAuth() failed')
  libvirtError: virConnectOpenAuth() failed

I guess this problem occurs from Cset:680
http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=1892867ca5c7

Before that Cset, connection was able to succeed since the virt-manager
tried to connect with libvirt.openReadOnly after failed to libvirt.open,
even if 'self.readOnly' was None.
After that Cset, 'flags' for libvirt.openAuth depend on 'self.readOnly'
though 'self.readOnly' is never set.

I'm not sure where the readOnly flags should be set, but how about
this fix for readOnly flags ?
---
diff -r 07ff9bffe54d src/virtManager/connection.py
--- a/src/virtManager/connection.py     Mon Feb 18 10:02:21 2008 -0500
+++ b/src/virtManager/connection.py     Wed Feb 20 17:00:41 2008 +0900
@@ -403,8 +403,9 @@ class vmmConnection(gobject.GObject):
         logging.debug("Background thread is running")
         try:
             flags = 0
-            if self.readOnly:
+            if os.getuid() != 0:
                 flags = libvirt.VIR_CONNECT_RO
+                self.readOnly = True

             self.vmm = libvirt.openAuth(self.uri,
                                         [[libvirt.VIR_CRED_AUTHNAME,

Regards,
Saori Fukuta




More information about the et-mgmt-tools mailing list