[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[libvirt] Enable authentication for all virConnectOpen calls in virsh
- From: Matthias Bolte <matthias bolte googlemail com>
- To: libvir-list redhat com
- Subject: [libvirt] Enable authentication for all virConnectOpen calls in virsh
- Date: Sat, 21 Mar 2009 14:52:50 +0100
Hello,
virsh opens connections in three places (init, connect, migrate) but
only connections initiated from the command line (the -c option) are
opened with authentication.
The attached patch enables the two other places to use authentication too.
Ciao
Matthias
diff --git a/src/virsh.c b/src/virsh.c
index 9a7b0ed..abbd93b 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -468,13 +468,14 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
ctl->name = vshStrdup(ctl, vshCommandOptString(cmd, "name", NULL));
if (!ro) {
- ctl->conn = virConnectOpen(ctl->name);
ctl->readonly = 0;
} else {
- ctl->conn = virConnectOpenReadOnly(ctl->name);
ctl->readonly = 1;
}
+ ctl->conn = virConnectOpenAuth(ctl->name, virConnectAuthPtrDefault,
+ ctl->readonly ? VIR_CONNECT_RO : 0);
+
if (!ctl->conn)
vshError(ctl, FALSE, "%s", _("Failed to connect to the hypervisor"));
@@ -2315,7 +2316,7 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
flags |= VIR_MIGRATE_LIVE;
/* Temporarily connect to the destination host. */
- dconn = virConnectOpen (desturi);
+ dconn = virConnectOpenAuth (desturi, virConnectAuthPtrDefault, 0);
if (!dconn) goto done;
/* Migrate. */
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]