summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/Makefile.in4
-rw-r--r--tools/libvirt-guests.service.in2
-rw-r--r--tools/libvirt-guests.sh.in6
-rw-r--r--tools/nss/libvirt_nss.c20
-rw-r--r--tools/virsh-domain.c519
-rw-r--r--tools/virsh-volume.c4
-rw-r--r--tools/virsh.1.in216
-rw-r--r--tools/virsh.pod124
-rw-r--r--tools/vsh.c10
10 files changed, 615 insertions, 292 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e7e42c3e7..319abb291 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -398,7 +398,7 @@ EXTRA_DIST += \
if WITH_WIRESHARK_DISSECTOR
-ws_plugindir = $(plugindir)
+ws_plugindir = @ws_plugindir@
ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la
wireshark_src_libvirt_la_CPPFLAGS = \
-I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 5b6ab7a51..67f22b025 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1939,7 +1939,6 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
-plugindir = @plugindir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
@@ -1952,6 +1951,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+ws_plugindir = @ws_plugindir@
+@WITH_WIRESHARK_DISSECTOR_TRUE@ws_plugindir = @ws_plugindir@
INCLUDES = \
-I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
@@ -2143,7 +2144,6 @@ virt_admin_CFLAGS = \
BUILT_SOURCES = $(am__append_8) libvirt-guests.sh $(am__append_9)
POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
-@WITH_WIRESHARK_DISSECTOR_TRUE@ws_plugindir = $(plugindir)
@WITH_WIRESHARK_DISSECTOR_TRUE@ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la
@WITH_WIRESHARK_DISSECTOR_TRUE@wireshark_src_libvirt_la_CPPFLAGS = \
@WITH_WIRESHARK_DISSECTOR_TRUE@ -I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS)
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
index b4f54f2be..02e67471d 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -1,6 +1,6 @@
[Unit]
Description=Suspend/Resume Running libvirt Guests
-Requires=libvirtd.service
+Wants=libvirtd.service
After=network.target
After=time-sync.target
After=libvirtd.service
diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 7f74b85c1..791d9277b 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -121,7 +121,7 @@ list_guests() {
return 1
fi
- echo $list
+ echo "$list" | grep -v 00000000-0000-0000-0000-000000000000
}
# guest_name URI UUID
@@ -499,7 +499,7 @@ stop() {
fi
if [ -n "$list" ]; then
- echo "$uri" "$list" >>"$LISTFILE"
+ echo "$uri" $list >>"$LISTFILE"
fi
done
set +f
@@ -539,7 +539,7 @@ gueststatus() {
for uri in $URIS; do
set +f
echo "* $uri URI:"
- retval run_virsh "$uri" list || echo
+ retval run_virsh "$uri" list | grep -v "Domain-0" || echo
done
set +f
}
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 54c4a2a13..0d5982529 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -42,6 +42,7 @@
#include "virlease.h"
#include "viralloc.h"
#include "virfile.h"
+#include "virtime.h"
#include "virerror.h"
#include "virstring.h"
#include "virsocketaddr.h"
@@ -114,6 +115,8 @@ findLease(const char *name,
ssize_t i, nleases;
leaseAddress *tmpAddress = NULL;
size_t ntmpAddress = 0;
+ time_t currtime;
+ long long expirytime;
*address = NULL;
*naddress = 0;
@@ -161,6 +164,11 @@ findLease(const char *name,
nleases = virJSONValueArraySize(leases_array);
DEBUG("Read %zd leases", nleases);
+ if ((currtime = time(NULL)) == (time_t) - 1) {
+ ERROR("Failed to get current system time");
+ goto cleanup;
+ }
+
for (i = 0; i < nleases; i++) {
virJSONValuePtr lease;
const char *lease_name;
@@ -181,6 +189,18 @@ findLease(const char *name,
if (STRNEQ_NULLABLE(name, lease_name))
continue;
+ if (virJSONValueObjectGetNumberLong(lease, "expiry-time", &expirytime) < 0) {
+ /* A lease cannot be present without expiry-time */
+ ERROR("expiry-time field missing for %s", name);
+ goto cleanup;
+ }
+
+ /* Do not report expired lease */
+ if (expirytime < (long long) currtime) {
+ DEBUG("Skipping expired lease for %s", name);
+ continue;
+ }
+
DEBUG("Found record for %s", lease_name);
*found = true;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3829b17a2..fe8c45856 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1263,6 +1263,54 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
.type = VSH_OT_INT,
.help = N_("I/O size in bytes")
},
+ {.name = "total_bytes_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "total-bytes-sec-max-length"
+ },
+ {.name = "total-bytes-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow total max bytes")
+ },
+ {.name = "read_bytes_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "read-bytes-sec-max-length"
+ },
+ {.name = "read-bytes-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow read max bytes")
+ },
+ {.name = "write_bytes_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "write-bytes-sec-max-length"
+ },
+ {.name = "write-bytes-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow write max bytes")
+ },
+ {.name = "total_iops_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "total-iops-sec-max-length"
+ },
+ {.name = "total-iops-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow total I/O operations max")
+ },
+ {.name = "read_iops_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "read-iops-sec-max-length"
+ },
+ {.name = "read-iops-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow read I/O operations max")
+ },
+ {.name = "write_iops_sec_max_length",
+ .type = VSH_OT_ALIAS,
+ .help = "write-iops-sec-max-length"
+ },
+ {.name = "write-iops-sec-max-length",
+ .type = VSH_OT_INT,
+ .help = N_("duration in seconds to allow write I/O operations max")
+ },
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
@@ -1300,122 +1348,50 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "device", &disk) < 0)
goto cleanup;
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "total-bytes-sec", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "read-bytes-sec", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "write-bytes-sec", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "total-bytes-sec-max", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "read-bytes-sec-max", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptScaledInt(ctl, cmd, "write-bytes-sec-max", &value, 1, ULLONG_MAX)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "total-iops-sec", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "read-iops-sec", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "write-iops-sec", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "write-iops-sec-max", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "read-iops-sec-max", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "total-iops-sec-max", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX,
- value) < 0)
- goto save_error;
- }
-
- if ((rv = vshCommandOptULongLong(ctl, cmd, "size-iops-sec", &value)) < 0) {
- goto interror;
- } else if (rv > 0) {
- if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
- VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC,
- value) < 0)
- goto save_error;
- }
+#define VSH_ADD_IOTUNE_SCALED(PARAM, CONST) \
+ if ((rv = vshCommandOptScaledInt(ctl, cmd, #PARAM, &value, \
+ 1, ULLONG_MAX)) < 0) { \
+ goto interror; \
+ } else if (rv > 0) { \
+ if (virTypedParamsAddULLong(&params, &nparams, &maxparams, \
+ VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \
+ value) < 0) \
+ goto save_error; \
+ } \
+
+ VSH_ADD_IOTUNE_SCALED(total-bytes-sec, TOTAL_BYTES_SEC);
+ VSH_ADD_IOTUNE_SCALED(read-bytes-sec, READ_BYTES_SEC);
+ VSH_ADD_IOTUNE_SCALED(write-bytes-sec, WRITE_BYTES_SEC);
+ VSH_ADD_IOTUNE_SCALED(total-bytes-sec-max, TOTAL_BYTES_SEC_MAX);
+ VSH_ADD_IOTUNE_SCALED(read-bytes-sec-max, READ_BYTES_SEC_MAX);
+ VSH_ADD_IOTUNE_SCALED(write-bytes-sec-max, WRITE_BYTES_SEC_MAX);
+#undef VSH_ADD_IOTUNE_SCALED
+
+#define VSH_ADD_IOTUNE(PARAM, CONST) \
+ if ((rv = vshCommandOptULongLong(ctl, cmd, #PARAM, &value)) < 0) { \
+ goto interror; \
+ } else if (rv > 0) { \
+ if (virTypedParamsAddULLong(&params, &nparams, &maxparams, \
+ VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \
+ value) < 0) \
+ goto save_error; \
+ } \
+
+ VSH_ADD_IOTUNE(total-iops-sec, TOTAL_IOPS_SEC);
+ VSH_ADD_IOTUNE(read-iops-sec, READ_IOPS_SEC);
+ VSH_ADD_IOTUNE(write-iops-sec, WRITE_IOPS_SEC);
+ VSH_ADD_IOTUNE(total-iops-sec-max, TOTAL_IOPS_SEC_MAX);
+ VSH_ADD_IOTUNE(read-iops-sec-max, READ_IOPS_SEC_MAX);
+ VSH_ADD_IOTUNE(write-iops-sec-max, WRITE_IOPS_SEC_MAX);
+ VSH_ADD_IOTUNE(size-iops-sec, SIZE_IOPS_SEC);
+
+ VSH_ADD_IOTUNE(total-bytes-sec-max-length, TOTAL_BYTES_SEC_MAX_LENGTH);
+ VSH_ADD_IOTUNE(read-bytes-sec-max-length, READ_BYTES_SEC_MAX_LENGTH);
+ VSH_ADD_IOTUNE(write-bytes-sec-max-length, WRITE_BYTES_SEC_MAX_LENGTH);
+ VSH_ADD_IOTUNE(total-iops-sec-max-length, TOTAL_IOPS_SEC_MAX_LENGTH);
+ VSH_ADD_IOTUNE(read-iops-sec-max-length, READ_IOPS_SEC_MAX_LENGTH);
+ VSH_ADD_IOTUNE(write-iops-sec-max-length, WRITE_IOPS_SEC_MAX_LENGTH);
+#undef VSH_ADD_IOTUNE
if (nparams == 0) {
if (virDomainGetBlockIoTune(dom, NULL, NULL, &nparams, flags) != 0) {
@@ -6125,50 +6101,49 @@ virshCPUCountCollect(vshControl *ctl,
return count;
/* fallback code */
- if (!(last_error->code == VIR_ERR_NO_SUPPORT ||
- last_error->code == VIR_ERR_INVALID_ARG))
- goto cleanup;
+ if (!(last_error->code == VIR_ERR_NO_SUPPORT ||
+ last_error->code == VIR_ERR_INVALID_ARG))
+ goto cleanup;
- if (flags & VIR_DOMAIN_VCPU_GUEST) {
- vshError(ctl, "%s", _("Failed to retrieve vCPU count from the guest"));
- goto cleanup;
- }
+ if (flags & VIR_DOMAIN_VCPU_GUEST) {
+ vshError(ctl, "%s", _("Failed to retrieve vCPU count from the guest"));
+ goto cleanup;
+ }
- if (!(flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) &&
- virDomainIsActive(dom) == 1)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
+ if (!(flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) &&
+ virDomainIsActive(dom) == 1)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
- vshResetLibvirtError();
+ vshResetLibvirtError();
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
count = virDomainGetMaxVcpus(dom);
- } else {
- if (virDomainGetInfo(dom, &info) < 0)
- goto cleanup;
+ } else {
+ if (virDomainGetInfo(dom, &info) < 0)
+ goto cleanup;
- count = info.nrVirtCpu;
- }
- } else {
- if (!(def = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE)))
- goto cleanup;
+ count = info.nrVirtCpu;
+ }
+ } else {
+ if (!(def = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE)))
+ goto cleanup;
if (!(xml = virXMLParseStringCtxt(def, _("(domain_definition)"), &ctxt)))
goto cleanup;
- if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
- if (virXPathInt("string(/domain/vcpus)", ctxt, &count) < 0) {
- vshError(ctl, "%s", _("Failed to retrieve maximum vcpu count"));
- goto cleanup;
- }
- } else {
- if (virXPathInt("string(/domain/vcpus/@current)",
- ctxt, &count) < 0) {
- vshError(ctl, "%s", _("Failed to retrieve current vcpu count"));
- goto cleanup;
- }
- }
- }
+ if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
+ if (virXPathInt("string(/domain/vcpu)", ctxt, &count) < 0) {
+ vshError(ctl, "%s", _("Failed to retrieve maximum vcpu count"));
+ goto cleanup;
+ }
+ } else {
+ if (virXPathInt("string(/domain/vcpu/@current)", ctxt, &count) < 0) {
+ vshError(ctl, "%s", _("Failed to retrieve current vcpu count"));
+ goto cleanup;
+ }
+ }
+ }
ret = count;
cleanup:
@@ -6281,6 +6256,168 @@ static const vshCmdOptDef opts_vcpuinfo[] = {
{.name = NULL}
};
+
+static int
+virshVcpuinfoPrintAffinity(vshControl *ctl,
+ const unsigned char *cpumap,
+ int maxcpu,
+ bool pretty)
+{
+ char *str = NULL;
+ size_t i;
+ int ret = -1;
+
+ vshPrint(ctl, "%-15s ", _("CPU Affinity:"));
+ if (pretty) {
+ if (!(str = virBitmapDataToString(cpumap, VIR_CPU_MAPLEN(maxcpu))))
+ goto cleanup;
+ vshPrint(ctl, _("%s (out of %d)"), str, maxcpu);
+ } else {
+ for (i = 0; i < maxcpu; i++)
+ vshPrint(ctl, "%c", VIR_CPU_USED(cpumap, i) ? 'y' : '-');
+ }
+ vshPrint(ctl, "\n");
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(str);
+ return ret;
+}
+
+
+static virBitmapPtr
+virshDomainGetVcpuBitmap(vshControl *ctl,
+ virDomainPtr dom,
+ bool inactive)
+{
+ unsigned int flags = 0;
+ char *def = NULL;
+ virBitmapPtr ret = NULL;
+ xmlDocPtr xml = NULL;
+ xmlXPathContextPtr ctxt = NULL;
+ xmlNodePtr *nodes = NULL;
+ xmlNodePtr old;
+ int nnodes;
+ size_t i;
+ unsigned int curvcpus = 0;
+ unsigned int maxvcpus = 0;
+ unsigned int vcpuid;
+ char *online = NULL;
+
+ if (inactive)
+ flags |= VIR_DOMAIN_XML_INACTIVE;
+
+ if (!(def = virDomainGetXMLDesc(dom, flags)))
+ goto cleanup;
+
+ if (!(xml = virXMLParseStringCtxt(def, _("(domain_definition)"), &ctxt)))
+ goto cleanup;
+
+ if (virXPathUInt("string(/domain/vcpu)", ctxt, &maxvcpus) < 0) {
+ vshError(ctl, "%s", _("Failed to retrieve maximum vcpu count"));
+ goto cleanup;
+ }
+
+ ignore_value(virXPathUInt("string(/domain/vcpu/@current)", ctxt, &curvcpus));
+
+ if (curvcpus == 0)
+ curvcpus = maxvcpus;
+
+ if (!(ret = virBitmapNew(maxvcpus)))
+ goto cleanup;
+
+ if ((nnodes = virXPathNodeSet("/domain/vcpus/vcpu", ctxt, &nodes)) <= 0) {
+ /* if the specific vcpu state is missing provide a fallback */
+ for (i = 0; i < curvcpus; i++)
+ ignore_value(virBitmapSetBit(ret, i));
+
+ goto cleanup;
+ }
+
+ old = ctxt->node;
+
+ for (i = 0; i < nnodes; i++) {
+ ctxt->node = nodes[i];
+
+ if (virXPathUInt("string(@id)", ctxt, &vcpuid) < 0 ||
+ !(online = virXPathString("string(@enabled)", ctxt)))
+ continue;
+
+ if (STREQ(online, "yes"))
+ ignore_value(virBitmapSetBit(ret, vcpuid));
+
+ VIR_FREE(online);
+ }
+
+ ctxt->node = old;
+
+ if (virBitmapCountBits(ret) != curvcpus) {
+ vshError(ctl, "%s", _("Failed to retrieve vcpu state bitmap"));
+ virBitmapFree(ret);
+ ret = NULL;
+ }
+
+ cleanup:
+ VIR_FREE(online);
+ VIR_FREE(nodes);
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(xml);
+ VIR_FREE(def);
+ return ret;
+}
+
+
+static bool
+virshVcpuinfoInactive(vshControl *ctl,
+ virDomainPtr dom,
+ int maxcpu,
+ bool pretty)
+{
+ unsigned char *cpumaps = NULL;
+ size_t cpumaplen;
+ int ncpus;
+ virBitmapPtr vcpus = NULL;
+ ssize_t nextvcpu = -1;
+ bool ret = false;
+ bool first = true;
+
+ if (!(vcpus = virshDomainGetVcpuBitmap(ctl, dom, true)))
+ goto cleanup;
+
+ cpumaplen = VIR_CPU_MAPLEN(maxcpu);
+ cpumaps = vshMalloc(ctl, virBitmapSize(vcpus) * cpumaplen);
+
+ if ((ncpus = virDomainGetVcpuPinInfo(dom, virBitmapSize(vcpus),
+ cpumaps, cpumaplen,
+ VIR_DOMAIN_AFFECT_CONFIG)) < 0)
+ goto cleanup;
+
+ while ((nextvcpu = virBitmapNextSetBit(vcpus, nextvcpu)) >= 0) {
+ if (!first)
+ vshPrint(ctl, "\n");
+ first = false;
+
+ vshPrint(ctl, "%-15s %zd\n", _("VCPU:"), nextvcpu);
+ vshPrint(ctl, "%-15s %s\n", _("CPU:"), _("N/A"));
+ vshPrint(ctl, "%-15s %s\n", _("State:"), _("N/A"));
+ vshPrint(ctl, "%-15s %s\n", _("CPU time"), _("N/A"));
+
+ if (virshVcpuinfoPrintAffinity(ctl,
+ VIR_GET_CPUMAP(cpumaps, cpumaplen, nextvcpu),
+ maxcpu, pretty) < 0)
+ goto cleanup;
+ }
+
+ ret = true;
+
+ cleanup:
+ virBitmapFree(vcpus);
+ VIR_FREE(cpumaps);
+ return ret;
+}
+
+
static bool
cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
{
@@ -6292,7 +6429,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
size_t cpumaplen;
bool ret = false;
bool pretty = vshCommandOptBool(cmd, "pretty");
- int n, m;
+ int n;
virshControlPtr priv = ctl->privData;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
@@ -6314,50 +6451,30 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
if (info.state != VIR_DOMAIN_SHUTOFF)
goto cleanup;
- /* fall back to virDomainGetVcpuPinInfo and free cpuinfo to mark this */
- VIR_FREE(cpuinfo);
- if ((ncpus = virDomainGetVcpuPinInfo(dom, info.nrVirtCpu,
- cpumaps, cpumaplen,
- VIR_DOMAIN_AFFECT_CONFIG)) < 0)
- goto cleanup;
+ vshResetLibvirtError();
+
+ /* for offline VMs we can return pinning information */
+ ret = virshVcpuinfoInactive(ctl, dom, maxcpu, pretty);
+ goto cleanup;
}
for (n = 0; n < ncpus; n++) {
- if (cpuinfo) {
- vshPrint(ctl, "%-15s %d\n", _("VCPU:"), cpuinfo[n].number);
- vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
- vshPrint(ctl, "%-15s %s\n", _("State:"),
- virshDomainVcpuStateToString(cpuinfo[n].state));
- if (cpuinfo[n].cpuTime != 0) {
- double cpuUsed = cpuinfo[n].cpuTime;
+ vshPrint(ctl, "%-15s %d\n", _("VCPU:"), cpuinfo[n].number);
+ vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
+ vshPrint(ctl, "%-15s %s\n", _("State:"),
+ virshDomainVcpuStateToString(cpuinfo[n].state));
+ if (cpuinfo[n].cpuTime != 0) {
+ double cpuUsed = cpuinfo[n].cpuTime;
- cpuUsed /= 1000000000.0;
+ cpuUsed /= 1000000000.0;
- vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
- }
- } else {
- vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
- vshPrint(ctl, "%-15s %s\n", _("CPU:"), _("N/A"));
- vshPrint(ctl, "%-15s %s\n", _("State:"), _("N/A"));
- vshPrint(ctl, "%-15s %s\n", _("CPU time"), _("N/A"));
- }
- vshPrint(ctl, "%-15s ", _("CPU Affinity:"));
- if (pretty) {
- char *str;
-
- str = virBitmapDataToString(VIR_GET_CPUMAP(cpumaps, cpumaplen, n),
- cpumaplen);
- if (!str)
- goto cleanup;
- vshPrint(ctl, _("%s (out of %d)"), str, maxcpu);
- VIR_FREE(str);
- } else {
- for (m = 0; m < maxcpu; m++) {
- vshPrint(ctl, "%c",
- VIR_CPU_USABLE(cpumaps, cpumaplen, n, m) ? 'y' : '-');
- }
+ vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
}
- vshPrint(ctl, "\n");
+
+ if (virshVcpuinfoPrintAffinity(ctl, VIR_GET_CPUMAP(cpumaps, cpumaplen, n),
+ maxcpu, pretty) < 0)
+ goto cleanup;
+
if (n < (ncpus - 1))
vshPrint(ctl, "\n");
}
@@ -6722,6 +6839,10 @@ static const vshCmdOptDef opts_setvcpus[] = {
.type = VSH_OT_BOOL,
.help = N_("modify cpu state in the guest")
},
+ {.name = "hotpluggable",
+ .type = VSH_OT_BOOL,
+ .help = N_("make added vcpus hot(un)pluggable")
+ },
{.name = NULL}
};
@@ -6736,6 +6857,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool guest = vshCommandOptBool(cmd, "guest");
+ bool hotpluggable = vshCommandOptBool(cmd, "hotpluggable");
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
@@ -6752,6 +6874,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_VCPU_GUEST;
if (maximum)
flags |= VIR_DOMAIN_VCPU_MAXIMUM;
+ if (hotpluggable)
+ flags |= VIR_DOMAIN_VCPU_HOTPLUGGABLE;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -10648,6 +10772,10 @@ static const vshCmdOptDef opts_domdisplay[] = {
.help = N_("select particular graphical display "
"(e.g. \"vnc\", \"spice\", \"rdp\")")
},
+ {.name = "all",
+ .type = VSH_OT_BOOL,
+ .help = N_("show all possible graphical displays")
+ },
{.name = NULL}
};
@@ -10671,6 +10799,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
int tmp;
int flags = 0;
bool params = false;
+ bool all = vshCommandOptBool(cmd, "all");
const char *xpath_fmt = "string(/domain/devices/graphics[@type='%s']/%s)";
virSocketAddr addr;
@@ -10697,10 +10826,11 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
/* Attempt to grab our display info */
for (iter = 0; scheme[iter] != NULL; iter++) {
/* Particular scheme requested */
- if (type && STRNEQ(type, scheme[iter]))
+ if (!all && type && STRNEQ(type, scheme[iter]))
continue;
/* Create our XPATH lookup for the current display's port */
+ VIR_FREE(xpath);
if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "@port") < 0)
goto cleanup;
@@ -10733,6 +10863,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
/* Attempt to get the listening addr if set for the current
* graphics scheme */
+ VIR_FREE(listen_addr);
listen_addr = virXPathString(xpath, ctxt);
VIR_FREE(xpath);
@@ -10788,6 +10919,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
/* Attempt to get the password */
+ VIR_FREE(passwd);
passwd = virXPathString(xpath, ctxt);
VIR_FREE(xpath);
@@ -10840,12 +10972,17 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
}
/* Print out our full URI */
+ VIR_FREE(output);
output = virBufferContentAndReset(&buf);
vshPrint(ctl, "%s", output);
/* We got what we came for so return successfully */
ret = true;
- break;
+ if (!all) {
+ break;
+ } else {
+ vshPrint(ctl, "\n");
+ }
}
if (!ret) {
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index f302f9558..e8cef395b 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1050,7 +1050,9 @@ static const vshCmdInfo info_vol_resize[] = {
.data = N_("resize a vol")
},
{.name = "desc",
- .data = N_("Resizes a storage volume.")
+ .data = N_("Resizes a storage volume. This is safe only for storage "
+ "volumes not in use by an active guest.\n"
+ "See blockresize for live resizing.")
},
{.name = NULL}
};
diff --git a/tools/virsh.1.in b/tools/virsh.1.in
index 0dc62149a..0da3b4213 100644
--- a/tools/virsh.1.in
+++ b/tools/virsh.1.in
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
+.\" Automatically generated by Pod::Man 4.08 (Pod::Simple 3.32)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -129,7 +129,7 @@
.\" ========================================================================
.\"
.IX Title "VIRSH 1"
-.TH VIRSH 1 "2016-10-01" "libvirt-2.3.0" "Virtualization Support"
+.TH VIRSH 1 "2016-10-27" "libvirt-2.4.0" "Virtualization Support"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -152,7 +152,7 @@ under the \s-1GNU\s0 Lesser General Public License. Virtualization of the
Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the
basic resources are driven by a Linux instance. The library aims at
-providing a long term stable C \s-1API. \s0 It currently supports Xen, \s-1QEMU,
+providing a long term stable C \s-1API.\s0 It currently supports Xen, \s-1QEMU,
KVM, LXC,\s0 OpenVZ, VirtualBox and VMware \s-1ESX.\s0
.PP
The basic structure of most virsh usage is:
@@ -261,17 +261,17 @@ historical reasons, some commands default to bytes, while other
commands default to kibibytes). The following case-insensitive
suffixes can be used to select a specific scale:
b, byte byte 1
- \s-1KB \s0 kilobyte 1,000
+ \s-1KB\s0 kilobyte 1,000
k, KiB kibibyte 1,024
- \s-1MB \s0 megabyte 1,000,000
+ \s-1MB\s0 megabyte 1,000,000
M, MiB mebibyte 1,048,576
- \s-1GB \s0 gigabyte 1,000,000,000
+ \s-1GB\s0 gigabyte 1,000,000,000
G, GiB gibibyte 1,073,741,824
- \s-1TB \s0 terabyte 1,000,000,000,000
+ \s-1TB\s0 terabyte 1,000,000,000,000
T, TiB tebibyte 1,099,511,627,776
- \s-1PB \s0 petabyte 1,000,000,000,000,000
+ \s-1PB\s0 petabyte 1,000,000,000,000,000
P, PiB pebibyte 1,125,899,906,842,624
- \s-1EB \s0 exabyte 1,000,000,000,000,000,000
+ \s-1EB\s0 exabyte 1,000,000,000,000,000,000
E, EiB exbibyte 1,152,921,504,606,846,976
.SH "GENERIC COMMANDS"
.IX Header "GENERIC COMMANDS"
@@ -443,7 +443,7 @@ different numa nodes can be merged. When set to 0, only pages which physically
reside in the memory area of same \s-1NUMA\s0 node can be merged. When set to 1,
pages from all nodes can be merged. Default to 1.
.Sp
-\&\fBNote\fR: Currently the \*(L"shared memory service\*(R" only means \s-1KSM \s0(Kernel Samepage
+\&\fBNote\fR: Currently the \*(L"shared memory service\*(R" only means \s-1KSM\s0 (Kernel Samepage
Merging).
.IP "\fBcapabilities\fR" 4
.IX Item "capabilities"
@@ -517,7 +517,7 @@ The domain is currently running on a \s-1CPU\s0
.IP "\fBidle\fR" 4
.IX Item "idle"
The domain is idle, and not running or runnable. This can be caused
-because the domain is waiting on \s-1IO \s0(a traditional wait state) or has
+because the domain is waiting on \s-1IO\s0 (a traditional wait state) or has
gone to sleep because there was nothing else for it to do.
.IP "\fBpaused\fR" 4
.IX Item "paused"
@@ -920,6 +920,9 @@ default all supported statistics groups are returned. Supported
statistics groups flags are: \fI\-\-state\fR, \fI\-\-cpu\-total\fR, \fI\-\-balloon\fR,
\&\fI\-\-vcpu\fR, \fI\-\-interface\fR, \fI\-\-block\fR, \fI\-\-perf\fR.
.Sp
+Note that \- depending on the hypervisor type and version or the domain state
+\&\- not all of the following statistics may be returned.
+.Sp
When selecting the \fI\-\-state\fR group the following fields are returned:
\&\*(L"state.state\*(R" \- state of the \s-1VM,\s0 returned as number from virDomainState enum,
\&\*(L"state.reason\*(R" \- reason for entering given state, returned as int from
@@ -942,7 +945,7 @@ virDomain*Reason enum corresponding to given state.
\&\*(L"balloon.rss\*(R" \- Resident Set Size of running domain's process (in kB),
\&\*(L"balloon.usable\*(R" \- the amount of memory which can be reclaimed by balloon
without causing host swapping (in \s-1KB\s0),
-\&\*(L"balloon.last\-update\*(R" \- timestamp of the last update of statistics (in seconds),
+\&\*(L"balloon.last\-update\*(R" \- timestamp of the last update of statistics (in seconds)
.Sp
\&\fI\-\-vcpu\fR returns:
\&\*(L"vcpu.current\*(R" \- current number of online virtual CPUs,
@@ -950,6 +953,11 @@ without causing host swapping (in \s-1KB\s0),
\&\*(L"vcpu.<num>.state\*(R" \- state of the virtual \s-1CPU\s0 <num>, as number
from virVcpuState enum,
\&\*(L"vcpu.<num>.time\*(R" \- virtual cpu time spent by virtual \s-1CPU\s0 <num>
+ (in microseconds),
+\&\*(L"vcpu.<num>.wait\*(R" \- virtual cpu time spent by virtual \s-1CPU\s0 <num>
+waiting on I/O (in microseconds),
+\&\*(L"vcpu.<num>.halted\*(R" \- virtual \s-1CPU\s0 <num> is halted: yes or no (may indicate
+the processor is idle or even disabled, depending on the architecture)
.Sp
\&\fI\-\-interface\fR returns:
\&\*(L"net.count\*(R" \- number of network interfaces on this domain,
@@ -964,12 +972,12 @@ from virVcpuState enum,
\&\*(L"net.<num>.tx.drop\*(R" \- number of transmit packets dropped
.Sp
\&\fI\-\-perf\fR returns the statistics of all enabled perf events:
-\&\*(L"perf.cmt\*(R" \- the cache usage in Byte currently used
-\&\*(L"perf.mbmt\*(R" \- total system bandwidth from one level of cache
-\&\*(L"perf.mbml\*(R" \- bandwidth of memory traffic for a memory controller
-\&\*(L"perf.cpu_cycles\*(R" \- the number of cpu cycles one instruction needs
-\&\*(L"perf.instructions\*(R" \- the count of instructions
-\&\*(L"perf.cache_references\*(R" \- the count of cache hits
+\&\*(L"perf.cmt\*(R" \- the cache usage in Byte currently used,
+\&\*(L"perf.mbmt\*(R" \- total system bandwidth from one level of cache,
+\&\*(L"perf.mbml\*(R" \- bandwidth of memory traffic for a memory controller,
+\&\*(L"perf.cpu_cycles\*(R" \- the count of cpu cycles (total/elapsed),
+\&\*(L"perf.instructions\*(R" \- the count of instructions,
+\&\*(L"perf.cache_references\*(R" \- the count of cache hits,
\&\*(L"perf.cache_misses\*(R" \- the count of caches misses
.Sp
See the \fBperf\fR command for more details about each event.
@@ -1141,8 +1149,8 @@ also \fBdomblklist\fR for listing these names).
\&\fIbandwidth\fR specifies copying bandwidth limit in MiB/s. For further information
on the \fIbandwidth\fR argument see the corresponding section for the \fBblockjob\fR
command.
-.IP "\fBblkdeviotune\fR \fIdomain\fR \fIdevice\fR [[\fI\-\-config\fR] [\fI\-\-live\fR] | [\fI\-\-current\fR]] [[\fItotal-bytes-sec\fR] | [\fIread-bytes-sec\fR] [\fIwrite-bytes-sec\fR]] [[\fItotal-iops-sec\fR] | [\fIread-iops-sec\fR] [\fIwrite-iops-sec\fR]] [[\fItotal-bytes-sec-max\fR] | [\fIread-bytes-sec-max\fR] [\fIwrite-bytes-sec-max\fR]] [[\fItotal-iops-sec-max\fR] | [\fIread-iops-sec-max\fR] [\fIwrite-iops-sec-max\fR]] [\fIsize-iops-sec\fR]" 4
-.IX Item "blkdeviotune domain device [[--config] [--live] | [--current]] [[total-bytes-sec] | [read-bytes-sec] [write-bytes-sec]] [[total-iops-sec] | [read-iops-sec] [write-iops-sec]] [[total-bytes-sec-max] | [read-bytes-sec-max] [write-bytes-sec-max]] [[total-iops-sec-max] | [read-iops-sec-max] [write-iops-sec-max]] [size-iops-sec]"
+.IP "\fBblkdeviotune\fR \fIdomain\fR \fIdevice\fR [[\fI\-\-config\fR] [\fI\-\-live\fR] | [\fI\-\-current\fR]] [[\fItotal-bytes-sec\fR] | [\fIread-bytes-sec\fR] [\fIwrite-bytes-sec\fR]] [[\fItotal-iops-sec\fR] | [\fIread-iops-sec\fR] [\fIwrite-iops-sec\fR]] [[\fItotal-bytes-sec-max\fR] | [\fIread-bytes-sec-max\fR] [\fIwrite-bytes-sec-max\fR]] [[\fItotal-iops-sec-max\fR] | [\fIread-iops-sec-max\fR] [\fIwrite-iops-sec-max\fR]] [[\fItotal-bytes-sec-max-length\fR] | [\fIread-bytes-sec-max-length\fR] [\fIwrite-bytes-sec-max-length\fR]] [[\fItotal-iops-sec-max-length\fR] | [\fIread-iops-sec-max-length\fR] [\fIwrite-iops-sec-max-length\fR]] [\fIsize-iops-sec\fR]" 4
+.IX Item "blkdeviotune domain device [[--config] [--live] | [--current]] [[total-bytes-sec] | [read-bytes-sec] [write-bytes-sec]] [[total-iops-sec] | [read-iops-sec] [write-iops-sec]] [[total-bytes-sec-max] | [read-bytes-sec-max] [write-bytes-sec-max]] [[total-iops-sec-max] | [read-iops-sec-max] [write-iops-sec-max]] [[total-bytes-sec-max-length] | [read-bytes-sec-max-length] [write-bytes-sec-max-length]] [[total-iops-sec-max-length] | [read-iops-sec-max-length] [write-iops-sec-max-length]] [size-iops-sec]"
Set or query the block disk io parameters for a block device of \fIdomain\fR.
\&\fIdevice\fR specifies a unique target name (<target dev='name'/>) or source
file (<source file='name'/>) for one of the disk devices attached to
@@ -1168,6 +1176,18 @@ integer, the default being bytes per second if no suffix is specified.
\&\fI\-\-total\-iops\-sec\-max\fR specifies maximum total I/O operations limit per second.
\&\fI\-\-read\-iops\-sec\-max\fR specifies maximum read I/O operations limit per second.
\&\fI\-\-write\-iops\-sec\-max\fR specifies maximum write I/O operations limit per second.
+\&\fI\-\-total\-bytes\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+total throughput limit.
+\&\fI\-\-read\-bytes\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+read throughput limit.
+\&\fI\-\-write\-bytes\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+write throughput limit.
+\&\fI\-\-total\-iops\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+total I/O operations limit.
+\&\fI\-\-read\-iops\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+read I/O operations limit.
+\&\fI\-\-write\-iops\-sec\-max\-length\fR specifies duration in seconds to allow maximum
+write I/O operations limit.
\&\fI\-\-size\-iops\-sec\fR specifies size I/O operations limit per second.
.Sp
Older versions of virsh only accepted these options with underscore
@@ -1178,6 +1198,11 @@ as \-\-read\-bytes\-sec) resets the other two in that category to unlimited.
An explicit 0 also clears any limit. A non-zero value for a given total
cannot be mixed with non-zero values for read or write.
.Sp
+It is up to the hypervisor to determine how to handle the length values.
+For the qemu hypervisor, if an I/O limit value or maximum value is set,
+then the default value of 1 second will be displayed. Supplying a 0 will
+reset the value back to the default.
+.Sp
If \fI\-\-live\fR is specified, affect a running guest.
If \fI\-\-config\fR is specified, affect the next boot of a persistent guest.
If \fI\-\-current\fR is specified, affect the current guest state.
@@ -1233,18 +1258,19 @@ also \fBdomblklist\fR for listing these names).
(blocks of 1024 bytes) if there is no suffix. You must use a suffix of
\&\*(L"B\*(R" to get bytes (note that for historical reasons, this differs from
\&\fBvol-resize\fR which defaults to bytes without a suffix).
-.IP "\fBdomdisplay\fR \fIdomain\fR [\fI\-\-include\-password\fR] [[\fI\-\-type\fR] \fBtype\fR]" 4
-.IX Item "domdisplay domain [--include-password] [[--type] type]"
+.IP "\fBdomdisplay\fR \fIdomain\fR [\fI\-\-include\-password\fR] [[\fI\-\-type\fR] \fBtype\fR] [\fI\-\-all\fR]" 4
+.IX Item "domdisplay domain [--include-password] [[--type] type] [--all]"
Output a \s-1URI\s0 which can be used to connect to the graphical display of the
-domain via \s-1VNC, SPICE\s0 or \s-1RDP. \s0 The particular graphical display type can
+domain via \s-1VNC, SPICE\s0 or \s-1RDP.\s0 The particular graphical display type can
be selected using the \fBtype\fR parameter (e.g. \*(L"vnc\*(R", \*(L"spice\*(R", \*(L"rdp\*(R"). If
\&\fI\-\-include\-password\fR is specified, the \s-1SPICE\s0 channel password will be
-included in the \s-1URI.\s0
+included in the \s-1URI.\s0 If \fI\-\-all\fR is specified, then all show all possible
+graphical displays, for a \s-1VM\s0 could have more than one graphical displays.
.IP "\fBdomfsinfo\fR \fIdomain\fR" 4
.IX Item "domfsinfo domain"
Show a list of mounted filesystems within the running domain. The list contains
mountpoints, names of a mounted device in the guest, filesystem types, and
-unique target names used in the domain \s-1XML \s0(<target dev='name'/>).
+unique target names used in the domain \s-1XML\s0 (<target dev='name'/>).
.Sp
Note that this command requires a guest agent configured and running in the
domain's guest \s-1OS.\s0
@@ -1374,7 +1400,7 @@ lzo-compressed), kdump\-snappy(kdump\-compressed format with snappy-compressed).
.Sp
The progress may be monitored using \fBdomjobinfo\fR virsh command and canceled
with \fBdomjobabort\fR command (sent by another virsh instance). Another option
-is to send \s-1SIGINT \s0(usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
+is to send \s-1SIGINT\s0 (usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
\&\fBdump\fR command. \fI\-\-verbose\fR displays the progress of dump.
.Sp
\&\s-1NOTE:\s0 Some hypervisors may require the user to manually ensure proper
@@ -1424,7 +1450,7 @@ to use \fI\-\-all\fR instead of \fIevent\fR to register for all possible event
types at once.
.Sp
By default, this command is one-shot, and returns success once an event
-occurs; you can send \s-1SIGINT \s0(usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
+occurs; you can send \s-1SIGINT\s0 (usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
If \fI\-\-timeout\fR is specified, the command gives up waiting for events
after \fIseconds\fR have elapsed. With \fI\-\-loop\fR, the command prints all
events until a timeout or interrupt key.
@@ -1499,7 +1525,7 @@ cache, although this may slow down the operation.
.Sp
The progress may be monitored using \fBdomjobinfo\fR virsh command and canceled
with \fBdomjobabort\fR command (sent by another virsh instance). Another option
-is to send \s-1SIGINT \s0(usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
+is to send \s-1SIGINT\s0 (usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
\&\fBmanagedsave\fR command. \fI\-\-verbose\fR displays the progress of save.
.Sp
Normally, starting a managed save will decide between running or paused
@@ -1650,7 +1676,7 @@ seen from the source machine.
.RS 4
.Sp
When \fImigrateuri\fR is not specified, libvirt will automatically determine the
-hypervisor specific \s-1URI. \s0 Some hypervisors, including \s-1QEMU,\s0 have an optional
+hypervisor specific \s-1URI.\s0 Some hypervisors, including \s-1QEMU,\s0 have an optional
\&\*(L"migration_host\*(R" configuration parameter (useful when the host has multiple
network interfaces). If this is unspecified, libvirt determines a name
by looking up the target host's configured hostname.
@@ -1659,7 +1685,7 @@ There are a few scenarios where specifying \fImigrateuri\fR may help:
.IP "\(bu" 4
The configured hostname is incorrect, or \s-1DNS\s0 is broken. If a host has a
hostname which will not resolve to match one of its public \s-1IP\s0 addresses, then
-libvirt will generate an incorrect \s-1URI. \s0 In this case \fImigrateuri\fR should be
+libvirt will generate an incorrect \s-1URI.\s0 In this case \fImigrateuri\fR should be
explicitly specified, using an \s-1IP\s0 address, or a correct hostname.
.IP "\(bu" 4
The host has multiple network interfaces. If a host has multiple network
@@ -1742,7 +1768,7 @@ supported for a migration started with \fI\-\-postcopy\fR option.
.IP "\fBnumatune\fR \fIdomain\fR [\fI\-\-mode\fR \fBmode\fR] [\fI\-\-nodeset\fR \fBnodeset\fR] [[\fI\-\-config\fR] [\fI\-\-live\fR] | [\fI\-\-current\fR]]" 4
.IX Item "numatune domain [--mode mode] [--nodeset nodeset] [[--config] [--live] | [--current]]"
Set or get a domain's numa parameters, corresponding to the <numatune>
-element of domain \s-1XML. \s0 Without flags, the current settings are
+element of domain \s-1XML.\s0 Without flags, the current settings are
displayed.
.Sp
\&\fImode\fR can be one of `strict', `interleave' and `preferred' or any
@@ -1791,7 +1817,7 @@ cache, although this may slow down the operation.
.Sp
\&\fI\-\-xml\fR \fBfile\fR is usually omitted, but can be used to supply an
alternative \s-1XML\s0 file for use on the restored guest with changes only
-in the host-specific portions of the domain \s-1XML. \s0 For example, it can
+in the host-specific portions of the domain \s-1XML.\s0 For example, it can
be used to account for file naming differences in underlying storage
due to disk snapshots taken after the guest was saved.
.Sp
@@ -1816,7 +1842,7 @@ cache, although this may slow down the operation.
.Sp
The progress may be monitored using \fBdomjobinfo\fR virsh command and canceled
with \fBdomjobabort\fR command (sent by another virsh instance). Another option
-is to send \s-1SIGINT \s0(usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
+is to send \s-1SIGINT\s0 (usually with \f(CW\*(C`Ctrl\-C\*(C'\fR) to the virsh process running
\&\fBsave\fR command. \fI\-\-verbose\fR displays the progress of save.
.Sp
This is roughly equivalent to doing a hibernate on a running computer,
@@ -1825,7 +1851,7 @@ severed upon restore, as \s-1TCP\s0 timeouts may have expired.
.Sp
\&\fI\-\-xml\fR \fBfile\fR is usually omitted, but can be used to supply an
alternative \s-1XML\s0 file for use on the restored guest with changes only
-in the host-specific portions of the domain \s-1XML. \s0 For example, it can
+in the host-specific portions of the domain \s-1XML.\s0 For example, it can
be used to account for file naming differences that are planned to
be made via disk snapshots of underlying storage after the guest is saved.
.Sp
@@ -1843,7 +1869,7 @@ state, see the \fBsnapshot\fR family of commands.
Update the domain \s-1XML\s0 that will be used when \fIfile\fR is later
used in the \fBrestore\fR command. The \fIxml\fR argument must be a file
name containing the alternative \s-1XML,\s0 with changes only in the
-host-specific portions of the domain \s-1XML. \s0 For example, it can
+host-specific portions of the domain \s-1XML.\s0 For example, it can
be used to account for file naming differences resulting from creating
disk snapshots of underlying storage after the guest was saved.
.Sp
@@ -1887,14 +1913,14 @@ variables, and defaults to \f(CW\*(C`vi\*(C'\fR.
Allows you to show (and set) the domain scheduler parameters. The parameters
available for each hypervisor are:
.Sp
-\&\s-1LXC \s0(posix scheduler) : cpu_shares, vcpu_period, vcpu_quota
+\&\s-1LXC\s0 (posix scheduler) : cpu_shares, vcpu_period, vcpu_quota
.Sp
-\&\s-1QEMU/KVM \s0(posix scheduler): cpu_shares, vcpu_period, vcpu_quota,
+\&\s-1QEMU/KVM\s0 (posix scheduler): cpu_shares, vcpu_period, vcpu_quota,
emulator_period, emulator_quota, iothread_quota, iothread_period
.Sp
Xen (credit scheduler): weight, cap
.Sp
-\&\s-1ESX \s0(allocation scheduler): reservation, limit, shares
+\&\s-1ESX\s0 (allocation scheduler): reservation, limit, shares
.Sp
If \fI\-\-live\fR is specified, set scheduler information of a running guest.
If \fI\-\-config\fR is specified, affect the next boot of a persistent guest.
@@ -2169,9 +2195,10 @@ separated by commas. Valid event names are as follows:
applications running on th e platform.
instructions \- Provides the count of instructions executed
by applications running on the platform.
- cpu_cycles \- Provides the number of cpu_cycles for one
- instruction. May be used with instructions
- in order to get a cycles per instruction.
+ cpu_cycles \- Provides the count of cpu cycles
+ (total/elapsed). May be used with
+ instructions in order to get a cycles
+ per instruction.
.Sp
\&\fBNote\fR: The statistics can be retrieved using the \fBdomstats\fR command using
the \fI\-\-perf\fR flag.
@@ -2198,28 +2225,28 @@ any existing per-device weights for other devices remain unchanged.
\&\fBdevice-read-iops-sec\fR is a single string listing one or more device/read_iops_sec
pairs, int the format of /path/to/device,read_iops_sec,/path/to/device,read_iops_sec.
Each read_iops_sec is a number which type is unsigned int, value 0 to remove that
-device from per-decice listing.
+device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device read_iops_sec for other devices remain unchanged.
.Sp
\&\fBdevice-write-iops-sec\fR is a single string listing one or more device/write_iops_sec
pairs, int the format of /path/to/device,write_iops_sec,/path/to/device,write_iops_sec.
Each write_iops_sec is a number which type is unsigned int, value 0 to remove that
-device from per-decice listing.
+device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device write_iops_sec for other devices remain unchanged.
.Sp
\&\fBdevice-read-bytes-sec\fR is a single string listing one or more device/read_bytes_sec
pairs, int the format of /path/to/device,read_bytes_sec,/path/to/device,read_bytes_sec.
Each read_bytes_sec is a number which type is unsigned long long, value 0 to remove
-that device from per-decice listing.
+that device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device read_bytes_sec for other devices remain unchanged.
.Sp
\&\fBdevice-write-bytes-sec\fR is a single string listing one or more device/write_bytes_sec
pairs, int the format of /path/to/device,write_bytes_sec,/path/to/device,write_bytes_sec.
Each write_bytes_sec is a number which type is unsigned long long, value 0 to remove
-that device from per-decice listing.
+that device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device write_bytes_sec for other devices remain unchanged.
.Sp
@@ -2229,8 +2256,8 @@ If \fI\-\-current\fR is specified, affect the current guest state.
Both \fI\-\-live\fR and \fI\-\-config\fR flags may be given, but \fI\-\-current\fR is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
-.IP "\fBsetvcpus\fR \fIdomain\fR \fIcount\fR [\fI\-\-maximum\fR] [[\fI\-\-config\fR] [\fI\-\-live\fR] | [\fI\-\-current\fR]] [\fI\-\-guest\fR]" 4
-.IX Item "setvcpus domain count [--maximum] [[--config] [--live] | [--current]] [--guest]"
+.IP "\fBsetvcpus\fR \fIdomain\fR \fIcount\fR [\fI\-\-maximum\fR] [[\fI\-\-config\fR] [\fI\-\-live\fR] | [\fI\-\-current\fR]] [\fI\-\-guest\fR] [\fI\-\-hotpluggable\fR]" 4
+.IX Item "setvcpus domain count [--maximum] [[--config] [--live] | [--current]] [--guest] [--hotpluggable]"
Change the number of virtual CPUs active in a guest domain. By default,
this command works on active guest domains. To change the settings for an
inactive guest domain, use the \fI\-\-config\fR flag.
@@ -2261,6 +2288,11 @@ If \fI\-\-guest\fR is specified, then the count of cpus is modified in the guest
instead of the hypervisor. This flag is usable only for live domains
and may require guest agent to be configured in the guest.
.Sp
+To allow adding vcpus to persistent definitions that can be later hotunplugged
+after the domain is booted it is necessary to specify the \fI\-\-hotpluggable\fR
+flag. Vcpus added to live domains supporting vcpu unplug are automatically
+marked as hotpluggable.
+.Sp
The \fI\-\-maximum\fR flag controls the maximum number of virtual cpus that can
be hot-plugged the next time the domain is booted. As such, it must only be
used with the \fI\-\-config\fR flag, and not with the \fI\-\-live\fR or the \fI\-\-current\fR
@@ -2273,7 +2305,7 @@ succeed, and may take a variable length of time depending on what
services must be shutdown in the domain.
.Sp
The exact behavior of a domain when it shuts down is set by the
-\&\fIon_shutdown\fR parameter in the domain's \s-1XML\s0 definition.
+\&\fIon_poweroff\fR parameter in the domain's \s-1XML\s0 definition.
.Sp
If \fIdomain\fR is transient, then the metadata of any snapshots will
be lost once the guest stops running, but the snapshot contents still
@@ -2303,7 +2335,7 @@ managedsave state is discarded and a fresh boot occurs.
.Sp
If \fI\-\-pass\-fds\fR is specified, the argument is a comma separated list
of open file descriptors which should be pass on into the guest. The
-file descriptors will be re-numered in the guest, starting from 3. This
+file descriptors will be re-numbered in the guest, starting from 3. This
is only supported with container based virtualization.
.IP "\fBsuspend\fR \fIdomain\fR" 4
.IX Item "suspend domain"
@@ -2417,6 +2449,52 @@ Returns basic information about the domain virtual CPUs, like the number of
vCPUs, the running time, the affinity to physical processors.
.Sp
With \fI\-\-pretty\fR, cpu affinities are shown as ranges.
+.Sp
+An example output is
+.Sp
+.Vb 6
+\& $ virsh vcpuinfo fedora
+\& VCPU: 0
+\& CPU: 0
+\& State: running
+\& CPU time: 7,0s
+\& CPU Affinity: yyyy
+\&
+\& VCPU: 1
+\& CPU: 1
+\& State: running
+\& CPU time: 0,7s
+\& CPU Affinity: yyyy
+.Ve
+.Sp
+\&\fB\s-1STATES\s0\fR
+.Sp
+The State field displays the current operating state of a virtual \s-1CPU\s0
+.RS 4
+.IP "\fBoffline\fR" 4
+.IX Item "offline"
+The virtual \s-1CPU\s0 is offline and not usable by the domain.
+This state is not supported by all hypervisors.
+.IP "\fBrunning\fR" 4
+.IX Item "running"
+The virtual \s-1CPU\s0 is available to the domain and is operating.
+.IP "\fBblocked\fR" 4
+.IX Item "blocked"
+The virtual \s-1CPU\s0 is available to the domain but is waiting for a resource.
+This state is not supported by all hypervisors, in which case \fIrunning\fR
+may be reported instead.
+.IP "\fBno state\fR" 4
+.IX Item "no state"
+The virtual \s-1CPU\s0 state could not be determined. This could happen if
+the hypervisor is newer than virsh.
+.IP "\fBN/A\fR" 4
+.IX Item "N/A"
+There's no information about the virtual \s-1CPU\s0 state available. This can
+be the case if the domain is not running or the hypervisor does
+not report the virtual \s-1CPU\s0 state.
+.RE
+.RS 4
+.RE
.IP "\fBvcpupin\fR \fIdomain\fR [\fIvcpu\fR] [\fIcpulist\fR] [[\fI\-\-live\fR] [\fI\-\-config\fR] | [\fI\-\-current\fR]]" 4
.IX Item "vcpupin domain [vcpu] [cpulist] [[--live] [--config] | [--current]]"
Query or change the pinning of domain VCPUs to host physical CPUs. To
@@ -2697,7 +2775,7 @@ Note that older versions of virsh used \fI\-\-config\fR as an alias for
.IP "\fBupdate-device\fR \fIdomain\fR \fIfile\fR [\fI\-\-force\fR] [[[\fI\-\-live\fR] [\fI\-\-config\fR] | [\fI\-\-current\fR]] | [\fI\-\-persistent\fR]]" 4
.IX Item "update-device domain file [--force] [[[--live] [--config] | [--current]] | [--persistent]]"
Update the characteristics of a device associated with \fIdomain\fR,
-based on the device definition in an \s-1XML \s0\fIfile\fR. The \fI\-\-force\fR option
+based on the device definition in an \s-1XML\s0 \fIfile\fR. The \fI\-\-force\fR option
can be used to force device update, e.g., to eject a CD-ROM even if it is
locked/mounted in the domain. See the documentation at
<http://libvirt.org/formatdomain.html#elementsDevices> to learn about
@@ -2836,7 +2914,7 @@ of possible \fIevent\fR values known by this client, although the connection
might not allow registering for all these events.
.Sp
By default, this command is one-shot, and returns success once an event
-occurs; you can send \s-1SIGINT \s0(usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
+occurs; you can send \s-1SIGINT\s0 (usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
If \fI\-\-timeout\fR is specified, the command gives up waiting for events
after \fIseconds\fR have elapsed. With \fI\-\-loop\fR, the command prints all
events until a timeout or interrupt key.
@@ -2858,13 +2936,13 @@ The \fI\-\-disable\fR option disable autostarting.
.IP "\fBnet-create\fR \fIfile\fR" 4
.IX Item "net-create file"
Create a transient (temporary) virtual network from an
-\&\s-1XML \s0\fIfile\fR and instantiate (start) the network.
+\&\s-1XML\s0 \fIfile\fR and instantiate (start) the network.
See the documentation at <http://libvirt.org/formatnetwork.html>
to get a description of the \s-1XML\s0 network format used by libvirt.
.IP "\fBnet-define\fR \fIfile\fR" 4
.IX Item "net-define file"
Define an inactive persistent virtual network or modify an existing persistent
-one from the \s-1XML \s0\fIfile\fR.
+one from the \s-1XML\s0 \fIfile\fR.
.IP "\fBnet-destroy\fR \fInetwork\fR" 4
.IX Item "net-destroy network"
Destroy (stop) a given transient or persistent virtual network
@@ -2899,7 +2977,7 @@ of possible \fIevent\fR values known by this client, although the connection
might not allow registering for all these events.
.Sp
By default, this command is one-shot, and returns success once an event
-occurs; you can send \s-1SIGINT \s0(usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
+occurs; you can send \s-1SIGINT\s0 (usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
If \fI\-\-timeout\fR is specified, the command gives up waiting for events
after \fIseconds\fR have elapsed. With \fI\-\-loop\fR, the command prints all
events until a timeout or interrupt key.
@@ -3011,7 +3089,7 @@ See also \fBiface-unbridge\fR for undoing this operation.
.IP "\fBiface-define\fR \fIfile\fR" 4
.IX Item "iface-define file"
Define an inactive persistent physical host interface or modify an existing
-persistent one from the \s-1XML \s0\fIfile\fR.
+persistent one from the \s-1XML\s0 \fIfile\fR.
.IP "\fBiface-destroy\fR \fIinterface\fR" 4
.IX Item "iface-destroy interface"
Destroy (stop) a given host interface, such as by running \*(L"if-down\*(R" to
@@ -3164,7 +3242,7 @@ specified or it's been determined that the disk doesn't already have one,
by the pool source format type or \*(L"dos\*(R" if not specified for the pool.
.IP "\fBpool-create\fR \fIfile\fR [\fI\-\-build\fR] [[\fI\-\-overwrite\fR] | [\fI\-\-no\-overwrite\fR]]" 4
.IX Item "pool-create file [--build] [[--overwrite] | [--no-overwrite]]"
-Create and start a pool object from the \s-1XML \s0\fIfile\fR.
+Create and start a pool object from the \s-1XML\s0 \fIfile\fR.
.Sp
[\fI\-\-build\fR] [[\fI\-\-overwrite\fR] | [\fI\-\-no\-overwrite\fR]] perform a
\&\fBpool-build\fR after creation in order to remove the need for a
@@ -3222,7 +3300,7 @@ just \fI\-\-build\fR is provided, then \fBpool-build\fR is called with no flags.
.IP "\fBpool-define\fR \fIfile\fR" 4
.IX Item "pool-define file"
Define an inactive persistent storage pool or modify an existing persistent one
-from the \s-1XML \s0\fIfile\fR.
+from the \s-1XML\s0 \fIfile\fR.
.IP "\fBpool-define-as\fR \fIname\fR \fItype\fR [\fI\-\-print\-xml\fR] [\fI\-\-source\-host hostname\fR] [\fI\-\-source\-path path\fR] [\fI\-\-source\-dev path\fR] [\fI\-\-source\-name name\fR] [\fI\-\-target path\fR] [\fI\-\-source\-format format\fR] [\fI\-\-auth\-type authtype\fR \fI\-\-auth\-username username\fR \fI\-\-secret\-usage usage\fR] [[\fI\-\-adapter\-name name\fR] | [\fI\-\-adapter\-wwnn\fR \fI\-\-adapter\-wwpn\fR] [\fI\-\-adapter\-parent parent\fR]]" 4
.IX Item "pool-define-as name type [--print-xml] [--source-host hostname] [--source-path path] [--source-dev path] [--source-name name] [--target path] [--source-format format] [--auth-type authtype --auth-username username --secret-usage usage] [[--adapter-name name] | [--adapter-wwnn --adapter-wwpn] [--adapter-parent parent]]"
Create, but do not start, a pool object \fIname\fR from the raw parameters. If
@@ -3330,7 +3408,7 @@ of possible \fIevent\fR values known by this client, although the connection
might not allow registering for all these events.
.Sp
By default, this command is one-shot, and returns success once an event
-occurs; you can send \s-1SIGINT \s0(usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
+occurs; you can send \s-1SIGINT\s0 (usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
If \fI\-\-timeout\fR is specified, the command gives up waiting for events
after \fIseconds\fR have elapsed. With \fI\-\-loop\fR, the command prints all
events until a timeout or interrupt key.
@@ -3466,7 +3544,7 @@ volume with zeroes. This can be done via \fI\-\-algorithm\fR switch.
.Sp
\&\fBSupported algorithms\fR
zero \- 1\-pass all zeroes
- nnsa \- 4\-pass \s-1NNSA\s0 Policy Letter \s-1NAP\-14.1\-C \s0(\s-1XVI\-8\s0) for
+ nnsa \- 4\-pass \s-1NNSA\s0 Policy Letter \s-1NAP\-14.1\-C\s0 (\s-1XVI\-8\s0) for
sanitizing removable and non-removable hard disks:
random x2, 0x00, verify.
dod \- 4\-pass DoD 5220.22\-M section 8\-306 procedure for
@@ -3557,7 +3635,7 @@ for storage volumes not in use by an active guest; see also
The following commands manipulate \*(L"secrets\*(R" (e.g. passwords, passphrases and
encryption keys). Libvirt can store secrets independently from their use, and
other objects (e.g. volumes or domains) can refer to the secrets for encryption
-or possibly other uses. Secrets are identified using a \s-1UUID. \s0 See
+or possibly other uses. Secrets are identified using a \s-1UUID.\s0 See
<http://libvirt.org/formatsecret.html> for documentation of the \s-1XML\s0 format
used to represent properties of secrets.
.IP "\fBsecret-define\fR \fIfile\fR" 4
@@ -3687,8 +3765,8 @@ literal comma in \fBdisk\fR or in \fBfile=name\fR, escape it with a second
comma. A literal \fI\-\-diskspec\fR must precede each \fBdiskspec\fR unless
all three of \fIdomain\fR, \fIname\fR, and \fIdescription\fR are also present.
For example, a diskspec of \*(L"vda,snapshot=external,file=/path/to,,new\*(R"
-results in the following \s-1XML:
- \s0 <disk name='vda' snapshot='external'>
+results in the following \s-1XML:\s0
+ <disk name='vda' snapshot='external'>
<source file='/path/to,new'/>
</disk>
.Sp
@@ -3951,7 +4029,7 @@ Send an arbitrary monitor command \fIcommand\fR to domain \fIdomain\fR through t
qemu monitor. The results of the command will be printed on stdout. If
\&\fI\-\-hmp\fR is passed, the command is considered to be a human monitor command
and libvirt will automatically convert it into \s-1QMP\s0 if needed. In that case
-the result will also be converted back from \s-1QMP. \s0 If \fI\-\-pretty\fR is given,
+the result will also be converted back from \s-1QMP.\s0 If \fI\-\-pretty\fR is given,
and the monitor uses \s-1QMP,\s0 then the output will be pretty-printed. If more
than one argument is provided for \fIcommand\fR, they are concatenated with a
space in between before passing the single command to the monitor.
@@ -3975,7 +4053,7 @@ instead of a literal string. If \fI\-\-no\-case\fR is used, \fIevent-name\fR
will match case-insensitively.
.Sp
By default, this command is one-shot, and returns success once an event
-occurs; you can send \s-1SIGINT \s0(usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
+occurs; you can send \s-1SIGINT\s0 (usually via \f(CW\*(C`Ctrl\-C\*(C'\fR) to quit immediately.
If \fI\-\-timeout\fR is specified, the command gives up waiting for events
after \fIseconds\fR have elapsed. With \fI\-\-loop\fR, the command prints all
events until a timeout or interrupt key. If \fI\-\-pretty\fR is specified,
@@ -4008,23 +4086,23 @@ Turn on verbose debugging of virsh commands. Valid levels are
.IP "\(bu" 4
VIRSH_DEBUG=0
.Sp
-\&\s-1DEBUG \-\s0 Messages at \s-1ALL\s0 levels get logged
+\&\s-1DEBUG\s0 \- Messages at \s-1ALL\s0 levels get logged
.IP "\(bu" 4
VIRSH_DEBUG=1
.Sp
-\&\s-1INFO \-\s0 Logs messages at levels \s-1INFO, NOTICE, WARNING\s0 and \s-1ERROR\s0
+\&\s-1INFO\s0 \- Logs messages at levels \s-1INFO, NOTICE, WARNING\s0 and \s-1ERROR\s0
.IP "\(bu" 4
VIRSH_DEBUG=2
.Sp
-\&\s-1NOTICE \-\s0 Logs messages at levels \s-1NOTICE, WARNING\s0 and \s-1ERROR\s0
+\&\s-1NOTICE\s0 \- Logs messages at levels \s-1NOTICE, WARNING\s0 and \s-1ERROR\s0
.IP "\(bu" 4
VIRSH_DEBUG=3
.Sp
-\&\s-1WARNING \-\s0 Logs messages at levels \s-1WARNING\s0 and \s-1ERROR\s0
+\&\s-1WARNING\s0 \- Logs messages at levels \s-1WARNING\s0 and \s-1ERROR\s0
.IP "\(bu" 4
VIRSH_DEBUG=4
.Sp
-\&\s-1ERROR \-\s0 Messages at only \s-1ERROR\s0 level gets logged.
+\&\s-1ERROR\s0 \- Messages at only \s-1ERROR\s0 level gets logged.
.RE
.RS 4
.RE
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 971b40836..f278fecaf 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -887,6 +887,9 @@ default all supported statistics groups are returned. Supported
statistics groups flags are: I<--state>, I<--cpu-total>, I<--balloon>,
I<--vcpu>, I<--interface>, I<--block>, I<--perf>.
+Note that - depending on the hypervisor type and version or the domain state
+- not all of the following statistics may be returned.
+
When selecting the I<--state> group the following fields are returned:
"state.state" - state of the VM, returned as number from virDomainState enum,
"state.reason" - reason for entering given state, returned as int from
@@ -909,7 +912,7 @@ I<--balloon> returns:
"balloon.rss" - Resident Set Size of running domain's process (in kB),
"balloon.usable" - the amount of memory which can be reclaimed by balloon
without causing host swapping (in KB),
-"balloon.last-update" - timestamp of the last update of statistics (in seconds),
+"balloon.last-update" - timestamp of the last update of statistics (in seconds)
I<--vcpu> returns:
"vcpu.current" - current number of online virtual CPUs,
@@ -917,6 +920,11 @@ I<--vcpu> returns:
"vcpu.<num>.state" - state of the virtual CPU <num>, as number
from virVcpuState enum,
"vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num>
+ (in microseconds),
+"vcpu.<num>.wait" - virtual cpu time spent by virtual CPU <num>
+waiting on I/O (in microseconds),
+"vcpu.<num>.halted" - virtual CPU <num> is halted: yes or no (may indicate
+the processor is idle or even disabled, depending on the architecture)
I<--interface> returns:
"net.count" - number of network interfaces on this domain,
@@ -931,12 +939,12 @@ I<--interface> returns:
"net.<num>.tx.drop" - number of transmit packets dropped
I<--perf> returns the statistics of all enabled perf events:
-"perf.cmt" - the cache usage in Byte currently used
-"perf.mbmt" - total system bandwidth from one level of cache
-"perf.mbml" - bandwidth of memory traffic for a memory controller
-"perf.cpu_cycles" - the number of cpu cycles one instruction needs
-"perf.instructions" - the count of instructions
-"perf.cache_references" - the count of cache hits
+"perf.cmt" - the cache usage in Byte currently used,
+"perf.mbmt" - total system bandwidth from one level of cache,
+"perf.mbml" - bandwidth of memory traffic for a memory controller,
+"perf.cpu_cycles" - the count of cpu cycles (total/elapsed),
+"perf.instructions" - the count of instructions,
+"perf.cache_references" - the count of cache hits,
"perf.cache_misses" - the count of caches misses
See the B<perf> command for more details about each event.
@@ -1127,6 +1135,10 @@ command.
[[I<total-iops-sec>] | [I<read-iops-sec>] [I<write-iops-sec>]]
[[I<total-bytes-sec-max>] | [I<read-bytes-sec-max>] [I<write-bytes-sec-max>]]
[[I<total-iops-sec-max>] | [I<read-iops-sec-max>] [I<write-iops-sec-max>]]
+[[I<total-bytes-sec-max-length>] |
+[I<read-bytes-sec-max-length>] [I<write-bytes-sec-max-length>]]
+[[I<total-iops-sec-max-length>] |
+[I<read-iops-sec-max-length>] [I<write-iops-sec-max-length>]]
[I<size-iops-sec>]
Set or query the block disk io parameters for a block device of I<domain>.
@@ -1154,6 +1166,18 @@ integer, the default being bytes per second if no suffix is specified.
I<--total-iops-sec-max> specifies maximum total I/O operations limit per second.
I<--read-iops-sec-max> specifies maximum read I/O operations limit per second.
I<--write-iops-sec-max> specifies maximum write I/O operations limit per second.
+I<--total-bytes-sec-max-length> specifies duration in seconds to allow maximum
+total throughput limit.
+I<--read-bytes-sec-max-length> specifies duration in seconds to allow maximum
+read throughput limit.
+I<--write-bytes-sec-max-length> specifies duration in seconds to allow maximum
+write throughput limit.
+I<--total-iops-sec-max-length> specifies duration in seconds to allow maximum
+total I/O operations limit.
+I<--read-iops-sec-max-length> specifies duration in seconds to allow maximum
+read I/O operations limit.
+I<--write-iops-sec-max-length> specifies duration in seconds to allow maximum
+write I/O operations limit.
I<--size-iops-sec> specifies size I/O operations limit per second.
Older versions of virsh only accepted these options with underscore
@@ -1164,6 +1188,11 @@ as --read-bytes-sec) resets the other two in that category to unlimited.
An explicit 0 also clears any limit. A non-zero value for a given total
cannot be mixed with non-zero values for read or write.
+It is up to the hypervisor to determine how to handle the length values.
+For the qemu hypervisor, if an I/O limit value or maximum value is set,
+then the default value of 1 second will be displayed. Supplying a 0 will
+reset the value back to the default.
+
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
@@ -1223,13 +1252,15 @@ I<size> is a scaled integer (see B<NOTES> above) which defaults to KiB
"B" to get bytes (note that for historical reasons, this differs from
B<vol-resize> which defaults to bytes without a suffix).
-=item B<domdisplay> I<domain> [I<--include-password>] [[I<--type>] B<type>]
+=item B<domdisplay> I<domain> [I<--include-password>]
+[[I<--type>] B<type>] [I<--all>]
Output a URI which can be used to connect to the graphical display of the
domain via VNC, SPICE or RDP. The particular graphical display type can
be selected using the B<type> parameter (e.g. "vnc", "spice", "rdp"). If
I<--include-password> is specified, the SPICE channel password will be
-included in the URI.
+included in the URI. If I<--all> is specified, then all show all possible
+graphical displays, for a VM could have more than one graphical displays.
=item B<domfsinfo> I<domain>
@@ -2247,9 +2278,10 @@ B<Valid perf event names>
applications running on th e platform.
instructions - Provides the count of instructions executed
by applications running on the platform.
- cpu_cycles - Provides the number of cpu_cycles for one
- instruction. May be used with instructions
- in order to get a cycles per instruction.
+ cpu_cycles - Provides the count of cpu cycles
+ (total/elapsed). May be used with
+ instructions in order to get a cycles
+ per instruction.
B<Note>: The statistics can be retrieved using the B<domstats> command using
the I<--perf> flag.
@@ -2283,28 +2315,28 @@ any existing per-device weights for other devices remain unchanged.
B<device-read-iops-sec> is a single string listing one or more device/read_iops_sec
pairs, int the format of /path/to/device,read_iops_sec,/path/to/device,read_iops_sec.
Each read_iops_sec is a number which type is unsigned int, value 0 to remove that
-device from per-decice listing.
+device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device read_iops_sec for other devices remain unchanged.
B<device-write-iops-sec> is a single string listing one or more device/write_iops_sec
pairs, int the format of /path/to/device,write_iops_sec,/path/to/device,write_iops_sec.
Each write_iops_sec is a number which type is unsigned int, value 0 to remove that
-device from per-decice listing.
+device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device write_iops_sec for other devices remain unchanged.
B<device-read-bytes-sec> is a single string listing one or more device/read_bytes_sec
pairs, int the format of /path/to/device,read_bytes_sec,/path/to/device,read_bytes_sec.
Each read_bytes_sec is a number which type is unsigned long long, value 0 to remove
-that device from per-decice listing.
+that device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device read_bytes_sec for other devices remain unchanged.
B<device-write-bytes-sec> is a single string listing one or more device/write_bytes_sec
pairs, int the format of /path/to/device,write_bytes_sec,/path/to/device,write_bytes_sec.
Each write_bytes_sec is a number which type is unsigned long long, value 0 to remove
-that device from per-decice listing.
+that device from per-device listing.
Only the devices listed in the string are modified;
any existing per-device write_bytes_sec for other devices remain unchanged.
@@ -2316,7 +2348,7 @@ exclusive. If no flag is specified, behavior is different depending
on hypervisor.
=item B<setvcpus> I<domain> I<count> [I<--maximum>] [[I<--config>]
-[I<--live>] | [I<--current>]] [I<--guest>]
+[I<--live>] | [I<--current>]] [I<--guest>] [I<--hotpluggable>]
Change the number of virtual CPUs active in a guest domain. By default,
this command works on active guest domains. To change the settings for an
@@ -2348,6 +2380,11 @@ If I<--guest> is specified, then the count of cpus is modified in the guest
instead of the hypervisor. This flag is usable only for live domains
and may require guest agent to be configured in the guest.
+To allow adding vcpus to persistent definitions that can be later hotunplugged
+after the domain is booted it is necessary to specify the I<--hotpluggable>
+flag. Vcpus added to live domains supporting vcpu unplug are automatically
+marked as hotpluggable.
+
The I<--maximum> flag controls the maximum number of virtual cpus that can
be hot-plugged the next time the domain is booted. As such, it must only be
used with the I<--config> flag, and not with the I<--live> or the I<--current>
@@ -2361,7 +2398,7 @@ succeed, and may take a variable length of time depending on what
services must be shutdown in the domain.
The exact behavior of a domain when it shuts down is set by the
-I<on_shutdown> parameter in the domain's XML definition.
+I<on_poweroff> parameter in the domain's XML definition.
If I<domain> is transient, then the metadata of any snapshots will
be lost once the guest stops running, but the snapshot contents still
@@ -2393,7 +2430,7 @@ managedsave state is discarded and a fresh boot occurs.
If I<--pass-fds> is specified, the argument is a comma separated list
of open file descriptors which should be pass on into the guest. The
-file descriptors will be re-numered in the guest, starting from 3. This
+file descriptors will be re-numbered in the guest, starting from 3. This
is only supported with container based virtualization.
=item B<suspend> I<domain>
@@ -2521,6 +2558,55 @@ vCPUs, the running time, the affinity to physical processors.
With I<--pretty>, cpu affinities are shown as ranges.
+An example output is
+
+ $ virsh vcpuinfo fedora
+ VCPU: 0
+ CPU: 0
+ State: running
+ CPU time: 7,0s
+ CPU Affinity: yyyy
+
+ VCPU: 1
+ CPU: 1
+ State: running
+ CPU time: 0,7s
+ CPU Affinity: yyyy
+
+B<STATES>
+
+The State field displays the current operating state of a virtual CPU
+
+=over 4
+
+=item B<offline>
+
+The virtual CPU is offline and not usable by the domain.
+This state is not supported by all hypervisors.
+
+=item B<running>
+
+The virtual CPU is available to the domain and is operating.
+
+=item B<blocked>
+
+The virtual CPU is available to the domain but is waiting for a resource.
+This state is not supported by all hypervisors, in which case I<running>
+may be reported instead.
+
+=item B<no state>
+
+The virtual CPU state could not be determined. This could happen if
+the hypervisor is newer than virsh.
+
+=item B<N/A>
+
+There's no information about the virtual CPU state available. This can
+be the case if the domain is not running or the hypervisor does
+not report the virtual CPU state.
+
+=back
+
=item B<vcpupin> I<domain> [I<vcpu>] [I<cpulist>] [[I<--live>]
[I<--config>] | [I<--current>]]
diff --git a/tools/vsh.c b/tools/vsh.c
index cdd1cba81..9558dadb6 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -1523,10 +1523,11 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
/* if we encountered --help, replace parsed command with
* 'help <cmdname>' */
for (tmpopt = first; tmpopt; tmpopt = tmpopt->next) {
+ const vshCmdDef *help;
if (STRNEQ(tmpopt->def->name, "help"))
continue;
- const vshCmdDef *help = vshCmddefSearch("help");
+ help = vshCmddefSearch("help");
vshCommandOptFree(first);
first = vshMalloc(ctl, sizeof(vshCmdOpt));
first->def = help->opts;
@@ -2619,7 +2620,6 @@ vshReadlineOptionsGenerator(const char *text, int state, const vshCmdDef *cmd_pa
return NULL;
while ((name = cmd->opts[list_index].name)) {
- const vshCmdOptDef *opt = &cmd->opts[list_index];
char *res;
list_index++;
@@ -2648,7 +2648,7 @@ vshReadlineParse(const char *text, int state)
static vshCommandParser parser, sanitizer;
vshCommandToken tk;
static const vshCmdDef *cmd;
- const vshCmdOptDef *opt;
+ const vshCmdOptDef *opt = NULL;
char *tkdata, *optstr, *const_tkdata, *completed_name;
char *res = NULL;
static char *ctext, *sanitized_text;
@@ -2789,7 +2789,7 @@ vshReadlineParse(const char *text, int state)
* Try to find the default option.
*/
if (!(opt = vshCmddefGetData(cmd, &opts_need_arg, &opts_seen))
- && opt->type == VSH_OT_BOOL)
+ || opt->type == VSH_OT_BOOL)
goto error;
opt_exists = true;
opts_need_arg = const_opts_need_arg;
@@ -2825,7 +2825,7 @@ vshReadlineParse(const char *text, int state)
res = vshReadlineCommandGenerator(sanitized_text, state);
} else if (opts_filled && !non_bool_opt_exists) {
res = vshReadlineOptionsGenerator(sanitized_text, state, cmd);
- } else if (non_bool_opt_exists && data_complete && opt->completer) {
+ } else if (non_bool_opt_exists && data_complete && opt && opt->completer) {
if (!completed_list)
completed_list = opt->completer(autoCompleteOpaque,
opt->completer_flags);