mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Thu Sep 20 18:10:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/qemu_driver.c, docs/libvir.html: Support virConnectGetHostname and virConnectGetURI for qemu driver.
This commit is contained in:
parent
415015506f
commit
9a79baba76
@ -1,3 +1,8 @@
|
||||
Thu Sep 20 18:10:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
* src/qemu_driver.c, docs/libvir.html: Support virConnectGetHostname
|
||||
and virConnectGetURI for qemu driver.
|
||||
|
||||
Thu Sep 20 13:02:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
* src/libvirt.c: Don't try to generate an error message with
|
||||
|
@ -27,8 +27,8 @@ updated on <i>2007-08-20</i>.
|
||||
</tr><tr><td> virConnectGetHostname </td>
|
||||
<td> 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> ≥ 0.3.3 </td>
|
||||
<td> ≥ 0.3.3 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
</tr><tr><td> virConnectGetMaxVcpus </td>
|
||||
<td> 0.2.1 </td>
|
||||
@ -45,8 +45,8 @@ updated on <i>2007-08-20</i>.
|
||||
</tr><tr><td> virConnectGetURI </td>
|
||||
<td> 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
</tr><tr><td> virConnectGetVersion </td>
|
||||
<td> All </td>
|
||||
|
@ -2785,8 +2785,8 @@ updated on <i>2007-08-20</i>.
|
||||
<td> virConnectGetHostname </td>
|
||||
<td> 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> ≥ 0.3.3 </td>
|
||||
<td> ≥ 0.3.3 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -2809,8 +2809,8 @@ updated on <i>2007-08-20</i>.
|
||||
<td> virConnectGetURI </td>
|
||||
<td> 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
<td> ≥ 0.3.0 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1369,12 +1369,12 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
|
||||
if (qemu_driver == NULL)
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
if (uid) {
|
||||
if (strcmp(name, "qemu:///session"))
|
||||
if (uid != 0) {
|
||||
if (STRNEQ (name, "qemu:///session"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
} else {
|
||||
if (strcmp(name, "qemu:///system") &&
|
||||
strcmp(name, "qemu:///session"))
|
||||
} else { /* root */
|
||||
if (STRNEQ (name, "qemu:///system") &&
|
||||
STRNEQ (name, "qemu:///session"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
}
|
||||
|
||||
@ -1698,6 +1698,28 @@ static int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
qemudGetHostname (virConnectPtr conn)
|
||||
{
|
||||
int r;
|
||||
char hostname[HOST_NAME_MAX+1], *str;
|
||||
|
||||
r = gethostname (hostname, HOST_NAME_MAX+1);
|
||||
if (r == -1) {
|
||||
qemudReportError (conn, NULL, NULL, VIR_ERR_SYSTEM_ERROR,
|
||||
"%s", strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
/* Caller frees this string. */
|
||||
str = strdup (hostname);
|
||||
if (str == NULL) {
|
||||
qemudReportError (conn, NULL, NULL, VIR_ERR_SYSTEM_ERROR,
|
||||
"%s", strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static int qemudListDomains(virConnectPtr conn, int *ids, int nids) {
|
||||
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
||||
struct qemud_vm *vm = driver->vms;
|
||||
@ -2621,8 +2643,8 @@ static virDriver qemuDriver = {
|
||||
NULL, /* supports_feature */
|
||||
qemudGetType, /* type */
|
||||
qemudGetVersion, /* version */
|
||||
NULL, /* hostname */
|
||||
NULL, /* uri */
|
||||
qemudGetHostname, /* hostname */
|
||||
NULL, /* URI - never called because remote_internal.c answers this */
|
||||
qemudGetMaxVCPUs, /* getMaxVcpus */
|
||||
qemudGetNodeInfo, /* nodeGetInfo */
|
||||
qemudGetCapabilities, /* getCapabilities */
|
||||
|
@ -693,9 +693,9 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
||||
rflags |= VIR_DRV_OPEN_REMOTE_RO;
|
||||
|
||||
if (uri_str) {
|
||||
if (!strcmp(uri_str, "qemu:///system")) {
|
||||
if (STREQ (uri_str, "qemu:///system")) {
|
||||
rflags |= VIR_DRV_OPEN_REMOTE_UNIX;
|
||||
} else if (!strcmp(uri_str, "qemu:///session")) {
|
||||
} else if (STREQ (uri_str, "qemu:///session")) {
|
||||
rflags |= VIR_DRV_OPEN_REMOTE_UNIX;
|
||||
if (getuid() > 0) {
|
||||
rflags |= VIR_DRV_OPEN_REMOTE_USER;
|
||||
|
Loading…
x
Reference in New Issue
Block a user