[libvirt] [PATCHv4 3/3] sysinfo: delete unnecessary white space of sysinfo.
by Minoru Usui
sysinfo: delete unnecessary white space of sysinfo.
* Trim each element and delete null entry of sysinfo by virSkipSpacesBackwards().
This patch is rebased to following Eric's patches.
Eric's 1/3, 2/3 patches do not change.
http://www.spinics.net/linux/fedora/libvir/msg41063.html
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/util/sysinfo.c | 63 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index f4edde9..2d38145 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -244,77 +244,88 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Socket Designation: ")) != NULL) {
cur += 20;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_socket_destination = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Type: ")) != NULL) {
cur += 6;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_type = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Family: ")) != NULL) {
cur += 8;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_family = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_manufacturer = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Signature: ")) != NULL) {
cur += 11;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_signature = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Version: ")) != NULL) {
cur += 9;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_version = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "External Clock: ")) != NULL) {
cur += 16;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_external_clock = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Max Speed: ")) != NULL) {
cur += 11;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_max_speed = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Status: ")) != NULL) {
cur += 8;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_status = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Serial Number: ")) != NULL) {
cur += 15;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_serial_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Part Number: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((processor->processor_part_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
@@ -349,70 +360,80 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if (STREQLEN(cur, "No Module Installed", eol - cur))
goto next;
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_size = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Form Factor: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_form_factor = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Locator: ")) != NULL) {
cur += 9;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_locator = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Bank Locator: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_bank_locator = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Type: ")) != NULL) {
cur += 6;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_type = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Type Detail: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_type_detail = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Speed: ")) != NULL) {
cur += 7;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_speed = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_manufacturer = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Serial Number: ")) != NULL) {
cur += 15;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_serial_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
if ((cur = strstr(base, "Part Number: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
- if ((eol) &&
+ virSkipSpacesBackwards(cur, &eol);
+ if ((eol != cur) &&
((memory->memory_part_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
--
1.7.1
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 4 months
[libvirt] [V2 Patch] virsh: Change log level order
by Supriya Kannery
Change log level order so that messages at all other levels get logged
for "DEBUG" level. Replace magic numbers with corresponding VSH_ERR_xx.
Signed-off-by: Supriya Kannery <supriyak(a)in.ibm.com>
---
tools/virsh.c | 119
++++++++++++++++++++++++++++++++--------------------------
1 file changed, 67 insertions(+), 52 deletions(-)
Index: libvirt/tools/virsh.c
===================================================================
--- libvirt.orig/tools/virsh.c
+++ libvirt/tools/virsh.c
@@ -91,11 +91,11 @@ static char *progname;
* Indicates the level of a log message
*/
typedef enum {
- VSH_ERR_DEBUG = 0,
- VSH_ERR_INFO,
- VSH_ERR_NOTICE,
+ VSH_ERR_ERROR = 0,
VSH_ERR_WARNING,
- VSH_ERR_ERROR
+ VSH_ERR_NOTICE,
+ VSH_ERR_INFO,
+ VSH_ERR_DEBUG
} vshErrorLevel;
/*
@@ -2146,7 +2146,8 @@ cmdDominfo(vshControl *ctl, const vshCmd
/* Check and display whether the domain is persistent or not */
persistent = virDomainIsPersistent(dom);
- vshDebug(ctl, 5, "Domain persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Domain persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else
@@ -2928,7 +2929,7 @@ cmdSetvcpus(vshControl *ctl, const vshCm
/* If the --maximum flag was given, we need to ensure only the
--config flag is in effect as well */
if (maximum) {
- vshDebug(ctl, 5, "--maximum flag was given\n");
+ vshDebug(ctl, VSH_ERR_DEBUG, "--maximum flag was given\n");
/* If neither the --config nor --live flags were given, OR
if just the --live flag was given, we need to error out
@@ -4020,7 +4021,7 @@ repoll:
if ( timeout && ((int)(curr.tv_sec - start.tv_sec) * 1000 + \
(int)(curr.tv_usec - start.tv_usec) / 1000) >
timeout * 1000 ) {
/* suspend the domain when migration timeouts. */
- vshDebug(ctl, 5, "suspend the domain when migration
timeouts\n");
+ vshDebug(ctl, VSH_ERR_DEBUG, "suspend the domain when
migration timeouts\n");
virDomainSuspend(dom);
timeout = 0;
}
@@ -6125,7 +6126,8 @@ cmdPoolList(vshControl *ctl, const vshCm
/* Retrieve the persistence status of the pool */
if (details) {
persistent = virStoragePoolIsPersistent(pool);
- vshDebug(ctl, 5, "Persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
poolInfoTexts[i].persistent = vshStrdup(ctl,
_("unknown"));
else
@@ -6316,19 +6318,19 @@ cmdPoolList(vshControl *ctl, const vshCm
availStrLength = stringLength;
/* Display the string lengths for debugging. */
- vshDebug(ctl, 5, "Longest name string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest name string = %lu chars\n",
(unsigned long) nameStrLength);
- vshDebug(ctl, 5, "Longest state string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest state string = %lu chars\n",
(unsigned long) stateStrLength);
- vshDebug(ctl, 5, "Longest autostart string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest autostart string = %lu chars\n",
(unsigned long) autostartStrLength);
- vshDebug(ctl, 5, "Longest persistent string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest persistent string = %lu chars\n",
(unsigned long) persistStrLength);
- vshDebug(ctl, 5, "Longest capacity string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest capacity string = %lu chars\n",
(unsigned long) capStrLength);
- vshDebug(ctl, 5, "Longest allocation string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest allocation string = %lu chars\n",
(unsigned long) allocStrLength);
- vshDebug(ctl, 5, "Longest available string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest available string = %lu chars\n",
(unsigned long) availStrLength);
/* Create the output template. Each column is sized according to
@@ -6600,7 +6602,8 @@ cmdPoolInfo(vshControl *ctl, const vshCm
/* Check and display whether the pool is persistent or not */
persistent = virStoragePoolIsPersistent(pool);
- vshDebug(ctl, 5, "Pool persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Pool persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else
@@ -6608,7 +6611,7 @@ cmdPoolInfo(vshControl *ctl, const vshCm
/* Check and display whether the pool is autostarted or not */
virStoragePoolGetAutostart(pool, &autostart);
- vshDebug(ctl, 5, "Pool autostart flag value: %d\n", autostart);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Pool autostart flag value: %d\n",
autostart);
if (autostart < 0)
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no
autostart"));
else
@@ -6806,31 +6809,37 @@ cmdVolCreateAs(vshControl *ctl, const vs
if (snapshotStrVol) {
/* Lookup snapshot backing volume. Try the backing-vol
* parameter as a name */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as name\n",
cmd->def->name, snapshotStrVol);
virStorageVolPtr snapVol = virStorageVolLookupByName(pool,
snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
name\n",
cmd->def->name, snapshotStrVol);
if (snapVol == NULL) {
/* Snapshot backing volume not found by name. Try the
* backing-vol parameter as a key */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as
key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as key\n",
cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByKey(ctl->conn, snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
key\n",
cmd->def->name, snapshotStrVol);
}
if (snapVol == NULL) {
/* Snapshot backing volume not found by key. Try the
* backing-vol parameter as a path */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as
path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as path\n",
cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByPath(ctl->conn,
snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
path\n",
cmd->def->name, snapshotStrVol);
}
if (snapVol == NULL) {
@@ -7777,11 +7786,16 @@ cmdVolList(vshControl *ctl, const vshCmd
allocStrLength = stringLength;
/* Display the string lengths for debugging */
- vshDebug(ctl, 5, "Longest name string = %zu chars\n", nameStrLength);
- vshDebug(ctl, 5, "Longest path string = %zu chars\n", pathStrLength);
- vshDebug(ctl, 5, "Longest type string = %zu chars\n", typeStrLength);
- vshDebug(ctl, 5, "Longest capacity string = %zu chars\n",
capStrLength);
- vshDebug(ctl, 5, "Longest allocation string = %zu chars\n",
allocStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest name string = %zu chars\n", nameStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest path string = %zu chars\n", pathStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest type string = %zu chars\n", typeStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest capacity string = %zu chars\n", capStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest allocation string = %zu chars\n", allocStrLength);
/* Create the output template */
ret = virAsprintf(&outputStr,
@@ -11535,7 +11549,7 @@ vshCommandOptDomainBy(vshControl *ctl, c
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11544,20 +11558,20 @@ vshCommandOptDomainBy(vshControl *ctl, c
/* try it by ID */
if (flag & VSH_BYID) {
if (virStrToLong_i(n, NULL, 10, &id) == 0 && id >= 0) {
- vshDebug(ctl, 5, "%s: <%s> seems like domain ID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> seems like domain ID\n",
cmd->def->name, optname);
dom = virDomainLookupByID(ctl->conn, id);
}
}
/* try it by UUID */
if (dom==NULL && (flag & VSH_BYUUID) &&
strlen(n)==VIR_UUID_STRING_BUFLEN-1) {
- vshDebug(ctl, 5, "%s: <%s> trying as domain UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain UUID\n",
cmd->def->name, optname);
dom = virDomainLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (dom==NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as domain NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain NAME\n",
cmd->def->name, optname);
dom = virDomainLookupByName(ctl->conn, n);
}
@@ -11581,7 +11595,7 @@ vshCommandOptNetworkBy(vshControl *ctl,
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11589,13 +11603,13 @@ vshCommandOptNetworkBy(vshControl *ctl,
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as network UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n",
cmd->def->name, optname);
network = virNetworkLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (network==NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as network NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME\n",
cmd->def->name, optname);
network = virNetworkLookupByName(ctl->conn, n);
}
@@ -11620,7 +11634,7 @@ vshCommandOptNWFilterBy(vshControl *ctl,
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11628,13 +11642,13 @@ vshCommandOptNWFilterBy(vshControl *ctl,
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as nwfilter UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter UUID\n",
cmd->def->name, optname);
nwfilter = virNWFilterLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (nwfilter == NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as nwfilter NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter NAME\n",
cmd->def->name, optname);
nwfilter = virNWFilterLookupByName(ctl->conn, n);
}
@@ -11658,7 +11672,7 @@ vshCommandOptInterfaceBy(vshControl *ctl
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11666,13 +11680,13 @@ vshCommandOptInterfaceBy(vshControl *ctl
/* try it by NAME */
if ((flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface NAME\n",
cmd->def->name, optname);
iface = virInterfaceLookupByName(ctl->conn, n);
}
/* try it by MAC */
if ((iface == NULL) && (flag & VSH_BYMAC)) {
- vshDebug(ctl, 5, "%s: <%s> trying as interface MAC\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC\n",
cmd->def->name, optname);
iface = virInterfaceLookupByMACString(ctl->conn, n);
}
@@ -11693,7 +11707,7 @@ vshCommandOptPoolBy(vshControl *ctl, con
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11701,13 +11715,13 @@ vshCommandOptPoolBy(vshControl *ctl, con
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as pool UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool UUID\n",
cmd->def->name, optname);
pool = virStoragePoolLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (pool == NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as pool NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool NAME\n",
cmd->def->name, optname);
pool = virStoragePoolLookupByName(ctl->conn, n);
}
@@ -11739,7 +11753,7 @@ vshCommandOptVolBy(vshControl *ctl, cons
if (p)
pool = vshCommandOptPoolBy(ctl, cmd, pooloptname, name, flag);
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11747,19 +11761,19 @@ vshCommandOptVolBy(vshControl *ctl, cons
/* try it by name */
if (pool && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol name\n",
cmd->def->name, optname);
vol = virStorageVolLookupByName(pool, n);
}
/* try it by key */
if (vol == NULL && (flag & VSH_BYUUID)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol key\n",
cmd->def->name, optname);
vol = virStorageVolLookupByKey(ctl->conn, n);
}
/* try it by path */
if (vol == NULL && (flag & VSH_BYUUID)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol path\n",
cmd->def->name, optname);
vol = virStorageVolLookupByPath(ctl->conn, n);
}
@@ -11786,7 +11800,8 @@ vshCommandOptSecret(vshControl *ctl, con
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n", cmd->def->name,
optname, n);
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
+ cmd->def->name, optname, n);
if (name != NULL)
*name = n;
@@ -11991,7 +12006,7 @@ get_data:
last->next = arg;
last = arg;
- vshDebug(ctl, 4, "%s: %s(%s): %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: %s(%s): %s\n",
cmd->name,
opt->name,
opt->type != VSH_OT_BOOL ? _("optdata") :
_("bool"),
@@ -12416,7 +12431,7 @@ vshInit(vshControl *ctl)
debugEnv = getenv("VIRSH_DEBUG");
if (debugEnv) {
if (virStrToLong_i(debugEnv, NULL, 10, &ctl->debug) < 0 ||
- ctl->debug < VSH_ERR_DEBUG || ctl->debug > VSH_ERR_ERROR) {
+ ctl->debug > VSH_ERR_DEBUG || ctl->debug < VSH_ERR_ERROR) {
vshError(ctl, "%s",
_("VIRSH_DEBUG not set with a valid numeric
value"));
ctl->debug = VSH_ERR_DEBUG;
@@ -13088,7 +13103,7 @@ vshParseArgv(vshControl *ctl, int argc,
/* parse command */
ctl->imode = false;
if (argc - optind == 1) {
- vshDebug(ctl, 2, "commands: \"%s\"\n", argv[optind]);
+ vshDebug(ctl, VSH_ERR_NOTICE, "commands: \"%s\"\n",
argv[optind]);
return vshCommandStringParse(ctl, argv[optind]);
} else {
return vshCommandArgvParse(ctl, argc - optind, argv + optind);
13 years, 4 months
[libvirt] [PATCH] lock qemu_driver early in qemuGetSchedulerParametersFlags()
by Wen Congyang
If we pass VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG to
qemuGetSchedulerParametersFlags() or *nparams is less than 1,
we will unlock qemu_driver without locking it. It's very dangerous.
We should lock qemu_driver after calling virCheckFlags().
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 768e0f2..c6994cd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5832,6 +5832,8 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
+ qemuDriverLock(driver);
+
if ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) ==
(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
@@ -5845,7 +5847,6 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
goto cleanup;
}
- qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
--
1.7.1
13 years, 4 months
[libvirt] [PATCH] Fix memory leak in virDomainVcpuPinDel()
by Wen Congyang
virDomainVcpuPinDefFree() does not free def->cputune.vcpupin if nvcpupin
is 0, and does not set def->cputune.vcpupin to NULL.
If we set nvcpupin to 0 but do not free vcpupin, vcpupin will not be freed
when vm->def is freed.
Use VIR_FREE() instead of virDomainVcpuPinDefFree() to free the memory
and set def->cputune.vcpupint to NULL.
---
src/conf/domain_conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 60e0318..f9bf51e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8263,7 +8263,7 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
return 0;
if (--def->cputune.nvcpupin == 0) {
- virDomainVcpuPinDefFree(def->cputune.vcpupin, 0);
+ VIR_FREE(def->cputune.vcpupin);
} else {
if (VIR_REALLOC_N(def->cputune.vcpupin, def->cputune.nvcpupin) < 0) {
virReportOOMError();
--
1.7.1
13 years, 4 months
[libvirt] [PATCH] save domain status after modifing vcpupin
by Wen Congyang
We should save domain status after modifing vcpupin. If not,
we will get wrong vcpupin information after rebooting libvirtd.
---
src/qemu/qemu_driver.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8fcc266..768e0f2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3124,6 +3124,8 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
}
}
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ goto cleanup;
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
--
1.7.1
13 years, 4 months
[libvirt] sysinfo: delete unnecessary white space of sysinfo.
by Minoru Usui
sysinfo: delete unnecessary white space of sysinfo.
* Add virSkipSpacesBackwards() to src/util/util.[ch]
* Trim each element and delete null entry of sysinfo by virSkipSpacesBackwards().
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/util/sysinfo.c | 34 +++++++++++++++++++++++++---------
src/util/util.c | 27 +++++++++++++++++++++++++++
src/util/util.h | 1 +
3 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index bff1cb8..2ebd34c 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -238,6 +238,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Socket Designation: ")) != NULL) {
cur += 20;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_socket_destination = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -245,6 +246,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Type: ")) != NULL) {
cur += 6;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_type = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -252,6 +254,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Family: ")) != NULL) {
cur += 8;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_family = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -259,6 +262,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_manufacturer = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -266,6 +270,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Signature: ")) != NULL) {
cur += 11;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_signature = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -273,6 +278,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Version: ")) != NULL) {
cur += 9;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_version = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -280,6 +286,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "External Clock: ")) != NULL) {
cur += 16;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_external_clock = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -287,6 +294,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Max Speed: ")) != NULL) {
cur += 11;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_max_speed = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -294,6 +302,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Status: ")) != NULL) {
cur += 8;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_status = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -301,6 +310,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Serial Number: ")) != NULL) {
cur += 15;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_serial_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -308,12 +318,13 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Part Number: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((processor->processor_part_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
- base = eol + 1;
+ base += strlen("Processor Information");
}
return base;
@@ -342,6 +353,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if (STREQLEN(cur, "No Module Installed", eol - cur))
goto next;
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_size = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -349,6 +361,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Form Factor: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_form_factor = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -356,6 +369,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Locator: ")) != NULL) {
cur += 9;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_locator = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -363,6 +377,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Bank Locator: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_bank_locator = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -370,6 +385,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Type: ")) != NULL) {
cur += 6;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_type = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -377,6 +393,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Type Detail: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_type_detail = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -384,6 +401,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Speed: ")) != NULL) {
cur += 7;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_speed = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -391,6 +409,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_manufacturer = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -398,6 +417,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Serial Number: ")) != NULL) {
cur += 15;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_serial_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
@@ -405,13 +425,14 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
if ((cur = strstr(base, "Part Number: ")) != NULL) {
cur += 13;
eol = strchr(cur, '\n');
+ virSkipSpacesBackwards(cur, &eol);
if ((eol) &&
((memory->memory_part_number = strndup(cur, eol - cur)) == NULL))
goto no_memory;
}
next:
- base = eol + 1;
+ base += strlen("Memory Device");
}
return base;
diff --git a/src/util/util.c b/src/util/util.c
index 463d2b8..c5c1a89 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1550,6 +1550,33 @@ virSkipSpaces(const char **str)
}
/**
+ * virSkipSpacesBackwards:
+ * @str : pointer to the target strings
+ * @endp: pointer to the end of @str
+ *
+ * Skip potential blanks backwards.
+ */
+void
+virSkipSpacesBackwards(const char *str, char **endp)
+{
+ char *cur;
+
+ if (!endp || !*endp)
+ return;
+
+ cur = *endp - 1;
+ while (cur >= str) {
+ if ((*cur == ' ') || (*cur == '\t') || (*cur == '\n') ||
+ (*cur == '\r') || (*cur == '\\'))
+ cur--;
+ else
+ break;
+ }
+
+ *endp = (cur >= str) ? cur + 1 : NULL;
+}
+
+/**
* virParseNumber:
* @str: pointer to the char pointer used
*
diff --git a/src/util/util.h b/src/util/util.h
index 0c43f7a..ae74c30 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -167,6 +167,7 @@ int virHexToBin(unsigned char c);
int virMacAddrCompare (const char *mac1, const char *mac2);
void virSkipSpaces(const char **str);
+void virSkipSpacesBackwards(const char *str, char **endp);
int virParseNumber(const char **str);
int virParseVersionString(const char *str, unsigned long *version);
int virAsprintf(char **strp, const char *fmt, ...)
--
1.7.1
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 4 months
[libvirt] [PATCH] build: avoid pod2man on tarball
by Eric Blake
virt-sanlock-cleanup.8 has static contents (no dependency on
configure), but is generated by pod2man (a perl dependency that
maintainers must have, but which ordinary tarball users need
not have). Therefore, ensure that it is always part of the
tarball, even though it is only conditionally installed.
This is similar to commit 6db98a2d4b, but made simpler by the
fact that the .8 page is static content.
* tools/Makefile.am (EXTRA_DIST): Add virt-sanlock-cleanup.8.
---
I've tested this with 'make distcheck', when configured
--without-sanlock. It resolves my action item from:
https://www.redhat.com/archives/libvir-list/2011-June/msg01464.html
tools/Makefile.am | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index ed38396..62c275e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -13,6 +13,7 @@ EXTRA_DIST = \
virt-xml-validate.in \
virt-pki-validate.in \
virt-sanlock-cleanup.in \
+ virt-sanlock-cleanup.8 \
virsh.pod \
libvirt-guests.init.sh \
libvirt-guests.sysconf
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] sysinfo: fix illegal NULL return
by Minoru Usui
If virSysinfoParse{BIOS,System,Processor,Memory}()
can't find newline('\n'), these return NULL.
This patch fixes this.
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/util/sysinfo.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index d32f7f0..a6e525b 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -131,7 +131,12 @@ static char *
virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol = NULL;
+ char *tmp_base;
+ if ((tmp_base = strstr(base, "BIOS Information")) == NULL)
+ return base;
+
+ base = tmp_base;
if ((cur = strstr(base, "Vendor: ")) != NULL) {
cur += 8;
eol = strchr(cur, '\n');
@@ -157,7 +162,7 @@ virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
- return eol ? eol + 1 : NULL;
+ return base + strlen("BIOS Information");
no_memory:
return NULL;
@@ -167,10 +172,12 @@ static char *
virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol = NULL;
+ char *tmp_base;
- if ((base = strstr(base, "System Information")) == NULL)
- return 0;
+ if ((tmp_base = strstr(base, "System Information")) == NULL)
+ return base;
+ base = tmp_base;
if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
cur += 14;
eol = strchr(cur, '\n');
@@ -215,7 +222,7 @@ virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
- return eol ? eol + 1 : NULL;
+ return base + strlen("System Information");
no_memory:
return NULL;
@@ -314,9 +321,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
- if (!eol)
- break;
- base = eol + 1;
+ base += strlen("Processor Information");
}
return base;
@@ -415,9 +420,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
}
next:
- if (!eol)
- break;
- base = eol + 1;
+ base += strlen("Memory Device");
}
return base;
--
1.7.1
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 4 months
[libvirt] FYI: migration test script for TCK
by Daniel P. Berrange
I just added a new test case to the libvirt TCK for validating QEMU
migration.
http://libvirt.org/git/?p=libvirt-tck.git;a=commitdiff;h=f74faf2d8c83538d...
It tests 96 different scenarios for successful migration, made
up of:
- Three different control/communication methods
1. Normal
2. Peer2peer
3. Peer2peer + tunnelled
- 8 Different scenarios of persistent vs transient
guests
1. Transient running source, no dest
2. Transient running source, persistent inactive dest
3. Persistent running source, no dest
4. Persistent running source, persistent inactive dest
5. Transient paused source, no dest
6. Transient paused source, persistent inactive dest
7. Persistent paused source, no dest
8. Persistent paused source, persistent inactive dest
- With each scenario there are upto 4 flag combinations
affecting persistent/transient state
1. No flags
2. UNDEFINE_SOURCE
3. PERSIST
4. UNDEFINE_SOURCE|PERSIST
This gives 96 major functional test cases. On each test case we
validate 10 conditions, giving a total of 960 tests results
Since 0.9.2 introduced a migration v3 protocol, full test
coverage also requires validating the different combinations
of libvirt client, source libvirtd and destination libvirtd
protocol support. This implies re-running the overall test
script 8 times
1. client < 0.9.2, source < 0.9.2, target < 0.9.2
2. client >= 0.9.2, source < 0.9.2, target < 0.9.2
3. client < 0.9.2, source >= 0.9.2, target < 0.9.2
4. client < 0.9.2, source < 0.9.2, target >= 0.9.2
5. client >= 0.9.2, source >= 0.9.2, target < 0.9.2
6. client >= 0.9.2, source < 0.9.2, target >= 0.9.2
7. client < 0.9.2, source >= 0.9.2, target >= 0.9.2
8. client >= 0.9.2, source >= 0.9.2, target >= 0.9.2
Finally, this is only testing successful migration cases.
We ought to have another test which validates recovery from
a variety of common migration failure scenarios. This would
add another few 1000 test scenarios :-)
NB, in libvirt < 0.9.2 there was a bug with handling the
migration of VMs which were initially PAUSED with p2p
migration which causes failures. libvirt >= 0.9.2 should
have a 100% success rate.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
13 years, 4 months
[libvirt] [PATCH] build: fix build --without-remote
by Eric Blake
When configured --without-remote, the files remote_protocol.[ch]
are not built by src/Makefile, but are still used by daemon/Makefile.
The solution is to copy the implicit rule.
* daemon/Makefile.am (%protocol.c, %protocol.h): Copy from src.
---
Not quite trivial enough to claim the build-breaker rule.
daemon/Makefile.am | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 8ed29b8..cb3caa2 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -52,6 +52,14 @@ $(srcdir)/qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
$(AM_V_GEN)perl -w $(srcdir)/../src/rpc/gendispatch.pl -b qemu \
$(QEMU_PROTOCOL) > $@
+%protocol.c: %protocol.x %protocol.h $(srcdir)/../src/rpc/genprotocol.pl
+ $(AM_V_GEN)perl -w $(srcdir)/../src/rpc/genprotocol.pl $(RPCGEN) -c \
+ $< $@
+
+%protocol.h: %protocol.x $(srcdir)/../src/rpc/genprotocol.pl
+ $(AM_V_GEN)perl -w $(srcdir)/../src/rpc/genprotocol.pl $(RPCGEN) -h \
+ $< $@
+
if WITH_LIBVIRTD
man8_MANS = libvirtd.8
--
1.7.4.4
13 years, 4 months