[libvirt] [PATCH] util: Make getaddrinfo failure nonfatal in virGetHostname
by Jiri Denemark
Setting a hostname that cannot be resolved is not the best configuration
but since virGetHostname only calls getaddrinfo to get host's canonical
name and we do not fail if the returned canonical name is NULL or
"localhost", there is no reason why we should fail if getaddrinfo itself
fails.
---
src/util/util.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 1ff287d..fd4d7fa 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1858,10 +1858,10 @@ char *virIndexToDiskName(int idx, const char *prefix)
* try to resolve this to a fully-qualified name. Therefore we pass it
* to getaddrinfo(). There are two possible responses:
* a) getaddrinfo() resolves to a FQDN - return the FQDN
- * b) getaddrinfo() resolves to localhost - in this case, the data we got
- * from gethostname() is actually more useful than what we got from
- * getaddrinfo(). Return the value from gethostname() and hope for
- * the best.
+ * b) getaddrinfo() files or resolves to localhost - in this case, the
+ * data we got from gethostname() is actually more useful than what
+ * we got from getaddrinfo(). Return the value from gethostname()
+ * and hope for the best.
*/
char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
{
@@ -1897,10 +1897,10 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
hints.ai_family = AF_UNSPEC;
r = getaddrinfo(hostname, NULL, &hints, &info);
if (r != 0) {
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- _("getaddrinfo failed for '%s': %s"),
- hostname, gai_strerror(r));
- return NULL;
+ VIR_WARN("getaddrinfo failed for '%s': %s",
+ hostname, gai_strerror(r));
+ result = strdup(hostname);
+ goto check_and_return;
}
/* Tell static analyzers about getaddrinfo semantics. */
--
1.7.7
13 years, 1 month
[libvirt] [PATCH] qemu: Make sure BeginJob is always followed by EndJob
by Jiri Denemark
Otherwise we can end up with a dangling job that can only be cleared by
restarting libvirtd.
---
src/qemu/qemu_driver.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0e307e1..98f4d7f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2010,42 +2010,42 @@ static int qemuDomainSendKey(virDomainPtr domain,
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(domain->uuid, uuidstr);
qemuReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
priv = vm->privateData;
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
- goto cleanup;
+ goto endjob;
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes);
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (qemuDomainObjEndJob(driver, vm) == 0) {
+
+endjob:
+ if (qemuDomainObjEndJob(driver, vm) == 0)
vm = NULL;
- goto cleanup;
- }
cleanup:
if (vm)
virDomainObjUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
static int qemudDomainGetInfo(virDomainPtr dom,
virDomainInfoPtr info)
{
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
int ret = -1;
int err;
unsigned long balloon;
@@ -7208,103 +7208,103 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
&errs);
qemuDomainObjExitMonitor(driver, vm);
if (ret < 0)
goto endjob;
/* Field 'errs' is meaningless for QEMU, won't set it. */
for (i = 0; i < *nparams; i++) {
virTypedParameterPtr param = ¶ms[i];
switch (i) {
case 0: /* fill write_bytes here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write bytes too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_bytes;
break;
case 1: /* fill wr_operations here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write requests too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_req;
break;
case 2: /* fill read_bytes here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_BYTES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read bytes too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_bytes;
break;
case 3: /* fill rd_operations here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read requests too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_req;
break;
case 4: /* fill flush_operations here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field flush requests too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = flush_req;
break;
case 5: /* fill wr_total_times_ns here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write total times too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_total_times;
break;
case 6: /* fill rd_total_times_ns here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read total times too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_total_times;
break;
case 7: /* fill flush_total_times_ns here */
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field flush total times too long for destination"));
- goto cleanup;
+ goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = flush_total_times;
break;
default:
break;
/* should not hit here */
}
}
endjob:
if (qemuDomainObjEndJob(driver, vm) == 0)
vm = NULL;
cleanup:
--
1.7.7
13 years, 1 month
[libvirt] [PATCH] qemu: Log debug messages when changing job
by Jiri Denemark
Log debug messages anytime we call *BeginJob* or *EndJob* so that it's
easier to spot incorrect usage of domain job APIs.
---
src/qemu/qemu_domain.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 85bebd6..5abc900 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -761,8 +761,13 @@ retry:
qemuDomainObjResetJob(priv);
if (job != QEMU_JOB_ASYNC) {
+ VIR_DEBUG("Starting job: %s (async=%s)",
+ qemuDomainJobTypeToString(job),
+ qemuDomainAsyncJobTypeToString(priv->job.asyncJob));
priv->job.active = job;
} else {
+ VIR_DEBUG("Starting async job: %s",
+ qemuDomainAsyncJobTypeToString(asyncJob));
qemuDomainObjResetAsyncJob(priv);
priv->job.asyncJob = asyncJob;
priv->job.start = now;
@@ -873,6 +878,10 @@ int qemuDomainObjEndJob(struct qemud_driver *driver, virDomainObjPtr obj)
priv->jobs_queued--;
+ VIR_DEBUG("Stopping job: %s (async=%s)",
+ qemuDomainJobTypeToString(priv->job.active),
+ qemuDomainAsyncJobTypeToString(priv->job.asyncJob));
+
qemuDomainObjResetJob(priv);
qemuDomainObjSaveJob(driver, obj);
virCondSignal(&priv->job.cond);
@@ -887,6 +896,9 @@ qemuDomainObjEndAsyncJob(struct qemud_driver *driver, virDomainObjPtr obj)
priv->jobs_queued--;
+ VIR_DEBUG("Stopping async job: %s",
+ qemuDomainAsyncJobTypeToString(priv->job.asyncJob));
+
qemuDomainObjResetAsyncJob(priv);
qemuDomainObjSaveJob(driver, obj);
virCondBroadcast(&priv->job.asyncCond);
--
1.7.7
13 years, 1 month
[libvirt] [PATCH v2 0/2] Xen: skip xenHypervisor version init in tests
by Philipp Hahn
Several tests fail when run as root on a Xen-dom0-system, since
virInitialize() then succeeds to open /proc/xen/privcmd and returns the
actual supported features instead of the faked one when calling
xenHypervisorMakeCapabilitiesInternal(). Since Xen-3.3 supports
additional features like "hap" and "viridian", the xencapstest fails.
v2: Skip initialization of static version variables for Xen Hypervisor and use
provided values for unit test cases.
Philipp Hahn (2):
Xen: move versions to struct
Xen: Fake versions in xencapstest
src/xen/xen_driver.c | 2 +-
src/xen/xen_hypervisor.c | 307 ++++++++++++++++++++++++----------------------
src/xen/xen_hypervisor.h | 10 ++-
tests/xencapstest.c | 10 ++
4 files changed, 180 insertions(+), 149 deletions(-)
13 years, 1 month
[libvirt] [PATCH] esx: drop dead code to silence Coverity
by Eric Blake
Coverity detected that the only way to get to the cleanup label
is if objectSpec had been successfully allocated, so the null
check was dead code.
* src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop
redundant null check.
---
I'll wait for a review on this one.
src/esx/esx_vi.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 4a8c709..8bcd76c 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -1763,11 +1763,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
* Remove values given by the caller from the data structures to prevent
* them from being freed by the call to esxVI_PropertyFilterSpec_Free().
*/
- if (objectSpec != NULL) {
- objectSpec->obj = NULL;
- objectSpec->selectSet = NULL;
- }
-
+ objectSpec->obj = NULL;
+ objectSpec->selectSet = NULL;
if (propertySpec != NULL) {
propertySpec->type = NULL;
propertySpec->pathSet = NULL;
--
1.7.4.4
13 years, 1 month
[libvirt] (no subject)
by Wayne Sun
For last patch of update migrate module, remote define domain is
deleted in migrate. Now add this function into define module in
this fix.
Also update modules which include create, define and
installation for the new option uuid added.
[test-API][PATCH 1/2] Update define module with remote define
[test-API][PATCH 2/2] Add optional argument uuid in create and install module
repos/domain/create.py | 6 +-
repos/domain/define.py | 141 +++------------------------------
repos/domain/install_image.py | 5 +-
repos/domain/install_linux_cdrom.py | 12 +--
repos/domain/install_linux_net.py | 13 +--
repos/domain/install_windows_cdrom.py | 12 +--
6 files changed, 29 insertions(+), 160 deletions(-)
13 years, 1 month
[libvirt] [PATCH] [libvirt-tck] vol->as_xml: fix backing store element
by Guido Günther
Fix typo that breaks setting the backing store format.
---
lib/Sys/Virt/TCK/StorageVolBuilder.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/Virt/TCK/StorageVolBuilder.pm b/lib/Sys/Virt/TCK/StorageVolBuilder.pm
index 515795f..da90788 100644
--- a/lib/Sys/Virt/TCK/StorageVolBuilder.pm
+++ b/lib/Sys/Virt/TCK/StorageVolBuilder.pm
@@ -112,7 +112,7 @@ sub as_xml {
$w->startTag("backingStore");
$w->dataElement("path", $self->{backingFile});
if ($self->{backingFormat}) {
- $w->emptyTag("format", type => $self->{backinFormat});
+ $w->emptyTag("format", type => $self->{backingFormat});
}
if ($self->{secret}) {
$w->startTag("encryption", format => "qcow");
--
1.7.6.3
13 years, 1 month
[libvirt] [PATCH] Fix syntax problem in mingw32-libvirt.spec.in
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When defining macros, you can't put comments on the end of the
line because they will get included in the macro definition
* mingw32-libvirt.spec.in: Fix comment about hyperv
---
mingw32-libvirt.spec.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Pushed under the build-breaker rule
diff --git a/mingw32-libvirt.spec.in b/mingw32-libvirt.spec.in
index 57c67ae..521790c 100644
--- a/mingw32-libvirt.spec.in
+++ b/mingw32-libvirt.spec.in
@@ -10,7 +10,8 @@
# libraries exist.
%define with_phyp 0%{!?_without_phyp:1}
%define with_esx 0%{!?_without_esx:1}
-%define with_hyperv 0%{!?_without_hyperv:0} # missing libwsman
+# missing libwsman, so can't build hyper-v
+%define with_hyperv 0%{!?_without_hyperv:0}
%define with_xenapi 0%{!?_without_xenapi:1}
# RHEL ships ESX but not PowerHypervisor, HyperV, or libxenserver (xenapi)
--
1.7.6.4
13 years, 1 month
[libvirt] [RFC PATCH 0/4] powerpc : Libvirt for the PowerPC platform
by Prerna Saxena
Recent development in KVM for 64-bit Power ISA Book3S machines, allows
users to run multiple KVM guest instances on POWER7 and PPC970
processor based systems. Also qemu-system-ppc64 has been enhanced to
support a new machine type "pseries" suitable for Power Book3S machines.
This addition effectively brings the KVM+qemu combination to run
multiple guest instances on a Power Book3S machine.
Libvirt continues to be the key interface to configure and manage the
KVM guest instances on x86. We would like to enhance libvirt to
support KVM guest configuration and management on Power Book3S
machines.
The following set of patches tries to illustrate the porting issues in
libvirt since it has been predominantly designed and used for x86 KVM.
I would like to discuss these issues and list out the possibilities of
refactoring the code and make it easier for adding support for non-x86
architectures.
Some of the key changes that would be needed in libvirt to manage
guests on qemu-system-ppc64 'pseries' platform would be as follows:
1) A new driver would be needed for PowerPC CPU, to identify and filter
supported PowerPC-CPU families.
2) A new set of interfaces would be needed to extract host system and
firmware information (SMBIOS and host-OS information like CPU and
memory topology, processor type, hardware threads, etc).
3) Clean abstraction of platform-specific references such as ACPI
dependencies from generic domain initialization sequence. (Many
such options get automatically selected by libvirt, unless they are
explicitly flagged as unrequired in XML. This default list will
differ for every architecture).
4) A mechanism to specify the list of allowable devices for every
architecture -- the 'pseries' vm would boot with its own set of
devices, some of which may not be available with x86.
In order to address the above requirements, we could take one of the
following implementation schemes:
Approach 1:
-----------
Create a new host backend for powerpc-kvm -- similar to xen, kvm, esx,
etc.
Advantage :
Even if the qemu device model on ppc varies significantly, the
difference between the device model between qemu-system-ppc64 and
qemu-system-x86_64 can be easily managed.
It could possibly allow easier ways of segregating supported devices,
and also specifying a new set of methods to gather host system
information.
Drawback:
- Overhead of maintaining a new backend, which is expected to have
some similarities with the x86-specific 'KVM' backend.
- Might get confusing for end users.
Approach 2:
-----------
Hack the present 'kvm' backend to add powerpc-specific features.
Advantage:
Having a seamless 'kvm' interface across architectures would be of
more convenience to the end-user -- a single XML spec could work
with only a small subset of arch-specific changes. Also, newer
features that come in for one arch would be more easily ported to
others. However, it would entail more run-time switches based on
the host kvm architecture.
One way to do this would be to add a new arch-specific layer within
the 'kvm' backend. This would be compiled-in depending on the host
architecture, and would expose only those features (system
information, devices, features etc) which are implemented in kvm
_on_that_platform_.
Drawback:
This will cause some rewriting of how internal qemu/kvm interfaces
interact in libvirt.
The attached patch series (albeit hackish in nature) attempts to
illustrate the difference in the architecture and call out parts of the
libvirt code that would need changes.
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
13 years, 1 month