[libvirt] [PATCH] virsh: adjust remaining format strings to avoid emitting trailing space
by Jim Meyering
This may help avoid testing churn and makes the format strings more uniform.
This is identical to yesterday's change,
http://git.et.redhat.com/?p=libvirt.git;a=commitdiff;h=b285e110625
but applies the same idea to all of the format strings.
>From 2a837515b419cadd1943b3078e5d7b3b116e42ef Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 3 Mar 2009 13:28:39 +0100
Subject: [PATCH] virsh: adjust remaining format strings to avoid emitting trailing space
* src/virsh.c (cmdNetworkList, cmdPoolList, cmdVolList): Change
format strings like "%-20s\n" to "%s\n".
---
src/virsh.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/virsh.c b/src/virsh.c
index 6a257ca..9f143a0 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -2640,7 +2640,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
else
autostartStr = autostart ? "yes" : "no";
- vshPrint(ctl, "%-20s %-10s %-10s\n",
+ vshPrint(ctl, "%-20s %-10s %s\n",
virNetworkGetName(network),
_("active"),
autostartStr);
@@ -3370,7 +3370,8 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
}
}
- vshPrintExtra(ctl, "%-20s %-10s %-10s\n", _("Name"), _("State"), _("Autostart"));
+ vshPrintExtra(ctl, "%-20s %-10s %s\n",
+ _("Name"), _("State"), _("Autostart"));
vshPrintExtra(ctl, "-----------------------------------------\n");
for (i = 0; i < maxactive; i++) {
@@ -3389,7 +3390,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
else
autostartStr = autostart ? "yes" : "no";
- vshPrint(ctl, "%-20s %-10s %-10s\n",
+ vshPrint(ctl, "%-20s %-10s %s\n",
virStoragePoolGetName(pool),
_("active"),
autostartStr);
@@ -3412,7 +3413,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
else
autostartStr = autostart ? "yes" : "no";
- vshPrint(ctl, "%-20s %-10s %-10s\n",
+ vshPrint(ctl, "%-20s %-10s %s\n",
inactiveNames[i],
_("inactive"),
autostartStr);
@@ -4155,7 +4156,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&activeNames[0], maxactive, sizeof(char *), namesorter);
}
- vshPrintExtra(ctl, "%-20s %-40s\n", _("Name"), _("Path"));
+ vshPrintExtra(ctl, "%-20s %s\n", _("Name"), _("Path"));
vshPrintExtra(ctl, "-----------------------------------------\n");
for (i = 0; i < maxactive; i++) {
@@ -4174,7 +4175,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
}
- vshPrint(ctl, "%-20s %-40s\n",
+ vshPrint(ctl, "%-20s %s\n",
virStorageVolGetName(vol),
path);
free(path);
--
1.6.2.rc1.285.gc5f54
15 years, 8 months
[libvirt] [PATCH] don't leak a file descriptor on failed pciGetDevice call
by Jim Meyering
This loop would mistakenly return early (skipping the closedir)
upon pciGetDevice failure.
>From 2d4d1d25edf8f1c3f4770707215bba67d73fd59f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 3 Mar 2009 11:11:07 +0100
Subject: [PATCH] don't leak a file descriptor on failed pciGetDevice call
* src/pci.c (pciIterDevices): Always close dir handle.
---
src/pci.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/pci.c b/src/pci.c
index 2343be3..501c6aa 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -233,6 +233,7 @@ pciIterDevices(virConnectPtr conn,
{
DIR *dir;
struct dirent *entry;
+ int ret = 0;
*matched = NULL;
@@ -252,14 +253,17 @@ pciIterDevices(virConnectPtr conn,
if (entry->d_name[0] == '.')
continue;
- if (sscanf(entry->d_name, "%x:%x:%x.%x", &domain, &bus, &slot, &function) < 4) {
+ if (sscanf(entry->d_name, "%x:%x:%x.%x",
+ &domain, &bus, &slot, &function) < 4) {
VIR_WARN("Unusual entry in " PCI_SYSFS "devices: %s", entry->d_name);
continue;
}
try = pciGetDevice(conn, domain, bus, slot, function);
- if (!try)
- return -1;
+ if (!try) {
+ ret = -1;
+ break;
+ }
if (predicate(try, dev)) {
VIR_DEBUG("%s %s: iter matched on %s", dev->id, dev->name, try->name);
@@ -269,7 +273,7 @@ pciIterDevices(virConnectPtr conn,
pciFreeDevice(conn, try);
}
closedir(dir);
- return 0;
+ return ret;
}
static uint8_t
@@ -823,7 +827,7 @@ void
pciFreeDevice(virConnectPtr conn ATTRIBUTE_UNUSED, pciDevice *dev)
{
VIR_DEBUG("%s %s: freeing", dev->id, dev->name);
- if (dev->fd)
+ if (dev->fd >= 0)
close(dev->fd);
VIR_FREE(dev);
}
--
1.6.2.rc1.285.gc5f54
15 years, 8 months
[libvirt] PATCH: Remove qemudLog() macro, use logging.h instead
by Daniel P. Berrange
The qemudLog() macro just spews its messages to stderr. This patch changes
it to use the proper logging.h APIs, so the output channel is configurable
in the expected way.
Daniel
diff --git a/src/iptables.c b/src/iptables.c
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -45,8 +45,7 @@
#include "util.h"
#include "memory.h"
#include "virterror_internal.h"
-
-#define qemudLog(level, msg...) fprintf(stderr, msg)
+#include "logging.h"
enum {
ADD = 0,
@@ -101,7 +100,7 @@ notifyRulesUpdated(const char *table,
char ebuf[1024];
if (virRun(NULL, argv, NULL) < 0)
- qemudLog(QEMUD_WARN, _("Failed to run '%s %s': %s"),
+ VIR_WARN(_("Failed to run '%s %s': %s"),
LOKKIT_PATH, arg, virStrerror(errno, ebuf, sizeof ebuf));
}
@@ -149,8 +148,8 @@ notifyRulesRemoved(const char *table,
len = virFileReadAll(SYSCONF_DIR "/sysconfig/system-config-firewall",
MAX_FILE_LEN, &content);
if (len < 0) {
- qemudLog(QEMUD_WARN, "%s", _("Failed to read " SYSCONF_DIR
- "/sysconfig/system-config-firewall"));
+ VIR_WARN("%s", _("Failed to read " SYSCONF_DIR
+ "/sysconfig/system-config-firewall"));
return;
}
@@ -178,8 +177,8 @@ notifyRulesRemoved(const char *table,
write_error:;
char ebuf[1024];
- qemudLog(QEMUD_WARN, _("Failed to write to " SYSCONF_DIR
- "/sysconfig/system-config-firewall : %s"),
+ VIR_WARN(_("Failed to write to " SYSCONF_DIR
+ "/sysconfig/system-config-firewall : %s"),
virStrerror(errno, ebuf, sizeof ebuf));
if (f)
fclose(f);
@@ -244,13 +243,13 @@ iptRulesSave(iptRules *rules)
char ebuf[1024];
if ((err = virFileMakePath(rules->dir))) {
- qemudLog(QEMUD_WARN, _("Failed to create directory %s : %s"),
+ VIR_WARN(_("Failed to create directory %s : %s"),
rules->dir, virStrerror(err, ebuf, sizeof ebuf));
return;
}
if ((err = writeRules(rules->path, rules->rules, rules->nrules))) {
- qemudLog(QEMUD_WARN, _("Failed to saves iptables rules to %s : %s"),
+ VIR_WARN(_("Failed to saves iptables rules to %s : %s"),
rules->path, virStrerror(err, ebuf, sizeof ebuf));
return;
}
@@ -551,8 +550,7 @@ iptRulesReload(iptRules *rules)
rule->argv[rule->command_idx] = (char *) "--delete";
if (virRun(NULL, rule->argv, NULL) < 0)
- qemudLog(QEMUD_WARN,
- _("Failed to remove iptables rule '%s'"
+ VIR_WARN(_("Failed to remove iptables rule '%s'"
" from chain '%s' in table '%s': %s"),
rule->rule, rules->chain, rules->table,
virStrerror(errno, ebuf, sizeof ebuf));
@@ -562,8 +560,8 @@ iptRulesReload(iptRules *rules)
for (i = 0; i < rules->nrules; i++)
if (virRun(NULL, rules->rules[i].argv, NULL) < 0)
- qemudLog(QEMUD_WARN, _("Failed to add iptables rule '%s'"
- " to chain '%s' in table '%s': %s"),
+ VIR_WARN(_("Failed to add iptables rule '%s'"
+ " to chain '%s' in table '%s': %s"),
rules->rules[i].rule, rules->chain, rules->table,
virStrerror(errno, ebuf, sizeof ebuf));
}
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -47,6 +47,7 @@
#include "datatypes.h"
#include "xml.h"
#include "nodeinfo.h"
+#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -77,8 +78,6 @@ VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAI
"writeback");
-#define qemudLog(level, msg...) fprintf(stderr, msg)
-
int qemudLoadDriverConfig(struct qemud_driver *driver,
const char *filename) {
virConfPtr conf;
@@ -469,18 +468,16 @@ rewait:
if (errno == EINTR)
goto rewait;
- qemudLog(QEMUD_ERR,
- _("Unexpected exit status from qemu %d pid %lu"),
- WEXITSTATUS(status), (unsigned long)child);
+ VIR_ERROR(_("Unexpected exit status from qemu %d pid %lu"),
+ WEXITSTATUS(status), (unsigned long)child);
ret = -1;
}
/* Check & log unexpected exit status, but don't fail,
* as there's really no need to throw an error if we did
* actually read a valid version number above */
if (WEXITSTATUS(status) != 0) {
- qemudLog(QEMUD_WARN,
- _("Unexpected exit status '%d', qemu probably failed"),
- WEXITSTATUS(status));
+ VIR_ERROR(_("Unexpected exit status '%d', qemu probably failed"),
+ WEXITSTATUS(status));
}
return ret;
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -82,8 +82,6 @@
static int qemudShutdown(void);
-#define qemudLog(level, msg...) fprintf(stderr, msg)
-
static void qemuDriverLock(struct qemud_driver *driver)
{
virMutexLock(&driver->lock);
@@ -220,9 +218,9 @@ qemudAutostartConfigs(struct qemud_drive
int ret = qemudStartVMDaemon(conn, driver, vm, NULL, -1);
if (ret < 0) {
virErrorPtr err = virGetLastError();
- qemudLog(QEMUD_ERROR, _("Failed to autostart VM '%s': %s\n"),
- vm->def->name,
- err ? err->message : NULL);
+ VIR_ERROR(_("Failed to autostart VM '%s': %s\n"),
+ vm->def->name,
+ err ? err->message : NULL);
} else {
virDomainEventPtr event =
virDomainEventNewFromObj(vm,
@@ -306,8 +304,8 @@ qemudReconnectVMs(struct qemud_driver *d
if ((config = virDomainConfigFile(NULL,
driver->stateDir,
vm->def->name)) == NULL) {
- qemudLog(QEMUD_ERROR, _("Failed to read domain status for %s\n"),
- vm->def->name);
+ VIR_ERROR(_("Failed to read domain status for %s\n"),
+ vm->def->name);
goto next_error;
}
@@ -316,14 +314,14 @@ qemudReconnectVMs(struct qemud_driver *d
vm->newDef = vm->def;
vm->def = status->def;
} else {
- qemudLog(QEMUD_ERROR, _("Failed to parse domain status for %s\n"),
- vm->def->name);
+ VIR_ERROR(_("Failed to parse domain status for %s\n"),
+ vm->def->name);
goto next_error;
}
if ((rc = qemudOpenMonitor(NULL, driver, vm, status->monitorpath, 1)) != 0) {
- qemudLog(QEMUD_ERROR, _("Failed to reconnect monitor for %s: %d\n"),
- vm->def->name, rc);
+ VIR_ERROR(_("Failed to reconnect monitor for %s: %d\n"),
+ vm->def->name, rc);
goto next_error;
}
@@ -369,7 +367,7 @@ qemudStartup(void) {
return -1;
if (virMutexInit(&qemu_driver->lock) < 0) {
- qemudLog(QEMUD_ERROR, "%s", _("cannot initialize mutex"));
+ VIR_ERROR("%s", _("cannot initialize mutex"));
VIR_FREE(qemu_driver);
return -1;
}
@@ -422,8 +420,8 @@ qemudStartup(void) {
if (virFileMakePath(qemu_driver->stateDir) < 0) {
char ebuf[1024];
- qemudLog(QEMUD_ERROR, _("Failed to create state dir '%s': %s\n"),
- qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
+ VIR_ERROR(_("Failed to create state dir '%s': %s\n"),
+ qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
@@ -901,7 +899,7 @@ static int qemudWaitForMonitor(virConnec
"console", 3);
if (close(logfd) < 0) {
char ebuf[1024];
- qemudLog(QEMUD_WARN, _("Unable to close logfile: %s\n"),
+ VIR_WARN(_("Unable to close logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
}
@@ -1299,29 +1297,29 @@ static int qemudStartVMDaemon(virConnect
tmp = progenv;
while (*tmp) {
if (safewrite(vm->logfile, *tmp, strlen(*tmp)) < 0)
- qemudLog(QEMUD_WARN, _("Unable to write envv to logfile: %s\n"),
+ VIR_WARN(_("Unable to write envv to logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(vm->logfile, " ", 1) < 0)
- qemudLog(QEMUD_WARN, _("Unable to write envv to logfile: %s\n"),
+ VIR_WARN(_("Unable to write envv to logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
tmp = argv;
while (*tmp) {
if (safewrite(vm->logfile, *tmp, strlen(*tmp)) < 0)
- qemudLog(QEMUD_WARN, _("Unable to write argv to logfile: %s\n"),
+ VIR_WARN(_("Unable to write argv to logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
if (safewrite(vm->logfile, " ", 1) < 0)
- qemudLog(QEMUD_WARN, _("Unable to write argv to logfile: %s\n"),
+ VIR_WARN(_("Unable to write argv to logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
tmp++;
}
if (safewrite(vm->logfile, "\n", 1) < 0)
- qemudLog(QEMUD_WARN, _("Unable to write argv to logfile: %s\n"),
+ VIR_WARN(_("Unable to write argv to logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
if ((pos = lseek(vm->logfile, 0, SEEK_END)) < 0)
- qemudLog(QEMUD_WARN, _("Unable to seek to end of logfile: %s\n"),
+ VIR_WARN(_("Unable to seek to end of logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
for (i = 0 ; i < ntapfds ; i++)
@@ -1399,7 +1397,7 @@ static void qemudShutdownVMDaemon(virCon
if (!virDomainIsActive(vm))
return;
- qemudLog(QEMUD_DEBUG, _("Shutting down VM '%s'\n"), vm->def->name);
+ VIR_DEBUG(_("Shutting down VM '%s'\n"), vm->def->name);
if (virKillProcess(vm->pid, 0) == 0 &&
virKillProcess(vm->pid, SIGTERM) < 0)
@@ -1414,7 +1412,7 @@ static void qemudShutdownVMDaemon(virCon
if (close(vm->logfile) < 0) {
char ebuf[1024];
- qemudLog(QEMUD_WARN, _("Unable to close logfile: %s\n"),
+ VIR_WARN(_("Unable to close logfile: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
}
if (vm->monitor != -1)
@@ -1426,7 +1424,7 @@ static void qemudShutdownVMDaemon(virCon
virKillProcess(vm->pid, SIGKILL);
if (qemudRemoveDomainStatus(conn, driver, vm) < 0) {
- qemudLog(QEMUD_WARN, _("Failed to remove domain status for %s"),
+ VIR_WARN(_("Failed to remove domain status for %s"),
vm->def->name);
}
vm->pid = -1;
@@ -1473,8 +1471,8 @@ qemudDispatchVMEvent(int watch, int fd,
if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR))
quit = 1;
else {
- qemudLog(QEMUD_ERROR, _("unhandled fd event %d for %s"),
- events, vm->def->name);
+ VIR_ERROR(_("unhandled fd event %d for %s"),
+ events, vm->def->name);
failed = 1;
}
}
@@ -1587,7 +1585,7 @@ qemudMonitorCommandExtra(const virDomain
/* Log, but ignore failures to write logfile for VM */
if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
char ebuf[1024];
- qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s\n"),
+ VIR_WARN(_("Unable to log VM console data: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
}
@@ -1599,7 +1597,7 @@ qemudMonitorCommandExtra(const virDomain
/* Log, but ignore failures to write logfile for VM */
if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
char ebuf[1024];
- qemudLog(QEMUD_WARN, _("Unable to log VM console data: %s\n"),
+ VIR_WARN(_("Unable to log VM console data: %s\n"),
virStrerror(errno, ebuf, sizeof ebuf));
}
VIR_FREE(buf);
@@ -3380,7 +3378,7 @@ static int qemudDomainAttachPciDiskDevic
s += strlen(PCI_ATTACH_OK_MSG);
if (virStrToLong_i ((const char*)s, &dummy, 10, &dev->data.disk->slotnum) == -1)
- qemudLog(QEMUD_WARN, "%s", _("Unable to parse slot number\n"));
+ VIR_WARN("%s", _("Unable to parse slot number\n"));
} else {
qemudReportError (conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
_("adding %s disk failed"), type);
@@ -4512,8 +4510,8 @@ cleanup:
* overwrite the previous error, though, so we just throw something
* to the logs and hope for the best
*/
- qemudLog(QEMUD_ERROR, _("Failed to resume guest %s after failure\n"),
- vm->def->name);
+ VIR_ERROR(_("Failed to resume guest %s after failure\n"),
+ vm->def->name);
}
else {
DEBUG ("cont reply: %s", info);
diff --git a/src/uuid.c b/src/uuid.c
--- a/src/uuid.c
+++ b/src/uuid.c
@@ -37,8 +37,7 @@
#include "internal.h"
#include "util.h"
#include "virterror_internal.h"
-
-#define qemudLog(level, msg...) fprintf(stderr, msg)
+#include "logging.h"
#ifndef ENODATA
#define ENODATA EIO
@@ -102,8 +101,7 @@ virUUIDGenerate(unsigned char *uuid)
if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) {
char ebuf[1024];
- qemudLog(QEMUD_WARN,
- _("Falling back to pseudorandom UUID,"
+ VIR_WARN(_("Falling back to pseudorandom UUID,"
" failed to generate random bytes: %s"),
virStrerror(err, ebuf, sizeof ebuf));
}
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 8 months
[libvirt] tls_allowed_ip_list?
by Chris Lalancette
All,
While doing testing on TLS, I came across the mention of
"tls_allowed_ip_list" in the website documentation, here:
http://libvirt.org/remote.html#Remote_libvirtd_configuration
However, I don't see any implementation of the tls_allowed_ip_list in libvirt
itself; a grep through the sources show that we are implementing
"tls_allowed_dn_list", but not "tls_allowed_ip_list". Am I missing something in
the sources? Should we update the libvirt.org documentation and remove that
(seemingly non-existent) parameter? Or should I go in and implement the
"tls_allowed_ip_list"?
--
Chris Lalancette
15 years, 8 months
[libvirt] [PATCH]: Fix qemu+tls negotiation
by Chris Lalancette
All,
While doing testing on the migration stuff, I noticed that a connection
string using tls (in my case, qemu+tls://host/system) was hanging up trying to
connect. I traced this down to a bug in the newer qemud negotiation
implementation. What is happening is that we are forgetting to clear
client->handshake to 0 after successfully doing a remoteAccessCheck(); this
means we were never putting the '\1' byte on the transmit queue to be sent to
the client, so the client was essentially waiting forever for the server to
respond. Fix this by clearing the handshake once we've successfully done the
handshake.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
15 years, 8 months
[libvirt] new test failure: QEMU XML-2-ARGV hostdev-pci-address
by Jim Meyering
FYI, at least on my Fedora 10 system, "make check" gets one failure:
52) QEMU XML-2-ARGV hostdev-pci-address ... Failed
to open file '/sys/bus/pci/devices/0000:06:12.5/vendor': No such file or directory
Failed to open file '/sys/bus/pci/devices/0000:06:12.5/device': No such file or directory
libvir: error : this function is not supported by the hypervisor: Failed to read product/vendor ID for 0000:06:12.5
FAILED
It's true, the containing directory doesn't exist:
$ ls -1 /sys/bus/pci/devices/0000*
/sys/bus/pci/devices/0000:00:00.0@
/sys/bus/pci/devices/0000:00:02.0@
/sys/bus/pci/devices/0000:00:02.1@
/sys/bus/pci/devices/0000:00:03.0@
/sys/bus/pci/devices/0000:00:19.0@
/sys/bus/pci/devices/0000:00:1a.0@
/sys/bus/pci/devices/0000:00:1a.1@
/sys/bus/pci/devices/0000:00:1a.2@
/sys/bus/pci/devices/0000:00:1a.7@
/sys/bus/pci/devices/0000:00:1b.0@
/sys/bus/pci/devices/0000:00:1c.0@
/sys/bus/pci/devices/0000:00:1c.1@
/sys/bus/pci/devices/0000:00:1c.2@
/sys/bus/pci/devices/0000:00:1c.3@
/sys/bus/pci/devices/0000:00:1c.4@
/sys/bus/pci/devices/0000:00:1d.0@
/sys/bus/pci/devices/0000:00:1d.1@
/sys/bus/pci/devices/0000:00:1d.2@
/sys/bus/pci/devices/0000:00:1d.7@
/sys/bus/pci/devices/0000:00:1e.0@
/sys/bus/pci/devices/0000:00:1f.0@
/sys/bus/pci/devices/0000:00:1f.2@
/sys/bus/pci/devices/0000:00:1f.3@
/sys/bus/pci/devices/0000:03:00.0@
/sys/bus/pci/devices/0000:06:00.0@
/sys/bus/pci/devices/0000:06:03.0@
$ readlink /sys/bus/pci/devices/0000:00:1c.4
../../../devices/pci0000:00/0000:00:1c.4
I'll look into it in about 30 minutes.
15 years, 8 months
[libvirt] tweak a format string and add a test
by Jim Meyering
I'm about to commit these (like what I already posted,
but now the test kills libvirtd):
>From 944052f2287f1a07034be16ea08d620c55eecd6e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 2 Mar 2009 14:46:20 +0100
Subject: [PATCH 1/2] virsh: tweak a format string to avoid emitting trailing space
* src/virsh.c (cmdNetworkList): Change format not to right-pad
with spaces, as that would have required a trailing blank in
an expected output file.
---
src/virsh.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/virsh.c b/src/virsh.c
index 8ae79c5..c23fdda 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -2596,7 +2596,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&inactiveNames[0], maxinactive, sizeof(char*), namesorter);
}
}
- vshPrintExtra(ctl, "%-20s %-10s %-10s\n", _("Name"), _("State"), _("Autostart"));
+ vshPrintExtra(ctl, "%-20s %-10s %s\n", _("Name"), _("State"), _("Autostart"));
vshPrintExtra(ctl, "-----------------------------------------\n");
for (i = 0; i < maxactive; i++) {
--
1.6.2.rc1.285.gc5f54
>From dfeac0d70dce4a84ee5d70553ec3929bdbeab0c4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 2 Mar 2009 14:32:59 +0100
Subject: [PATCH 2/2] tests: test for a recent fix
* tests/libvirtd-net-persist: New file. Test for the
"Mark defined networks as persistent" fix.
* tests/Makefile.am (test_scripts): Add it.
---
tests/Makefile.am | 1 +
tests/libvirtd-net-persist | 58 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100755 tests/libvirtd-net-persist
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bec4f60..7479e03 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -81,6 +81,7 @@ test_scripts += \
daemon-conf \
define-dev-segfault \
int-overflow \
+ libvirtd-net-persist \
read-bufsiz \
read-non-seekable \
start \
diff --git a/tests/libvirtd-net-persist b/tests/libvirtd-net-persist
new file mode 100755
index 0000000..50a1ef4
--- /dev/null
+++ b/tests/libvirtd-net-persist
@@ -0,0 +1,58 @@
+#!/bin/sh
+# ensure that net-destroy doesn't make network disappear (persistence-related)
+
+if test "$VERBOSE" = yes; then
+ set -x
+ libvirtd --version
+ virsh --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+pwd=$(pwd) || fail=1
+sock_dir="$pwd"
+cat > conf <<EOF || fail=1
+unix_sock_dir = "$sock_dir"
+log_outputs = "3:file:$pwd/log"
+EOF
+
+cat > net.xml <<EOF || fail=1
+<network>
+ <name>N</name>
+ <ip address="192.168.199.1" netmask="255.255.255.0"></ip>
+</network>
+EOF
+
+cat > exp <<EOF || fail=1
+Network N defined from net.xml
+
+Network N destroyed
+
+Name State Autostart
+-----------------------------------------
+N inactive no
+
+EOF
+
+libvirtd --config=conf > libvirtd-log 2>&1 & pid=$!
+sleep 1
+
+url="qemu:///session?socket=@$sock_dir/libvirt-sock"
+virsh -c "$url" \
+ 'net-define net.xml; net-destroy N; net-list --all' > out 2>&1 \
+ || fail=1
+
+# if libvird's log is empty, sleep for a second before killing it
+test -s libvirtd-log || sleep 1
+kill $pid
+
+compare exp out || fail=1
+
+printf "Shutting down network 'N'\n" > log-exp
+compare log-exp libvirtd-log || fail=1
+
+exit $fail
--
1.6.2.rc1.285.gc5f54
15 years, 9 months
[libvirt] [PATCH 1..2] make a test more robust, and add two more
by Jim Meyering
Here's a rebased patch from a month or two ago.
It's only fixing and adding tests, so I'll commit it momentarily.
Dan Berrange noticed that daemon-conf could interfere with
existing domains, so the latter patch below makes it use the
new log-setting and unix_sock_dir-setting config options as
well as the option to select a per-test PID file.
>From efee209a2adf6f2478de26fe25c73bd4c38316ea Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 8 Jan 2009 20:18:17 +0100
Subject: [PATCH 1/2] add two tests
* tests/libvirtd-pool: New file.
Exercise the new unix_sock_dir option
* tests/libvirtd-fail: New file.
* tests/Makefile.am (test_scripts): Add libvirtd-fail and libvirtd-pool.
*** empty log message ***
---
tests/Makefile.am | 2 +
tests/libvirtd-fail | 21 +++++++++++++++++
tests/libvirtd-pool | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 0 deletions(-)
create mode 100755 tests/libvirtd-fail
create mode 100755 tests/libvirtd-pool
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b40785f..11ffe76 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -81,7 +81,9 @@ test_scripts += \
daemon-conf \
define-dev-segfault \
int-overflow \
+ libvirtd-fail \
libvirtd-net-persist \
+ libvirtd-pool \
read-bufsiz \
read-non-seekable \
start \
diff --git a/tests/libvirtd-fail b/tests/libvirtd-fail
new file mode 100755
index 0000000..92b82c4
--- /dev/null
+++ b/tests/libvirtd-fail
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Ensure that libvirt fails when given nonexistent --config=FILE
+
+if test "$VERBOSE" = yes; then
+ set -x
+ libvirtd --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+libvirtd --config=no-such-file > log 2>&1 && fail=1
+cat <<\EOF > exp
+Failed to open file 'no-such-file': No such file or directory
+EOF
+
+compare exp log || fail=1
+exit $fail
diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
new file mode 100755
index 0000000..370f3b1
--- /dev/null
+++ b/tests/libvirtd-pool
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Get coverage of libvirtd's config-parsing code.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ libvirtd --version
+ virsh --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+pwd=$(pwd) || fail=1
+sock_dir="$pwd"
+cat > conf <<EOF || fail=1
+unix_sock_dir = "$sock_dir"
+log_outputs = "3:file:$pwd/log"
+EOF
+
+libvirtd --config=conf > libvirtd-log 2>&1 & pid=$!
+sleep 1
+
+url="qemu:///session?socket=@$sock_dir/libvirt-sock"
+virsh --connect "$url" \
+ pool-define-as P dir src-host /src/path /src/dev S /target-path > out 2>&1 \
+ || fail=1
+virsh --connect "$url" pool-dumpxml P >> out 2>&1 || fail=1
+
+# remove random uuid
+sed 's/<uuid>.*/-/' out > k && mv k out || fail=1
+
+kill $pid
+
+cat <<EOF > pool-list-exp
+Pool P defined
+
+<pool type='dir'>
+ <name>P</name>
+ -
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ </source>
+ <target>
+ <path>/target-path</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>500</owner>
+ <group>500</group>
+ </permissions>
+ </target>
+</pool>
+
+EOF
+
+compare pool-list-exp out || fail=1
+compare /dev/null libvirtd-log || fail=1
+
+exit $fail
--
1.6.2.rc1.285.gc5f54
>From e94ab9fcb3e5e1c180308d638956cfc05078df1e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 13 Jan 2009 10:54:41 +0100
Subject: [PATCH 2/2] tests: further isolate a test that runs libvirtd
* tests/daemon-conf: Specify a non-default socket directory.
Specify test-specific log directory and pid file, too.
---
tests/daemon-conf | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/tests/daemon-conf b/tests/daemon-conf
index 7a53eff..a5e86ae 100755
--- a/tests/daemon-conf
+++ b/tests/daemon-conf
@@ -67,8 +67,18 @@ done
# Run with the unmodified config file.
sleep_secs=2
+
+# Be careful to specify a non-default socket directory:
+sed 's,^unix_sock_dir.*,unix_sock_dir="'"$(pwd)"'",' tmp.conf > k || fail=1
+mv k tmp.conf || fail=1
+
+# Also, specify a test-specific log directory:
+sed 's,^log_outputs.*,log_outputs="3:file:'"$(pwd)/log"'",' tmp.conf > k \
+ || fail=1
+mv k tmp.conf || fail=1
+
printf "running libvirtd with a valid config file ($sleep_secs seconds)\n" 1>&2
-libvirtd --config=tmp.conf > log 2>&1 & pid=$!
+libvirtd --pid-file=pid-file --config=tmp.conf > log 2>&1 & pid=$!
sleep $sleep_secs
kill $pid
--
1.6.2.rc1.285.gc5f54
15 years, 9 months
[libvirt] [PATCH] Don't log qemu monitor output from blockStats
by Cole Robinson
The attached patch changes the qemu driver blockStats command to not log
qemu monitor output. virt-manager offers an option to continually poll
VM disk stats, and if the app is left running for a while with many VMs,
this can make the logs huge, for little benefit (a user reported 100 MB
with virt-manager left running overnight).
The output from the command is still printed with a DEBUG call, so the
info isn't completely lost.
Thanks,
Cole
15 years, 9 months
[libvirt] PATCH: Add two missing symbol exports
by Daniel P. Berrange
If building with --with-driver-modules, the Xen and OpenVZ drivers fail to
dlopen() because of a couple of missing symbol exports. THis patch adds
them
Daniel
Index: src/libvirt_private.syms
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt_private.syms,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 libvirt_private.syms
--- src/libvirt_private.syms 2 Mar 2009 17:39:43 -0000 1.23
+++ src/libvirt_private.syms 2 Mar 2009 18:23:07 -0000
@@ -26,6 +26,7 @@ virCapabilitiesFormatXML;
virCapabilitiesFree;
virCapabilitiesNew;
virCapabilitiesSetMacPrefix;
+virCapabilitiesGenerateMac;
# conf.h
@@ -47,6 +48,7 @@ virGetStoragePool;
virGetStorageVol;
virGetNodeDevice;
virUnrefDomain;
+virUnrefConnect;
# domain_conf.h
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 9 months