[libvirt] [PATCH v2] cpu: add Freescale ppc64 CPU models
by Olivia Yin
From: Olivia Yin <hong-hua.yin(a)freescale.com>
With this patch, Freescale ppc64 CPU modesl could be recognized.
virsh # cpu-models ppc64
POWERPC_e6500
POWERPC_e5500
power8
power8e
power7+
power7
power6
POWER8_v1.0
POWER7+_v2.1
POWER7_v2.3
POWER7_v2.1
POWER7
virsh # capabilities
<capabilities>
<host>
<uuid>5a54efa6-20dc-4da7-b271-0b7fb7062cb8</uuid>
<cpu>
<arch>ppc64</arch>
<model>POWERPC_e6500</model>
<vendor>Freescale</vendor>
---
src/cpu/cpu_map.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index bd9b056..413148f 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -600,6 +600,7 @@
<arch name='ppc64'>
<!-- vendor definitions -->
<vendor name='IBM'/>
+ <vendor name='Freescale'/>
<!-- IBM-based CPU models -->
<model name='POWER7'>
@@ -657,5 +658,16 @@
<pvr value='0x004d0000'/>
</model>
+<!-- Freescale-based CPU models -->
+ <model name='POWERPC_e5500'>
+ <vendor name='Freescale'/>
+ <pvr value='0x80240000'/>
+ </model>
+
+ <model name='POWERPC_e6500'>
+ <vendor name='Freescale'/>
+ <pvr value='0x80400000'/>
+ </model>
+
</arch>
</cpus>
--
2.1.0.27.g96db324
9 years, 9 months
[libvirt] [PATCH] conf: fix forget goto error when report a unsupport error
by Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1188914
This will cause a issue that add a unsupport input device
to a hypervisor which unsupport it, also will cause a wrong
error message when the input device is not a mouse or keyboard.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 706e5d2..09b8e9b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8968,6 +8968,7 @@ virDomainInputDefParseXML(const virDomainDef *dom,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported input bus %s"),
bus);
+ goto error;
}
if (def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
def->type != VIR_DOMAIN_INPUT_TYPE_KBD) {
--
1.8.3.1
9 years, 9 months
[libvirt] [PATCH] conf: forget goto error when the node->name is not valid
by Luyao Huang
Although it won't cause a issue now, the code won't
touch this place.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 706e5d2..3a0b13e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8609,6 +8609,7 @@ virDomainChrDefParseXML(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown character device type: %s"),
nodeName);
+ goto error;
}
cur = node->children;
--
1.8.3.1
9 years, 9 months
[libvirt] [PATCHv2] lxc: fix show the wrong xml when guest start failed
by Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1176503
When guest start failed, libvirt will keep the current vm->def,
this will make a issue that we cannot get a right xml after guest
start failed. And don't call the stop/release hook to do some
other clean work.
Call virLXCProcessCleanup to help us clean the source and call
the hooks if start a vm failed.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
v2: use virLXCProcessCleanup to free the source and call the hook.
src/lxc/lxc_process.c | 69 ++++++++++++++++++++++-----------------------------
1 file changed, 29 insertions(+), 40 deletions(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d7eb8bc..7ba0da8 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1006,6 +1006,7 @@ int virLXCProcessStart(virConnectPtr conn,
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
virCgroupPtr selfcgroup;
int status;
+ bool need_stop = false;
if (virCgroupNewSelf(&selfcgroup) < 0)
return -1;
@@ -1265,18 +1266,20 @@ int virLXCProcessStart(virConnectPtr conn,
goto cleanup;
}
+ need_stop = true;
+
if (virCgroupNewDetectMachine(vm->def->name, "lxc", vm->pid,
vm->def->resource ?
vm->def->resource->partition :
NULL,
-1, &priv->cgroup) < 0)
- goto error;
+ goto cleanup;
if (!priv->cgroup) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No valid cgroup for machine %s"),
vm->def->name);
- goto error;
+ goto cleanup;
}
priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_FAILED;
@@ -1296,17 +1299,17 @@ int virLXCProcessStart(virConnectPtr conn,
_("guest failed to start: %s"), out);
}
- goto error;
+ goto cleanup;
}
if (autoDestroy &&
virCloseCallbacksSet(driver->closeCallbacks, vm,
conn, lxcProcessAutoDestroy) < 0)
- goto error;
+ goto cleanup;
if (virDomainObjSetDefTransient(caps, driver->xmlopt,
vm, false) < 0)
- goto error;
+ goto cleanup;
/* We don't need the temporary NIC names anymore, clear them */
virLXCProcessCleanInterfaces(vm->def);
@@ -1318,7 +1321,7 @@ int virLXCProcessStart(virConnectPtr conn,
* it with the live status XML instead. This is a (currently
* harmless) inconsistency we should fix one day */
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
- goto error;
+ goto cleanup;
/* finally we can call the 'started' hook script if any */
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
@@ -1334,47 +1337,38 @@ int virLXCProcessStart(virConnectPtr conn,
* If the script raised an error abort the launch
*/
if (hookret < 0)
- goto error;
+ goto cleanup;
}
rc = 0;
cleanup:
- if (rc != 0 && !err)
- err = virSaveLastError();
- virCommandFree(cmd);
if (VIR_CLOSE(logfd) < 0) {
virReportSystemError(errno, "%s", _("could not close logfile"));
rc = -1;
}
- for (i = 0; i < nveths; i++) {
- if (rc != 0 && veths[i])
- ignore_value(virNetDevVethDelete(veths[i]));
- VIR_FREE(veths[i]);
- }
if (rc != 0) {
- if (vm->newDef) {
- virDomainDefFree(vm->newDef);
- vm->newDef = NULL;
- }
- if (priv->monitor) {
- virObjectUnref(priv->monitor);
- priv->monitor = NULL;
- }
- virDomainConfVMNWFilterTeardown(vm);
-
- virSecurityManagerRestoreAllLabel(driver->securityManager,
- vm->def, false);
- virSecurityManagerReleaseLabel(driver->securityManager, vm->def);
- /* Clear out dynamically assigned labels */
- if (vm->def->nseclabels &&
- vm->def->seclabels[0]->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
- VIR_FREE(vm->def->seclabels[0]->model);
- VIR_FREE(vm->def->seclabels[0]->label);
- VIR_FREE(vm->def->seclabels[0]->imagelabel);
- VIR_DELETE_ELEMENT(vm->def->seclabels, 0, vm->def->nseclabels);
+ err = virSaveLastError();
+ if (need_stop) {
+ virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
+ } else {
+ virSecurityManagerRestoreAllLabel(driver->securityManager,
+ vm->def, false);
+ virSecurityManagerReleaseLabel(driver->securityManager, vm->def);
+ /* Clear out dynamically assigned labels */
+ if (vm->def->nseclabels &&
+ vm->def->seclabels[0]->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
+ VIR_FREE(vm->def->seclabels[0]->model);
+ VIR_FREE(vm->def->seclabels[0]->label);
+ VIR_FREE(vm->def->seclabels[0]->imagelabel);
+ VIR_DELETE_ELEMENT(vm->def->seclabels, 0, vm->def->nseclabels);
+ }
+ virLXCProcessCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
}
}
+ virCommandFree(cmd);
+ for (i = 0; i < nveths; i++)
+ VIR_FREE(veths[i]);
for (i = 0; i < nttyFDs; i++)
VIR_FORCE_CLOSE(ttyFDs[i]);
VIR_FREE(ttyFDs);
@@ -1390,11 +1384,6 @@ int virLXCProcessStart(virConnectPtr conn,
}
return rc;
-
- error:
- err = virSaveLastError();
- virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
- goto cleanup;
}
struct virLXCProcessAutostartData {
--
1.8.3.1
9 years, 9 months
[libvirt] [libvirt-test-API][PATCH V2 00/11] Add network_dhcp_leases test case
by jiahu
For checking IPv6 address, libvirt need a IPv6 testing environment,
so modified some cases and configuration files, also there are some
small changes for other requirements.
There are 9 new commits after comparing with the V1:
Add global IPv6 default values to network part
Add IPv6 section into network template xml
Add IPv6 section into related network case
Add xml file for <host> of IPv6 family
Remove extra space from xml
Change bridge name as a variable in functions
Obtain a IPv6 addr on interface
Change bridge name as a variable in XML
Support brige name argument in cases
According to those new commits in V2, updated its conf.
Add network_dhcp_leases test case to conf
jiahu (11):
Add network_dhcp_leases test case
Add global IPv6 default values to network part
Add IPv6 section into network template xml
Add IPv6 section into related network case
Add xml file for <host> of IPv6 family
Remove extra space from xml
Change bridge name as a variable in functions
Obtain a IPv6 addr on interface
Change bridge name as a variable in XML
Support brige name argument in cases
Add network_dhcp_leases test case to conf
cases/basic_network.conf | 100 ++++++++
global.cfg | 9 +
kickstart.cfg | 2 +-
repos/domain/destroy.py | 5 +-
repos/domain/install_linux_cdrom.py | 5 +-
.../domain/xmls/kvm_linux_guest_install_cdrom.xml | 2 +-
repos/network/define.py | 7 +-
repos/network/network_dhcp_leases.py | 277 +++++++++++++++++++++
repos/network/xmls/ip-dhcp-host.xml | 2 +-
repos/network/xmls/ipv6-dhcp-host.xml | 1 +
repos/network/xmls/network.xml | 5 +
utils/ipget.sh | 7 +-
utils/utils.py | 7 +-
13 files changed, 419 insertions(+), 10 deletions(-)
create mode 100644 repos/network/network_dhcp_leases.py
create mode 100644 repos/network/xmls/ipv6-dhcp-host.xml
--
1.8.3.1
9 years, 9 months
[libvirt] [PATCH v2 0/2] add support for --reflink to virsh
by Chen Hanxiao
v2: add man page patch
Chen Hanxiao (2):
virsh-volume: add support for --reflink
man: add --reflink man page of virsh
tools/virsh-volume.c | 16 ++++++++++++++++
tools/virsh.pod | 9 ++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
--
2.1.0
9 years, 9 months
[libvirt] [PATCH] qemu: include libvirt & QEMU versions in QEMU log files
by Daniel P. Berrange
It is often helpful to know which version of libvirt and QEMU
was present when a guest was first launched. Ensure this info
is written into the QEMU log file for each guest.
---
src/qemu/qemu_capabilities.c | 22 +++++++++++++++++-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_process.c | 54 ++++++++++++++++++++++++++++++++------------
src/util/virlog.c | 17 ++------------
src/util/virlog.h | 13 +++++++++++
6 files changed, 77 insertions(+), 32 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 13f3cd3..a04095e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -299,6 +299,7 @@ struct _virQEMUCaps {
unsigned int version;
unsigned int kvmVersion;
+ char *package;
virArch arch;
@@ -1941,6 +1942,10 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
ret->usedQMP = qemuCaps->usedQMP;
ret->version = qemuCaps->version;
ret->kvmVersion = qemuCaps->kvmVersion;
+
+ if (VIR_STRDUP(ret->package, qemuCaps->package) < 0)
+ goto error;
+
ret->arch = qemuCaps->arch;
if (VIR_ALLOC_N(ret->cpuDefinitions, qemuCaps->ncpuDefinitions) < 0)
@@ -1992,6 +1997,7 @@ void virQEMUCapsDispose(void *obj)
virBitmapFree(qemuCaps->flags);
+ VIR_FREE(qemuCaps->package);
VIR_FREE(qemuCaps->binary);
}
@@ -2116,6 +2122,12 @@ unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps)
}
+const char *virQEMUCapsGetPackage(virQEMUCapsPtr qemuCaps)
+{
+ return qemuCaps->package;
+}
+
+
int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps,
const char *name)
{
@@ -2672,6 +2684,9 @@ virQEMUCapsLoadCache(virQEMUCapsPtr qemuCaps, const char *filename,
goto cleanup;
}
+ /* Don't check for NULL, since it is optional and thus may be missing */
+ qemuCaps->package = virXPathString("string(./package)", ctxt);
+
if (!(str = virXPathString("string(./arch)", ctxt))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing arch in QEMU capabilities cache"));
@@ -2783,6 +2798,10 @@ virQEMUCapsSaveCache(virQEMUCapsPtr qemuCaps, const char *filename)
virBufferAsprintf(&buf, "<kvmVersion>%d</kvmVersion>\n",
qemuCaps->kvmVersion);
+ if (qemuCaps->package)
+ virBufferAsprintf(&buf, "<package>%s</package>\n",
+ qemuCaps->package);
+
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
@@ -2872,6 +2891,7 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
virBitmapClearAll(qemuCaps->flags);
qemuCaps->version = qemuCaps->kvmVersion = 0;
+ VIR_FREE(qemuCaps->package);
qemuCaps->arch = VIR_ARCH_NONE;
qemuCaps->usedQMP = false;
@@ -3204,6 +3224,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
}
qemuCaps->version = major * 1000000 + minor * 1000 + micro;
+ qemuCaps->package = package;
qemuCaps->usedQMP = true;
virQEMUCapsInitQMPBasic(qemuCaps);
@@ -3249,7 +3270,6 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
ret = 0;
cleanup:
- VIR_FREE(package);
return ret;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 12e1688..1c1227a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -266,6 +266,7 @@ char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps);
const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps);
virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps);
unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps);
+const char *virQEMUCapsGetPackage(virQEMUCapsPtr qemuCaps);
unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps);
int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps,
const char *name);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 100deed..6cc7a24 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7988,7 +7988,7 @@ qemuBuildCommandLine(virConnectPtr conn,
if (def->mem.nhugepages && (!def->cpu || !def->cpu->ncells)) {
const long system_page_size = sysconf(_SC_PAGESIZE) / 1024;
char *mem_path = NULL;
-
+ fprintf(stderr, "SYSCONF %ld\n", system_page_size);
if (def->mem.hugepages[0].size == system_page_size) {
/* There is one special case: if user specified "huge"
* pages of regular system pages size. */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b0f7b1c..3d5d58e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -76,7 +76,6 @@
VIR_LOG_INIT("qemu.qemu_process");
-#define START_POSTFIX ": starting up\n"
#define ATTACH_POSTFIX ": attaching\n"
#define SHUTDOWN_POSTFIX ": shutting down\n"
@@ -4249,6 +4248,44 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
}
+static void qemuLogOperation(virDomainObjPtr vm,
+ const char *msg,
+ int logfd,
+ virCommandPtr cmd)
+{
+ char *timestamp;
+ char *logline;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ int qemuVersion = virQEMUCapsGetVersion(priv->qemuCaps);
+ const char *package = virQEMUCapsGetPackage(priv->qemuCaps);
+ char ebuf[1024];
+
+ if ((timestamp = virTimeStringNow()) == NULL)
+ goto error;
+
+ if (virAsprintf(&logline, "%s: %s %s, qemu version: %d.%d.%d%s\n",
+ timestamp, msg, VIR_LOG_VERSION_STRING,
+ (qemuVersion / 1000000) % 1000, (qemuVersion / 1000) % 1000, qemuVersion % 1000,
+ package ? package : "") < 0)
+ goto error;
+
+ if (safewrite(logfd, logline, strlen(logline)) < 0)
+ goto error;
+
+ if (cmd)
+ virCommandWriteArgLog(cmd, logfd);
+
+ cleanup:
+ VIR_FREE(timestamp);
+ VIR_FREE(logline);
+ return;
+
+ error:
+ VIR_WARN("Unable to write banner to logfile: %s",
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ goto cleanup;
+}
+
int qemuProcessStart(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -4264,7 +4301,6 @@ int qemuProcessStart(virConnectPtr conn,
off_t pos = -1;
char ebuf[1024];
int logfile = -1;
- char *timestamp;
qemuDomainObjPrivatePtr priv = vm->privateData;
virCommandPtr cmd = NULL;
struct qemuProcessHookData hookData;
@@ -4620,19 +4656,7 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
}
- if ((timestamp = virTimeStringNow()) == NULL) {
- goto cleanup;
- } else {
- if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
- safewrite(logfile, START_POSTFIX, strlen(START_POSTFIX)) < 0) {
- VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof(ebuf)));
- }
-
- VIR_FREE(timestamp);
- }
-
- virCommandWriteArgLog(cmd, logfile);
+ qemuLogOperation(vm, "starting up", logfile, cmd);
qemuDomainObjCheckTaint(driver, vm, logfile);
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 14eb129..b45ee91 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -448,21 +448,8 @@ static int
virLogVersionString(const char **rawmsg,
char **msg)
{
-#ifdef PACKAGER_VERSION
-# ifdef PACKAGER
-# define LOG_VERSION_STRING \
- "libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")"
-# else
-# define LOG_VERSION_STRING \
- "libvirt version: " VERSION ", package: " PACKAGER_VERSION
-# endif
-#else
-# define LOG_VERSION_STRING \
- "libvirt version: " VERSION
-#endif
-
- *rawmsg = LOG_VERSION_STRING;
- return virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, LOG_VERSION_STRING);
+ *rawmsg = VIR_LOG_VERSION_STRING;
+ return virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, VIR_LOG_VERSION_STRING);
}
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 5b38891..443b3cd 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -25,6 +25,19 @@
# include "internal.h"
# include "virbuffer.h"
+# ifdef PACKAGER_VERSION
+# ifdef PACKAGER
+# define VIR_LOG_VERSION_STRING \
+ "libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")"
+# else
+# define VIR_LOG_VERSION_STRING \
+ "libvirt version: " VERSION ", package: " PACKAGER_VERSION
+# endif
+# else
+# define VIR_LOG_VERSION_STRING \
+ "libvirt version: " VERSION
+# endif
+
/*
* To be made public
*/
--
2.1.0
9 years, 9 months
[libvirt] [PATCH 0/2] storage: Fix crash with NBD backing store without path
by Peter Krempa
Storage volume with "nbd://localhost" would crash libvirt if being parsed.
Peter Krempa (2):
tests: virstoragetest: Switch backing chain test to use automatic
numbering
util: storage: Fix parsing of nbd: string without path
src/util/virstoragefile.c | 3 ++-
tests/virstoragetest.c | 69 ++++++++++++++++++++++++++++-------------------
2 files changed, 44 insertions(+), 28 deletions(-)
--
2.2.2
9 years, 9 months
[libvirt] [PATCH 0/2] fix build issues found by MinGW and Coverity
by Pavel Hrdina
Pavel Hrdina (2):
virnetdev: fix some issues found by coverity and mingw builds
virutil: fix MinGW build
src/util/virnetdev.c | 36 ++++++++++++++++++++++++------------
src/util/virnetdev.h | 6 +++---
src/util/virutil.c | 8 ++++++++
3 files changed, 35 insertions(+), 15 deletions(-)
--
2.0.5
9 years, 9 months
[libvirt] [PATCH] virsh: report 0-length active block-commit job status
by Eric Blake
At least with live block commit, it is possible to have a block
job that reports 0 status: namely, when the active image contains
no sectors that differ from the backing image it is being committed
into [1]. I'm not sure if that represents a qemu bug, but it leads
to weird virsh output where 'virsh blockjob $dom vda' has no output
during a no-op commit job. It appears that the special case for
a zero total was first introduced for migration, where it does sort
of make sense (when we do storage migration, the job is broken up
into two pieces where the first half of migrating storage has no
clue what the total length of the second phase will be, and where
qemu migration always reports a non-zero total length but only once
we complete the first phase to start actual migration), but it
doesn't seem to make sense for any of the block jobs.
[1] https://www.redhat.com/archives/libvir-list/2015-January/msg00348.html
* tools/virsh-domain.c (vshPrintJobProgress): Move special-case of
0 total...
(vshWatchJob): ...into lone caller where it matters.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tools/virsh-domain.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6733cfa..ec62aae 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1,7 +1,7 @@
/*
* virsh-domain.c: Commands to manage domain
*
- * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2015 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
@@ -1678,10 +1678,6 @@ vshPrintJobProgress(const char *label, unsigned long long remaining,
{
int progress;
- if (total == 0)
- /* migration has not been started */
- return;
-
if (remaining == 0) {
/* migration has completed */
progress = 100;
@@ -4189,7 +4185,7 @@ vshWatchJob(vshControl *ctl,
ret = virDomainGetJobInfo(dom, &jobinfo);
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
if (ret == 0) {
- if (verbose)
+ if (verbose && jobinfo.dataTotal)
vshPrintJobProgress(label, jobinfo.dataRemaining,
jobinfo.dataTotal);
--
2.1.0
9 years, 9 months