[libvirt] [PATCH] storage_backend_fs.c: do not ignore probe failure
by Jim Meyering
When virStorageBackendProbeTarget fails, it returns -1 or -2.
The two uses below obviously intended to handle those cases
differently, but due to a wrong comparison, they always treated a
"real" (e.g., open) failure (-1) just like an ignorable "wrong file type"
failure (-2).
FYI, coverity reported that the "goto cleanup" statement was
unreachable, which was true in each case, but hardly the real problem.
>From c9ba79daf124afbab351741192bbaf7110a199dd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 10:34:53 +0100
Subject: [PATCH] storage_backend_fs.c: do not ignore probe failure
* src/storage/storage_backend_fs.c (virStorageBackendFileSystemRefresh):
Correct two error-handling bugs. The documented intent is to ignore
non-regular files, yet due to a comparison "< 0" (rather than "!= 0")
all errors were handled that way.
(vboxStorageVolDelete): Likewise.
(vboxDomainDefineXML): Likewise.
---
src/storage/storage_backend_fs.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 4fe40b3..fa72f9c 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1,7 +1,7 @@
/*
* storage_backend_fs.c: storage backend for FS and directory handling
*
- * Copyright (C) 2007-2009 Red Hat, Inc.
+ * Copyright (C) 2007-2010 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -562,7 +562,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
&backingStore,
&vol->allocation,
&vol->capacity,
- &vol->target.encryption) < 0)) {
+ &vol->target.encryption) != 0)) {
if (ret == -1)
goto cleanup;
else {
@@ -603,7 +603,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
if ((ret = virStorageBackendProbeTarget(conn,
&vol->backingStore,
NULL, NULL, NULL,
- NULL)) < 0) {
+ NULL)) != 0) {
if (ret == -1)
goto cleanup;
else {
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] [PATCH] remove useless comparisons in lxc_driver, vbox_tmpl.c
by Jim Meyering
Here are two change sets.
They remove useless comparisons of the style
- if (def->nets[i]->mac) {
where the mac member is declared as an array.
>From d22b04d2684d5a16f797d8df0c2ef036b5b1b2ce Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 09:49:57 +0100
Subject: [PATCH 1/2] lxc_driver: remove useless comparison
* src/lxc/lxc_driver.c (lxcSetupInterfaces): Remove always-true
array-is-non-NULL test. git grep 'mac\[.*\];'|grep -F .h
src/conf/domain_conf.h: unsigned char mac[VIR_MAC_BUFLEN];
---
src/lxc/lxc_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 86606c7..94ec874 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -834,7 +834,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
goto error_exit;
}
- if (def->nets[i]->mac) {
+ {
char macaddr[VIR_MAC_STRING_BUFLEN];
virFormatMacAddr(def->nets[i]->mac, macaddr);
if (0 != (rc = setMacAddr(containerVeth, macaddr))) {
--
1.6.6.638.g2bc54
>From c751c0cf3352b08d674bb59efd987f106fc1fffb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 09:58:57 +0100
Subject: [PATCH 2/2] vbox_tmpl.c: remove useless array-is-non-NULL comparisons
* src/vbox/vbox_tmpl.c (vboxStorageVolDelete): Remove always-true
array-is-non-NULL test. git grep 'key\[.*\];'|grep -F .h
src/datatypes.h: char key[PATH_MAX];
(vboxStorageVolGetInfo): Likewise.
(vboxStorageVolGetXMLDesc): Likewise.
(vboxStorageVolGetPath): Likewise.
(vboxDomainDefineXML): Likewise. (but now with "mac[]")
---
src/vbox/vbox_tmpl.c | 16 ++--------------
1 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 07696c0..e40c848 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -4084,9 +4084,7 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
}
VBOX_UTF8_TO_UTF16(macaddrvbox, &MACAddress);
- if (def->nets[i]->mac) {
- adapter->vtbl->SetMACAddress(adapter, MACAddress);
- }
+ adapter->vtbl->SetMACAddress(adapter, MACAddress);
VBOX_UTF16_FREE(MACAddress);
}
}
@@ -6645,9 +6643,6 @@ static int vboxStorageVolDelete(virStorageVolPtr vol,
int i = 0;
int j = 0;
- if (!vol->key)
- return ret;
-
vboxUtf8toIID(vol->conn, vol->key, &hddIID);
if (!hddIID)
return ret;
@@ -6774,8 +6769,7 @@ static int vboxStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info
vboxIID *hddIID = NULL;
nsresult rc;
- if ( !vol->key
- || !info)
+ if (!info)
return ret;
vboxUtf8toIID(vol->conn, vol->key, &hddIID);
@@ -6824,9 +6818,6 @@ static char *vboxStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags A
int defOk = 0;
nsresult rc;
- if (!vol->key)
- return ret;
-
memset(&pool, 0, sizeof(pool));
memset(&def, 0, sizeof(def));
@@ -6919,9 +6910,6 @@ static char *vboxStorageVolGetPath(virStorageVolPtr vol) {
vboxIID *hddIID = NULL;
nsresult rc;
- if (!vol->key)
- return ret;
-
vboxUtf8toIID(vol->conn, vol->key, &hddIID);
if (!hddIID)
return ret;
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] [PATCH] secret_driver.c: remove dead cleanup code
by Jim Meyering
Here's another example of appropriate use of assert.
The while loop removed below is currently guaranteed never
to be executed, since "list" is always NULL at that point.
However, you can argue that simply removing the loop is a little
risky: what if someone changes things to "goto cleanup" before
"list" reaches the final NULL? That's why I added the assertion:
to catch the potential (albeit unlikely) future coding error.
It would be a shame to include "real" run-time code to detect
a situation like that that will probably never arise. And if you
do, technically you'd have to document that the function would
return some sort of error code if a developer changes its guts
in a way that violates this invariant. That would be nonsensical.
>From 6baa2b0b8f9963fa60ff0946afcefd57586e2720 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 10:46:57 +0100
Subject: [PATCH] secret_driver.c: remove dead cleanup code
* src/secret/secret_driver.c (loadSecrets): Remove dead code
after "cleanup:". At that point, "list" is known to be NULL.
Instead, add an assertion.
Include <assert.h>.
---
src/secret/secret_driver.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 1eef468..b4b4f8a 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -1,7 +1,7 @@
/*
* secret_driver.c: local driver for secret manipulation API
*
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009-2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <assert.h>
#include "internal.h"
#include "base64.h"
@@ -518,12 +519,7 @@ loadSecrets(virConnectPtr conn, virSecretDriverStatePtr driver,
ret = 0;
cleanup:
- while (list != NULL) {
- virSecretEntryPtr s;
-
- s = listUnlink(&list);
- secretFree(s);
- }
+ assert (list == NULL);
if (dir != NULL)
closedir(dir);
return ret;
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] [PATCH] Use closest CPU model when decoding from CPUID
by Jiri Denemark
Current implementation of x86Decode() used for CPUID -> model+features
translation does not always select the closest CPU model. When walking
through all models from cpu_map.xml the function considers a new
candidate as a better choice than a previously selected candidate only
if the new one is a superset of the old one. In case the new candidate
is closer to host CPU but lacks some feature comparing to the old
candidate, the function does not choose well.
This patch changes the algorithm so that the closest model is always
selected. That is, the model which requires the lowest number of
additional features to describe host CPU.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_x86.c | 122 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 78 insertions(+), 44 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 298b632..dae7c90 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -238,6 +238,55 @@ x86DataFromModel(const struct x86_model *model)
}
+static virCPUDefPtr
+x86DataToCPU(const union cpuData *data,
+ const struct x86_model *model,
+ const struct x86_map *map)
+{
+ virCPUDefPtr cpu;
+ union cpuData *tmp = NULL;
+ struct cpuX86cpuid *cpuid;
+ const struct x86_feature *feature;
+ int i;
+
+ if (VIR_ALLOC(cpu) < 0 ||
+ (cpu->model = strdup(model->name)) == NULL ||
+ (tmp = x86DataCopy(data)) == NULL)
+ goto no_memory;
+
+ for (i = 0; i < model->ncpuid; i++) {
+ x86cpuidClearBits(x86DataCpuid(tmp, model->cpuid[i].function),
+ model->cpuid + i);
+ }
+
+ feature = map->features;
+ while (feature != NULL) {
+ for (i = 0; i < feature->ncpuid; i++) {
+ if ((cpuid = x86DataCpuid(tmp, feature->cpuid[i].function))
+ && x86cpuidMatchMasked(cpuid, feature->cpuid + i)) {
+ x86cpuidClearBits(cpuid, feature->cpuid + i);
+ if (virCPUDefAddFeature(NULL, cpu, feature->name,
+ VIR_CPU_FEATURE_REQUIRE) < 0)
+ goto error;
+ }
+ }
+
+ feature = feature->next;
+ }
+
+cleanup:
+ x86DataFree(tmp);
+ return cpu;
+
+no_memory:
+ virReportOOMError(NULL);
+error:
+ virCPUDefFree(cpu);
+ cpu = NULL;
+ goto cleanup;
+}
+
+
static void
x86FeatureFree(struct x86_feature *feature)
{
@@ -896,10 +945,9 @@ x86Decode(virCPUDefPtr cpu,
{
int ret = -1;
struct x86_map *map;
- const struct x86_feature *feature;
- const struct x86_model *model = NULL;
const struct x86_model *candidate;
- union cpuData *tmp = NULL;
+ virCPUDefPtr cpuCandidate;
+ virCPUDefPtr cpuModel = NULL;
struct cpuX86cpuid *cpuid;
int i;
@@ -908,6 +956,8 @@ x86Decode(virCPUDefPtr cpu,
candidate = map->models;
while (candidate != NULL) {
+ bool allowed = (models == NULL);
+
for (i = 0; i < candidate->ncpuid; i++) {
cpuid = x86DataCpuid(data, candidate->cpuid[i].function);
if (cpuid == NULL
@@ -915,65 +965,49 @@ x86Decode(virCPUDefPtr cpu,
goto next;
}
- if (model == NULL
- || x86ModelCompare(model, candidate) == SUBSET) {
- bool found = false;
- for (i = 0; i < nmodels; i++) {
- if (STREQ(models[i], candidate->name)) {
- found = true;
- break;
- }
+ for (i = 0; i < nmodels; i++) {
+ if (STREQ(models[i], candidate->name)) {
+ allowed = true;
+ break;
}
+ }
- if (nmodels > 0 && !found) {
- VIR_DEBUG("CPU model %s not allowed by hypervisor; ignoring",
- candidate->name);
- }
- else
- model = candidate;
+ if (!allowed) {
+ VIR_DEBUG("CPU model %s not allowed by hypervisor; ignoring",
+ candidate->name);
+ goto next;
}
+ if (!(cpuCandidate = x86DataToCPU(data, candidate, map)))
+ goto out;
+
+ if (cpuModel == NULL
+ || cpuModel->nfeatures > cpuCandidate->nfeatures) {
+ virCPUDefFree(cpuModel);
+ cpuModel = cpuCandidate;
+ } else
+ virCPUDefFree(cpuCandidate);
+
next:
candidate = candidate->next;
}
- if (model == NULL) {
+ if (cpuModel == NULL) {
virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("Cannot find suitable CPU model for given data"));
goto out;
}
- if ((cpu->model = strdup(model->name)) == NULL
- || (tmp = x86DataCopy(data)) == NULL) {
- virReportOOMError(NULL);
- goto out;
- }
-
- for (i = 0; i < model->ncpuid; i++) {
- x86cpuidClearBits(x86DataCpuid(tmp, model->cpuid[i].function),
- model->cpuid + i);
- }
-
- feature = map->features;
- while (feature != NULL) {
- for (i = 0; i < feature->ncpuid; i++) {
- if ((cpuid = x86DataCpuid(tmp, feature->cpuid[i].function))
- && x86cpuidMatchMasked(cpuid, feature->cpuid + i)) {
- x86cpuidClearBits(cpuid, feature->cpuid + i);
- if (virCPUDefAddFeature(NULL, cpu, feature->name,
- VIR_CPU_FEATURE_REQUIRE) < 0)
- goto out;
- }
- }
-
- feature = feature->next;
- }
+ cpu->model = cpuModel->model;
+ cpu->nfeatures = cpuModel->nfeatures;
+ cpu->features = cpuModel->features;
+ VIR_FREE(cpuModel);
ret = 0;
out:
- x86DataFree(tmp);
x86MapFree(map);
+ virCPUDefFree(cpuModel);
return ret;
}
--
1.6.6
14 years, 10 months
[libvirt] [PATCH 1/2] Standardise ./configure --help options reporting.
by Diego Elio Pettenò
Always use AC_HELP_STRING for the help text for options at ./configure,
so that the output is properly aligned.
Use proper quadrigraphs for outputting the brackets.
Always use autoconf-style [default=$foo] output to state the default, both
where it was stated before and where it wasn't.
This time, include Matthias Bolte notes regarding defaults, and removing
PFX specification from phyp.
---
configure.in | 100 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/configure.in b/configure.in
index 012a96f..447d57e 100644
--- a/configure.in
+++ b/configure.in
@@ -205,33 +205,33 @@ fi
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
AC_ARG_WITH([xen],
-[ --with-xen add XEN support (on)],[],[with_xen=yes])
+ AC_HELP_STRING([--with-xen], [add XEN support @<:@default=yes@:>@]),[],[with_xen=yes])
AC_ARG_WITH([xen-inotify],
-[ --with-xen-inotify add XEN inotify support (on)],[],[with_xen_inotify=check])
+ AC_HELP_STRING([--with-xen-inotify], [add XEN inotify support @<:@default=check@:>@]),[],[with_xen_inotify=check])
AC_ARG_WITH([qemu],
-[ --with-qemu add QEMU/KVM support (on)],[],[with_qemu=yes])
+ AC_HELP_STRING([--with-qemu], [add QEMU/KVM support @<:@default=yes@:>@]),[],[with_qemu=yes])
AC_ARG_WITH([uml],
-[ --with-uml add UML support (on)],[],[with_uml=check])
+ AC_HELP_STRING([--with-uml], [add UML support @<:@default=check@:>@]),[],[with_uml=check])
AC_ARG_WITH([openvz],
-[ --with-openvz add OpenVZ support (on)],[],[with_openvz=yes])
+ AC_HELP_STRING([--with-openvz], [add OpenVZ support @<:@default=yes@:>@]),[],[with_openvz=yes])
AC_ARG_WITH([libssh2],
-[ --with-libssh2=[PFX] libssh2 location],[],[with_libssh2=yes])
+ AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location @<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes])
AC_ARG_WITH([phyp],
-[ --with-phyp=[PFX] add PHYP support (on)],[],[with_phyp=check])
+ AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check])
AC_ARG_WITH([vbox],
-[ --with-vbox add VirtualBox support (on)],[],[with_vbox=yes])
+ AC_HELP_STRING([--with-vbox], [add VirtualBox support @<:@default=yes@:>@]),[],[with_vbox=yes])
AC_ARG_WITH([lxc],
-[ --with-lxc add Linux Container support (on)],[],[with_lxc=check])
+ AC_HELP_STRING([--with-lxc], [add Linux Container support @<:@default=check@:>@]),[],[with_lxc=check])
AC_ARG_WITH([one],
-[ --with-one add ONE support (on)],[],[with_one=check])
+ AC_HELP_STRING([--with-one], [add ONE support @<:@default=check@:>@]),[],[with_one=check])
AC_ARG_WITH([esx],
-[ --with-esx add ESX support (on)],[],[with_esx=check])
+ AC_HELP_STRING([--with-esx], [add ESX support @<:@default=check@:>@]),[],[with_esx=check])
AC_ARG_WITH([test],
-[ --with-test add test driver support (on)],[],[with_test=yes])
+ AC_HELP_STRING([--with-test], [add test driver support @<:@default=yes@:>@]),[],[with_test=yes])
AC_ARG_WITH([remote],
-[ --with-remote add remote driver support (on)],[],[with_remote=yes])
+ AC_HELP_STRING([--with-remote], [add remote driver support @<:@default=yes@:>@]),[],[with_remote=yes])
AC_ARG_WITH([libvirtd],
-[ --with-libvirtd add libvirtd support (on)],[],[with_libvirtd=yes])
+ AC_HELP_STRING([--with-libvirtd], [add libvirtd support @<:@default=yes@:>@]),[],[with_libvirtd=yes])
dnl
dnl specific tests to setup DV devel environments with debug etc ...
@@ -245,8 +245,8 @@ AC_SUBST([STATIC_BINARIES])
dnl --enable-debug=(yes|no)
AC_ARG_ENABLE([debug],
- [AC_HELP_STRING([--enable-debug=no/yes],
- [enable debugging output])],[],[enable_debug=yes])
+ [AC_HELP_STRING([--enable-debug=@<:@no|yes@:>@],
+ [enable debugging output @<:@default=yes@:>@])],[],[enable_debug=yes])
AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes")
if test x"$enable_debug" = x"yes"; then
AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
@@ -254,7 +254,7 @@ fi
AC_MSG_CHECKING([where to write libvirtd PID file])
-AC_ARG_WITH([remote-pid-file], [AC_HELP_STRING([--with-remote-pid-file=[pidfile|none]], [PID file for libvirtd])])
+AC_ARG_WITH([remote-pid-file], [AC_HELP_STRING([--with-remote-pid-file=@<:@pidfile|none@:>@], [PID file for libvirtd])])
if test "x$with_remote_pid_file" == "x" ; then
REMOTE_PID_FILE="$localstatedir/run/libvirtd.pid"
elif test "x$with_remote_pid_file" == "xnone" ; then
@@ -270,8 +270,8 @@ dnl init script flavor
dnl
AC_MSG_CHECKING([for init script flavor])
AC_ARG_WITH([init-script],
- [AC_HELP_STRING([--with-init-script=[redhat|auto|none]],
- [Style of init script to install (defaults to auto)])])
+ [AC_HELP_STRING([--with-init-script=@<:@redhat|auto|none@:>@],
+ [Style of init script to install @<:@default=auto@:>@])])
if test "x$with_init_script" = "x" -o "x$with_init_script" = "xauto"; then
if test -f /etc/redhat-release ; then
with_init_script=redhat
@@ -284,8 +284,8 @@ AC_MSG_RESULT($with_init_script)
dnl RHEL-5 has a peculiar version of Xen, which requires some special casing
AC_ARG_WITH([rhel5-api],
- [AC_HELP_STRING([--with-rhel5-api=[ARG]],
- [build for the RHEL-5 API [default=no]])])
+ [AC_HELP_STRING([--with-rhel5-api=@<:@ARG@:>@],
+ [build for the RHEL-5 API @<:@default=no@:>@])])
if test x"$with_rhel5_api" = x"yes"; then
AC_DEFINE([WITH_RHEL5_API], [1], [whether building for the RHEL-5 API])
fi
@@ -509,7 +509,7 @@ LIBXML_CFLAGS=""
LIBXML_LIBS=""
LIBXML_FOUND="no"
-AC_ARG_WITH([libxml], [ --with-libxml=[PFX] libxml2 location])
+AC_ARG_WITH([libxml], AC_HELP_STRING([--with-libxml=@<:@PFX@:>@], [libxml2 location]))
if test "x$with_libxml" = "xno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
@@ -596,7 +596,7 @@ LIBS="$old_libs"
dnl Cyrus SASL
AC_ARG_WITH([sasl],
- [ --with-sasl use cyrus SASL for authentication],
+ AC_HELP_STRING([--with-sasl], [use cyrus SASL for authentication @<:@default=check@:>@]),
[],
[with_sasl=check])
@@ -651,7 +651,7 @@ AC_SUBST([SASL_LIBS])
dnl YAJL JSON library http://lloyd.github.com/yajl/
AC_ARG_WITH([yajl],
- [ --with-yajl use YAJL for JSON parsing/formatting],
+ AC_HELP_STRING([--with-yajl], [use YAJL for JSON parsing/formatting @<:@default=check@:>@]),
[],
[with_yajl=check])
@@ -704,7 +704,7 @@ POLKIT_CFLAGS=
POLKIT_LIBS=
PKCHECK_PATH=
AC_ARG_WITH([polkit],
- [ --with-polkit use PolicyKit for UNIX socket access checks],
+ AC_HELP_STRING([--with-polkit], [use PolicyKit for UNIX socket access checks @<:@default=check@:>@]),
[],
[with_polkit=check])
@@ -762,7 +762,7 @@ AC_SUBST([POLKIT_LIBS])
dnl Avahi library
AC_ARG_WITH([avahi],
- [ --with-avahi use avahi to advertise remote daemon],
+ AC_HELP_STRING([--with-avahi], [use avahi to advertise remote daemon @<:@default=check@:>@]),
[],
[with_avahi=check])
@@ -789,7 +789,7 @@ AC_SUBST([AVAHI_LIBS])
dnl SELinux
AC_ARG_WITH([selinux],
- [ --with-selinux use SELinux to manage security],
+ AC_HELP_STRING([--with-selinux], [use SELinux to manage security @<:@default=check@:>@]),
[],
[with_selinux=check])
@@ -824,7 +824,7 @@ AC_SUBST([SELINUX_LIBS])
AC_ARG_WITH([secdriver-selinux],
- [ --with-secdriver-selinux use SELinux security driver],
+ AC_HELP_STRING([--with-secdriver-selinux], [use SELinux security driver @<:@default=check@:>@]),
[],
[with_secdriver_selinux=check])
@@ -862,7 +862,7 @@ AM_CONDITIONAL([WITH_SECDRIVER_SELINUX], [test "$with_secdriver_selinux" != "no"
dnl AppArmor
AC_ARG_WITH([apparmor],
- [ --with-apparmor use AppArmor to manage security],
+ AC_HELP_STRING([--with-apparmor], [use AppArmor to manage security @<:@default=check@:>@]),
[],
[with_apparmor=check])
@@ -901,7 +901,7 @@ AC_SUBST([APPARMOR_LIBS])
AC_ARG_WITH([secdriver-apparmor],
- [ --with-secdriver-apparmor use AppArmor security driver],
+ AC_HELP_STRING([--with-secdriver-apparmor], [use AppArmor security driver @<:@default=check@:>@]),
[],
[with_secdriver_apparmor=check])
@@ -940,7 +940,7 @@ AM_CONDITIONAL([WITH_SECDRIVER_APPARMOR], [test "$with_secdriver_apparmor" != "n
dnl NUMA lib
AC_ARG_WITH([numactl],
- [ --with-numactl use numactl for host topology info],
+ AC_HELP_STRING([--with-numactl], [use numactl for host topology info @<:@default=check@:>@]),
[],
[with_numactl=check])
@@ -1075,7 +1075,7 @@ AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"])
dnl libcap-ng
AC_ARG_WITH([capng],
- [ --with-capng use libcap-ng to reduce libvirtd privileges],
+ AC_HELP_STRING([--with-capng], [use libcap-ng to reduce libvirtd privileges @<:@default=check@:>@]),
[],
[with_capng=check])
@@ -1158,7 +1158,7 @@ AC_SUBST([VIRSH_LIBS])
AC_ARG_WITH([network],
-[ --with-network with virtual network driver (on)],[],[with_network=yes])
+ AC_HELP_STRING([--with-network], [with virtual network driver @<:@default=yes@:>@]),[],[with_network=yes])
if test "$with_libvirtd" = "no" ; then
with_network=no
fi
@@ -1176,7 +1176,7 @@ AM_CONDITIONAL([WITH_BRIDGE], [test "$with_bridge" = "yes"])
dnl netcf library
AC_ARG_WITH([netcf],
-[ --with-netcf libnetcf support to configure physical host network interfaces],
+ AC_HELP_STRING([--with-netcf], [libnetcf support to configure physical host network interfaces @<:@default=check@:>@]),
[], [with_netcf=check])
NETCF_CFLAGS=
@@ -1212,17 +1212,17 @@ AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"])
AC_ARG_WITH([storage-fs],
-[ --with-storage-fs with FileSystem backend for the storage driver (on)],[],[with_storage_fs=check])
+ AC_HELP_STRING([--with-storage-fs], [with FileSystem backend for the storage driver @<:@default=check@:>@]),[],[with_storage_fs=check])
AC_ARG_WITH([storage-lvm],
-[ --with-storage-lvm with LVM backend for the storage driver (on)],[],[with_storage_lvm=check])
+ AC_HELP_STRING([--with-storage-lvm], [with LVM backend for the storage driver @<:@default=check@:>@]),[],[with_storage_lvm=check])
AC_ARG_WITH([storage-iscsi],
-[ --with-storage-iscsi with iSCSI backend for the storage driver (on)],[],[with_storage_iscsi=check])
+ AC_HELP_STRING([--with-storage-iscsi], [with iSCSI backend for the storage driver @<:@default=check@:>@]),[],[with_storage_iscsi=check])
AC_ARG_WITH([storage-scsi],
-[ --with-storage-scsi with SCSI backend for the storage driver (on)],[],[with_storage_scsi=check])
+ AC_HELP_STRING([--with-storage-scsi], [with SCSI backend for the storage driver @<:@default=check@:>@]),[],[with_storage_scsi=check])
AC_ARG_WITH([storage-mpath],
-[ --with-storage-mpath with mpath backend for the storage driver (on)],[],[with_storage_mpath=check])
+ AC_HELP_STRING([--with-storage-mpath], [with mpath backend for the storage driver @<:@default=check@:>@]),[],[with_storage_mpath=check])
AC_ARG_WITH([storage-disk],
-[ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check])
+ AC_HELP_STRING([--with-storage-disk], [with GPartd Disk backend for the storage driver @<:@default=check@:>@]),[],[with_storage_disk=check])
with_storage_dir=yes
if test "$with_libvirtd" = "no"; then
@@ -1464,7 +1464,7 @@ dnl check for python
dnl
AC_ARG_WITH([python],
-[ --with-python Build python bindings (on)],[],[with_python=yes])
+ AC_HELP_STRING([--with-python], [Build python bindings @<:@default=yes@:>@]),[],[with_python=yes])
if test "$enable_shared:$with_python" = no:yes; then
AC_MSG_WARN([Disabling shared libraries is incompatible with building Python extensions.])
@@ -1561,7 +1561,7 @@ AC_MSG_RESULT($RUNNING_XEND)
AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
AC_ARG_ENABLE([test-coverage],
-[ --enable-test-coverage turn on code coverage instrumentation],
+ AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
[case "${enableval}" in
yes|no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for test-coverage option]) ;;
@@ -1578,7 +1578,7 @@ if test "${enable_coverage}" = yes; then
fi
AC_ARG_ENABLE([test-oom],
-[ --enable-test-oom memory allocation failure checking],
+ AC_HELP_STRING([--enable-test-oom], [memory allocation failure checking @<:@default=no@:>@]),
[case "${enableval}" in
yes|no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for test-oom option]) ;;
@@ -1598,7 +1598,7 @@ fi
AC_ARG_ENABLE([test-locking],
-[ --enable-test-locking thread locking tests using CIL],
+ AC_HELP_STRING([--enable-test-locking], [thread locking tests using CIL @<:@default=no@:>@]),
[case "${enableval}" in
yes|no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for test-locking option]) ;;
@@ -1615,7 +1615,7 @@ AM_CONDITIONAL([WITH_CIL],[test "$enable_locking" = "yes"])
dnl Enable building the proxy?
AC_ARG_WITH([xen-proxy],
-[ --with-xen-proxy add XEN setuid proxy support (on)],[],[with_xen_proxy=auto])
+ AC_HELP_STRING([--with-xen-proxy], [add XEN setuid proxy support @<:@default=auto@:>@]),[],[with_xen_proxy=auto])
AC_MSG_CHECKING([if Xen setuid proxy is needed])
if test "$with_xen_proxy" = "auto"; then
@@ -1675,7 +1675,7 @@ AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != "no"])
dnl Driver-Modules library
AC_ARG_WITH([driver-modules],
- [ --with-driver-modules build drivers as loadable modules],
+ AC_HELP_STRING([--with-driver-modules], [build drivers as loadable modules @<:@default=no@:>@]),
[],
[with_driver_modules=no])
@@ -1714,7 +1714,7 @@ dnl HAL library check for host device enumeration
HAL_CFLAGS=
HAL_LIBS=
AC_ARG_WITH([hal],
- [ --with-hal use HAL for host device enumeration],
+ AC_HELP_STRING([--with-hal], [use HAL for host device enumeration @<:@default=check@:>@]),
[],
[with_hal=check])
@@ -1757,7 +1757,7 @@ UDEV_LIBS=
PCIACCESS_CFLAGS=
PCIACCESS_LIBS=
AC_ARG_WITH([udev],
- [ --with-udev use libudev for host device enumeration],
+ AC_HELP_STRING([--with-udev], [use libudev for host device enumeration @<:@default=check@:>@]),
[],
[with_udev=check])
@@ -1809,11 +1809,11 @@ AM_CONDITIONAL([WITH_LINUX], [test `uname -s` = "Linux"])
AC_ARG_WITH([qemu-user],
- [ --with-qemu-user username to run QEMU system instance as],
+ AC_HELP_STRING([--with-qemu-user], [username to run QEMU system instance as @<:@default=root@:>@]),
[QEMU_USER=${withval}],
[QEMU_USER=root])
AC_ARG_WITH([qemu-group],
- [ --with-qemu-group groupname to run QEMU system instance as],
+ AC_HELP_STRING([--with-qemu-group], [groupname to run QEMU system instance as @<:@default=root@:>@]),
[QEMU_GROUP=${withval}],
[QEMU_GROUP=root])
AC_DEFINE_UNQUOTED([QEMU_USER], ["$QEMU_USER"], [QEMU user account])
--
1.6.6
14 years, 10 months
[libvirt] [PATCH 0/4] A bit of configure clear-up
by Diego Elio Pettenò
Since on the whole it seems like the configure could see some cleanup, as
it seem to use lots of older constructs and repeated code, I tried doing
some basic cleaning.
My changes also require autoconf-2.63… it could be something older as well,
but 2.63 is new enough I'd say. If nobody has reasons for 2.59
compatibility to stick around, it would probably improve a lot.
HTH!
--
Diego
14 years, 10 months
[libvirt] [PATCH] qemu: Use log output for pty assignment if 'info chardev' is unavailable
by Matthias Bolte
qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
provide information for a requested device, even if the log output parsing
had found the pty path for that device. This makes pty assignment fail for
older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
information and the hash for device-id-to-pty-path mapping stays empty.
Make qemudFindCharDevicePTYsMonitor report an error only if the log output
parsing and the 'info chardev' parsing failed to provide the pty path.
---
src/qemu/qemu_driver.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d13119f..783d9fc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1428,9 +1428,17 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
\
const char *path = (const char *) virHashLookup(paths, id); \
if (path == NULL) { \
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,\
- _("no assigned pty for device %s"), id); \
- return -1; \
+ if (chr->data.file.path == NULL) { \
+ /* neither the log output nor 'info chardev' had a */ \
+ /* pty path for this chardev, report an error */ \
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
+ _("no assigned pty for device %s"), id); \
+ return -1; \
+ } else { \
+ /* 'info chardev' had no pty path for this chardev, */\
+ /* but the log output had, so we're fine */ \
+ continue; \
+ } \
} \
\
VIR_FREE(chr->data.file.path); \
--
1.6.3.3
14 years, 10 months
[libvirt] [PATCH] esx: Add VNC support
by Matthias Bolte
* src/conf/domain_conf.c: add defaults for the video device
* src/esx/esx_vmx.[ch]: add VNC support to the VMX handling
* tests/vmx2xmltest.c, tests/xml2vmxtest.c: add tests for the VNC support
---
src/conf/domain_conf.c | 5 +
src/esx/esx_vmx.c | 146 +++++++++++++++++++++++++++-
src/esx/esx_vmx.h | 6 +
tests/vmx2xmldata/vmx2xml-graphics-vnc.vmx | 6 +
tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 17 +++
tests/vmx2xmltest.c | 4 +-
tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx | 11 ++
tests/xml2vmxdata/xml2vmx-graphics-vnc.xml | 11 ++
tests/xml2vmxtest.c | 2 +
9 files changed, 203 insertions(+), 5 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-graphics-vnc.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-graphics-vnc.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 126e7e1..5c427fb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2490,6 +2490,8 @@ virDomainVideoDefaultRAM(virDomainDefPtr def,
case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
if (def->virtType == VIR_DOMAIN_VIRT_VBOX)
return 8 * 1024;
+ else if (def->virtType == VIR_DOMAIN_VIRT_VMWARE)
+ return 4 * 1024;
else
return 9 * 1024;
break;
@@ -2523,6 +2525,9 @@ virDomainVideoDefaultType(virDomainDefPtr def)
case VIR_DOMAIN_VIRT_VBOX:
return VIR_DOMAIN_VIDEO_TYPE_VBOX;
+ case VIR_DOMAIN_VIRT_VMWARE:
+ return VIR_DOMAIN_VIDEO_TYPE_VMVGA;
+
default:
return -1;
}
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index 8e016df..777a60a 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -731,7 +731,7 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
char *guestOS = NULL;
int controller;
int port;
- int present;
+ int present; // boolean
char *scsi_virtualDev = NULL;
int id;
@@ -967,7 +967,20 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
def->localtime*/
/* def:graphics */
- /* FIXME */
+ if (VIR_ALLOC_N(def->graphics, 1) < 0) {
+ virReportOOMError(NULL);
+ goto failure;
+ }
+
+ def->ngraphics = 0;
+
+ if (esxVMX_ParseVNC(conf, &def->graphics[def->ngraphics]) < 0) {
+ goto failure;
+ }
+
+ if (def->graphics[def->ngraphics] != NULL) {
+ ++def->ngraphics;
+ }
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
if (VIR_ALLOC_N(def->disks, 66) < 0) {
@@ -1155,6 +1168,70 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
int
+esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
+{
+ int enabled = 0; // boolean
+ long long port = 0;
+
+ if (def == NULL || *def != NULL) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ return -1;
+ }
+
+ if (esxUtil_GetConfigBoolean(conf, "RemoteDisplay.vnc.enabled",
+ &enabled, 0, 1) < 0) {
+ return -1;
+ }
+
+ if (! enabled) {
+ return 0;
+ }
+
+ if (VIR_ALLOC(*def) < 0) {
+ virReportOOMError(NULL);
+ goto failure;
+ }
+
+ (*def)->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+
+ if (esxUtil_GetConfigLong(conf, "RemoteDisplay.vnc.port",
+ &port, -1, 1) < 0 ||
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.ip",
+ &(*def)->data.vnc.listenAddr, 1) < 0 ||
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.keymap",
+ &(*def)->data.vnc.keymap, 1) < 0 ||
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.password",
+ &(*def)->data.vnc.passwd, 1) < 0) {
+ goto failure;
+ }
+
+ if (port < 0) {
+ VIR_WARN0("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' "
+ "is missing, the VNC port is unknown");
+
+ (*def)->data.vnc.port = 0;
+ (*def)->data.vnc.autoport = 1;
+ } else {
+ if (port < 5900 || port > 5964) {
+ VIR_WARN("VNC port %lld it out of [5900..5964] range", port);
+ }
+
+ (*def)->data.vnc.port = port;
+ (*def)->data.vnc.autoport = 0;
+ }
+
+ return 0;
+
+ failure:
+ virDomainGraphicsDefFree(*def);
+ *def = NULL;
+
+ return -1;
+}
+
+
+
+int
esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
char **virtualDev)
{
@@ -2195,7 +2272,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
(int)(def->memory / 1024));
}
- /* vmx:numvcpus -> def:vcpus */
+ /* def:vcpus -> vmx:numvcpus */
if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'vcpu' to be an unsigned "
@@ -2241,6 +2318,24 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
virBufferAddLit(&buffer, "\"\n");
}
+ /* def:graphics */
+ for (i = 0; i < def->ngraphics; ++i) {
+ switch (def->graphics[i]->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (esxVMX_FormatVNC(def->graphics[i], &buffer) < 0) {
+ goto failure;
+ }
+
+ break;
+
+ default:
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ "Unsupported graphics type '%s'",
+ virDomainGraphicsTypeToString(def->graphics[i]->type));
+ goto failure;
+ }
+ }
+
/* def:disks */
int scsi_present[4] = { 0, 0, 0, 0 };
char *scsi_virtualDev[4] = { NULL, NULL, NULL, NULL };
@@ -2285,7 +2380,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsuppotred disk device type '%s'",
+ "Unsupported disk device type '%s'",
virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto failure;
}
@@ -2341,6 +2436,49 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
int
+esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
+{
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ return -1;
+ }
+
+ virBufferVSprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
+
+ if (def->data.vnc.autoport) {
+ VIR_WARN0("VNC autoport is enabled, but the automatically assigned "
+ "VNC port cannot be read back");
+ } else {
+ if (def->data.vnc.port < 5900 || def->data.vnc.port > 5964) {
+ VIR_WARN("VNC port %d it out of [5900..5964] range",
+ def->data.vnc.port);
+ }
+
+ virBufferVSprintf(buffer, "RemoteDisplay.vnc.port = \"%d\"\n",
+ def->data.vnc.port);
+ }
+
+ if (def->data.vnc.listenAddr != NULL) {
+ virBufferVSprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n",
+ def->data.vnc.listenAddr);
+ }
+
+ if (def->data.vnc.keymap != NULL) {
+ virBufferVSprintf(buffer, "RemoteDisplay.vnc.keymap = \"%s\"\n",
+ def->data.vnc.keymap);
+ }
+
+ if (def->data.vnc.passwd != NULL) {
+ virBufferVSprintf(buffer, "RemoteDisplay.vnc.password = \"%s\"\n",
+ def->data.vnc.passwd);
+ }
+
+ return 0;
+}
+
+
+
+int
esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
virBufferPtr buffer)
{
diff --git a/src/esx/esx_vmx.h b/src/esx/esx_vmx.h
index 325005e..6193409 100644
--- a/src/esx/esx_vmx.h
+++ b/src/esx/esx_vmx.h
@@ -61,6 +61,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
esxVI_APIVersion apiVersion);
int
+esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
+
+int
esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
char **virtualDev);
@@ -96,6 +99,9 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
esxVI_APIVersion apiVersion);
int
+esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
+
+int
esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
virBufferPtr buffer);
diff --git a/tests/vmx2xmldata/vmx2xml-graphics-vnc.vmx b/tests/vmx2xmldata/vmx2xml-graphics-vnc.vmx
new file mode 100644
index 0000000..bd3e55f
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-graphics-vnc.vmx
@@ -0,0 +1,6 @@
+config.version = "8"
+virtualHW.version = "4"
+RemoteDisplay.vnc.enabled = "true"
+RemoteDisplay.vnc.port = "5903"
+RemoteDisplay.vnc.keymap = "de"
+RemoteDisplay.vnc.password = "password"
diff --git a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
new file mode 100644
index 0000000..159324d
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml
@@ -0,0 +1,17 @@
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory>32768</memory>
+ <currentMemory>32768</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index b83f23f..8ea0b12 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -42,7 +42,7 @@ testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion)
goto failure;
}
- formatted = virDomainDefFormat(NULL, def, 0);
+ formatted = virDomainDefFormat(NULL, def, VIR_DOMAIN_XML_SECURE);
if (formatted == NULL) {
goto failure;
@@ -120,6 +120,8 @@ mymain(int argc, char **argv)
DO_TEST("minimal", "minimal", esxVI_APIVersion_25);
DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25);
+ DO_TEST("graphics-vnc", "graphics-vnc", esxVI_APIVersion_25);
+
DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25);
DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25);
diff --git a/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx b/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
new file mode 100644
index 0000000..b4966b5
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx
@@ -0,0 +1,11 @@
+config.version = "8"
+virtualHW.version = "4"
+guestOS = "other"
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
+displayName = "minimal"
+memsize = "4"
+numvcpus = "1"
+RemoteDisplay.vnc.enabled = "true"
+RemoteDisplay.vnc.port = "5903"
+RemoteDisplay.vnc.keymap = "de"
+RemoteDisplay.vnc.password = "password"
diff --git a/tests/xml2vmxdata/xml2vmx-graphics-vnc.xml b/tests/xml2vmxdata/xml2vmx-graphics-vnc.xml
new file mode 100644
index 0000000..400dcdd
--- /dev/null
+++ b/tests/xml2vmxdata/xml2vmx-graphics-vnc.xml
@@ -0,0 +1,11 @@
+<domain type='vmware'>
+ <name>minimal</name>
+ <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
+ <memory>4096</memory>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/>
+ </devices>
+</domain>
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index dfaca02..530dd2a 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -173,6 +173,8 @@ mymain(int argc, char **argv)
DO_TEST("minimal", "minimal", esxVI_APIVersion_25);
DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25);
+ DO_TEST("graphics-vnc", "graphics-vnc", esxVI_APIVersion_25);
+
DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25);
DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25);
--
1.6.3.3
14 years, 10 months
[libvirt] [PATCH] esx: Make the domain part of the hostname optional
by Matthias Bolte
Before the driver assumed that there is always a domain part. That's
not true. Now the domain part is handled as optional.
---
src/esx/esx_driver.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 4ed4533..aeb3d07 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -773,14 +773,17 @@ esxGetHostname(virConnectPtr conn)
}
if (domainName == NULL || strlen(domainName) < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing or empty 'domainName' property");
- goto failure;
- }
+ complete = strdup(hostName);
- if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
- virReportOOMError(NULL);
- goto failure;
+ if (complete == NULL) {
+ virReportOOMError(NULL);
+ goto failure;
+ }
+ } else {
+ if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
+ virReportOOMError(NULL);
+ goto failure;
+ }
}
cleanup:
--
1.6.3.3
14 years, 10 months