[libvirt] [PATCH v2 0/8] Introduce New API virDomainUndefineFlags
by Osier Yang
Per discussion on
https://www.redhat.com/archives/libvir-list/2011-July/msg00556.html,
This patch series introduce new API virDomainUndefineFlags, which
only support flag VIR_DOMAIN_UNDEFINE_MANAGED_STATE now, might introduce
more flags in future though.
If the domain has a managed state file, then including
VIR_DOMAIN_UNDEFINE_MANAGED_STATE in @flags will also remove that file,
and omitting the flag will cause the undefine process to fail. This
also changes the behavior of virDomainUndefine, but considering undefine
a domain with managed state file left is unsafe, we need to do so.
[PATCH v2 1/8] is small fix on rpc generator scripts, not related with the
new API.
[PATCH v2 1/8] rpc: Fix typos in rpc generator scripts
[PATCH v2 2/8] undefine: Define the new API
[PATCH v2 3/8] undefine: Wire up the remote protocol
[PATCH v2 4/8] undefine: Implement internal API for qemu driver
[PATCH v2 5/8] undefine: Implement internal API for libxl driver
[PATCH v2 6/8] undefine: Implement undefineFlags in all other
[PATCH v2 7/8] undefine: Extend virsh undefine to support the new
[PATCH v2 8/8] virsh: Extend virsh dominfo to display if managed
v1 - v2:
* s/virDomainUndefineWithFlags/virDomainUndefineFlags/
* Update with other bunch of feedbacks from Eric
* Changes on virsh dominfo to display if domain managed state exists
Regards
Osier
13 years, 4 months
[libvirt] [PATCH] doc: Correct docs for iface commands
by Osier Yang
duplicate documents for "iface-name", lacks of document for
"iface-mac", inconsistent option names with virsh help strings.
---
tools/virsh.pod | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 377fac0..4f218d3 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1081,20 +1081,24 @@ Returns the list of active host interfaces. If I<--all> is specified
this will also include defined but inactive interfaces. If
I<--inactive> is specified only the inactive ones will be listed.
-=item B<iface-name> I<iface-MAC>
+=item B<iface-name> I<interface>
-Convert a host interface MAC to interface name, if the I<iface-MAC> is
-unique among the host's interfaces.
+Convert a host interface MAC to interface name, if the MAC address is unique
+among the host's interfaces.
-=item B<iface-name> I<iface-MAC>
+I<interface> specifies the interface MAC address.
+
+=item B<iface-mac> I<interface>
Convert a host interface name to MAC address.
-=item B<iface-start> I<iface>
+I<interface> specifies the interface name.
+
+=item B<iface-start> I<interface>
Start a (previously defined) host interface, such as by running "if-up".
-=item B<iface-undefine> I<iface>
+=item B<iface-undefine> I<interface>
Undefine the configuration for an inactive host interface.
--
1.7.6
13 years, 4 months
[libvirt] [PATCHv4] libvirt: do not mix internal flags into public API
by Eric Blake
There were two API in driver.c that were silently masking flags
bits prior to calling out to the drivers, and several others
that were explicitly masking flags bits. This is not
forward-compatible - if we ever have that many flags in the
future, then talking to an old server that masks out the
flags would be indistinguishable from talking to a new server
that can honor the flag. In general, libvirt.c should forward
_all_ flags on to drivers, and only the drivers should reject
unknown flags.
In the case of virDrvSecretGetValue, the solution is to separate
the internal driver callback function to have two parameters
instead of one, with only one parameter affected by the public
API. In the case of virDomainGetXMLDesc, it turns out that
no one was ever mixing VIR_DOMAIN_XML_INTERNAL_STATUS with
the dumpxml path in the first place; that internal flag was
only used in saving and restoring state files, which happened
to be in functions internal to a single file, so there is no
mixing of the internal flag with a public flags argument.
Additionally, virDomainMemoryStats passed a flags argument
over RPC, but not to the driver.
* src/driver.h (VIR_DOMAIN_XML_FLAGS_MASK)
(VIR_SECRET_GET_VALUE_FLAGS_MASK): Delete.
(virDrvSecretGetValue): Separate out internal flags.
(virDrvDomainMemoryStats): Provide missing flags argument.
* src/driver.c (verify): Drop unused check.
* src/conf/domain_conf.h (virDomainObjParseFile): Delete
declaration.
(virDomainXMLInternalFlags): Move...
* src/conf/domain_conf.c: ...here. Delete redundant include.
(virDomainObjParseFile): Make static.
* src/libvirt.c (virDomainGetXMLDesc, virSecretGetValue): Update
clients.
(virDomainMemoryPeek, virInterfaceGetXMLDesc)
(virDomainMemoryStats, virDomainBlockPeek, virNetworkGetXMLDesc)
(virStoragePoolGetXMLDesc, virStorageVolGetXMLDesc)
(virNodeNumOfDevices, virNodeListDevices, virNWFilterGetXMLDesc):
Don't mask unknown flags.
* src/interface/netcf_driver.c (interfaceGetXMLDesc): Reject
unknown flags.
* src/secret/secret_driver.c (secretGetValue): Update clients.
* src/remote/remote_driver.c (remoteSecretGetValue)
(remoteDomainMemoryStats): Likewise.
* src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainMemoryStats): Likewise.
* daemon/remote.c (remoteDispatchDomainMemoryStats): Likewise.
---
v4: fix even more public libvirt API flag masking
v3 at https://www.redhat.com/archives/libvir-list/2011-July/msg00894.html
daemon/remote.c | 2 +-
src/conf/domain_conf.c | 16 +++++++++----
src/conf/domain_conf.h | 10 --------
src/driver.c | 4 ---
src/driver.h | 16 +++++--------
src/interface/netcf_driver.c | 2 +
src/libvirt.c | 51 +++++------------------------------------
src/qemu/qemu_driver.c | 5 +++-
src/qemu/qemu_process.c | 2 +-
src/remote/remote_driver.c | 13 ++++++++--
src/secret/secret_driver.c | 7 ++++-
11 files changed, 47 insertions(+), 81 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index e93a0dc..daad39d 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -810,7 +810,7 @@ remoteDispatchDomainMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, 0);
+ nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, args->flags);
if (nr_stats < 0)
goto cleanup;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8c3e44e..3c3ab39 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -48,7 +48,6 @@
#include "storage_file.h"
#include "files.h"
#include "bitmap.h"
-#include "verify.h"
#include "count-one-bits.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
@@ -57,6 +56,12 @@
* verify that it doesn't overflow an unsigned int when shifting */
verify(VIR_DOMAIN_VIRT_LAST <= 32);
+/* Private flag used internally by virDomainSaveStatus and
+ * virDomainObjParseFile. */
+typedef enum {
+ VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), /* dump internal domain status information */
+} virDomainXMLInternalFlags;
+
VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
"custom-argv",
"custom-monitor",
@@ -6995,10 +7000,11 @@ cleanup:
}
-virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
- const char *filename,
- unsigned int expectedVirtTypes,
- unsigned int flags)
+static virDomainObjPtr
+virDomainObjParseFile(virCapsPtr caps,
+ const char *filename,
+ unsigned int expectedVirtTypes,
+ unsigned int flags)
{
xmlDocPtr xml;
virDomainObjPtr obj = NULL;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 172d3c2..7a3d72b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -41,11 +41,6 @@
# include "macvtap.h"
# include "sysinfo.h"
-/* Private component of virDomainXMLFlags */
-typedef enum {
- VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), /* dump internal domain status information */
-} virDomainXMLInternalFlags;
-
/* Different types of hypervisor */
/* NB: Keep in sync with virDomainVirtTypeToString impl */
enum virDomainVirtType {
@@ -1417,11 +1412,6 @@ virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
unsigned int expectedVirtTypes,
unsigned int flags);
-virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
- const char *filename,
- unsigned int expectedVirtTypes,
- unsigned int flags);
-
bool virDomainDefCheckABIStability(virDomainDefPtr src,
virDomainDefPtr dst);
diff --git a/src/driver.c b/src/driver.c
index 579c2b3..5034277 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -32,10 +32,6 @@
#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
-/* Make sure ... INTERNAL_CALL cannot be set by the caller */
-verify((VIR_SECRET_GET_VALUE_INTERNAL_CALL &
- VIR_SECRET_GET_VALUE_FLAGS_MASK) == 0);
-
#ifdef WITH_DRIVER_MODULES
/* XXX re-implment this for other OS, or use libtools helper lib ? */
diff --git a/src/driver.h b/src/driver.h
index 70ea4c2..9d0d3de 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -191,7 +191,7 @@ typedef char *
unsigned int flags);
typedef char *
(*virDrvDomainGetXMLDesc) (virDomainPtr dom,
- unsigned int flags);
+ unsigned int flags);
typedef char *
(*virDrvConnectDomainXMLFromNative) (virConnectPtr conn,
const char *nativeFormat,
@@ -331,7 +331,8 @@ typedef int
(*virDrvDomainMemoryStats)
(virDomainPtr domain,
struct _virDomainMemoryStat *stats,
- unsigned int nr_stats);
+ unsigned int nr_stats,
+ unsigned int flags);
typedef int
(*virDrvDomainBlockPeek)
@@ -1229,16 +1230,10 @@ struct _virDeviceMonitor {
virDrvNodeDeviceDestroy deviceDestroy;
};
-/* bits 16 and above of virDomainXMLFlags are for internal use */
-# define VIR_DOMAIN_XML_FLAGS_MASK 0xffff
-
-/* Bits 16 and above of virSecretGetValue flags are for internal use */
-# define VIR_SECRET_GET_VALUE_FLAGS_MASK 0xffff
-
enum {
/* This getValue call is inside libvirt, override the "private" flag.
This flag cannot be set by outside callers. */
- VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 16
+ VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 0,
};
typedef virSecretPtr
@@ -1263,7 +1258,8 @@ typedef int
typedef unsigned char *
(*virDrvSecretGetValue) (virSecretPtr secret,
size_t *value_size,
- unsigned int flags);
+ unsigned int flags,
+ unsigned int internalFlags);
typedef int
(*virDrvSecretUndefine) (virSecretPtr secret);
typedef int
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index 855b5a3..2f322b4 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -344,6 +344,8 @@ static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
virInterfaceDefPtr ifacedef = NULL;
char *ret = NULL;
+ virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
+
interfaceDriverLock(driver);
iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
diff --git a/src/libvirt.c b/src/libvirt.c
index 7c68bd8..4de718d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3381,8 +3381,6 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
goto error;
}
- flags &= VIR_DOMAIN_XML_FLAGS_MASK;
-
if (conn->driver->domainGetXMLDesc) {
char *ret;
ret = conn->driver->domainGetXMLDesc(domain, flags);
@@ -6031,11 +6029,6 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats,
virDispatchError(NULL);
return -1;
}
- if (flags != 0) {
- virLibDomainError(VIR_ERR_INVALID_ARG,
- _("flags must be zero"));
- goto error;
- }
if (!stats || nr_stats == 0)
return 0;
@@ -6045,7 +6038,8 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats,
conn = dom->conn;
if (conn->driver->domainMemoryStats) {
- nr_stats_ret = conn->driver->domainMemoryStats (dom, stats, nr_stats);
+ nr_stats_ret = conn->driver->domainMemoryStats (dom, stats, nr_stats,
+ flags);
if (nr_stats_ret == -1)
goto error;
return nr_stats_ret;
@@ -6130,12 +6124,6 @@ virDomainBlockPeek (virDomainPtr dom,
goto error;
}
- if (flags != 0) {
- virLibDomainError(VIR_ERR_INVALID_ARG,
- _("flags must be zero"));
- goto error;
- }
-
/* Allow size == 0 as an access test. */
if (size > 0 && !buffer) {
virLibDomainError(VIR_ERR_INVALID_ARG,
@@ -6239,9 +6227,10 @@ virDomainMemoryPeek (virDomainPtr dom,
* because of incompatible licensing.
*/
- if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
+ /* Exactly one of these two flags must be set. */
+ if (!(flags & VIR_MEMORY_VIRTUAL) == !(flags & VIR_MEMORY_PHYSICAL)) {
virLibDomainError(VIR_ERR_INVALID_ARG,
- _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
+ _("flags parameter must include VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
goto error;
}
@@ -8465,10 +8454,6 @@ virNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
virDispatchError(NULL);
return NULL;
}
- if (flags != 0) {
- virLibNetworkError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
conn = network->conn;
@@ -8978,10 +8963,6 @@ virInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
virDispatchError(NULL);
return NULL;
}
- if ((flags & ~VIR_INTERFACE_XML_INACTIVE) != 0) {
- virLibInterfaceError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
conn = iface->conn;
@@ -10451,10 +10432,6 @@ virStoragePoolGetXMLDesc(virStoragePoolPtr pool,
virDispatchError(NULL);
return NULL;
}
- if (flags != 0) {
- virLibStoragePoolError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
conn = pool->conn;
@@ -11349,10 +11326,6 @@ virStorageVolGetXMLDesc(virStorageVolPtr vol,
virDispatchError(NULL);
return NULL;
}
- if (flags != 0) {
- virLibStorageVolError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
conn = vol->conn;
@@ -11441,10 +11414,6 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
virDispatchError(NULL);
return -1;
}
- if (flags != 0) {
- virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
if (conn->deviceMonitor && conn->deviceMonitor->numOfDevices) {
int ret;
@@ -11493,7 +11462,7 @@ virNodeListDevices(virConnectPtr conn,
virDispatchError(NULL);
return -1;
}
- if ((flags != 0) || (names == NULL) || (maxnames < 0)) {
+ if ((names == NULL) || (maxnames < 0)) {
virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
@@ -12699,12 +12668,10 @@ virSecretGetValue(virSecretPtr secret, size_t *value_size, unsigned int flags)
goto error;
}
- flags &= VIR_SECRET_GET_VALUE_FLAGS_MASK;
-
if (conn->secretDriver != NULL && conn->secretDriver->getValue != NULL) {
unsigned char *ret;
- ret = conn->secretDriver->getValue(secret, value_size, flags);
+ ret = conn->secretDriver->getValue(secret, value_size, flags, 0);
if (ret == NULL)
goto error;
return ret;
@@ -14233,10 +14200,6 @@ virNWFilterGetXMLDesc(virNWFilterPtr nwfilter, unsigned int flags)
virDispatchError(NULL);
return NULL;
}
- if (flags != 0) {
- virLibNWFilterError(VIR_ERR_INVALID_ARG, __FUNCTION__);
- goto error;
- }
conn = nwfilter->conn;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8d146aa..1a3fbfb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6155,12 +6155,15 @@ qemudDomainInterfaceStats (virDomainPtr dom,
static int
qemudDomainMemoryStats (virDomainPtr dom,
struct _virDomainMemoryStat *stats,
- unsigned int nr_stats)
+ unsigned int nr_stats,
+ unsigned int flags)
{
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
unsigned int ret = -1;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d0085e0..448b06e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -276,7 +276,7 @@ qemuProcessGetVolumeQcowPassphrase(virConnectPtr conn,
enc->secrets[0]->uuid);
if (secret == NULL)
goto cleanup;
- data = conn->secretDriver->getValue(secret, &size,
+ data = conn->secretDriver->getValue(secret, &size, 0,
VIR_SECRET_GET_VALUE_INTERNAL_CALL);
virUnrefSecret(secret);
if (data == NULL)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2d5dc15..c2f8bbd 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1850,7 +1850,8 @@ done:
static int
remoteDomainMemoryStats (virDomainPtr domain,
struct _virDomainMemoryStat *stats,
- unsigned int nr_stats)
+ unsigned int nr_stats,
+ unsigned int flags)
{
int rv = -1;
remote_domain_memory_stats_args args;
@@ -1868,7 +1869,7 @@ remoteDomainMemoryStats (virDomainPtr domain,
goto done;
}
args.maxStats = nr_stats;
- args.flags = 0;
+ args.flags = flags;
memset (&ret, 0, sizeof ret);
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS,
@@ -3173,7 +3174,7 @@ remoteSecretClose (virConnectPtr conn)
static unsigned char *
remoteSecretGetValue (virSecretPtr secret, size_t *value_size,
- unsigned int flags)
+ unsigned int flags, unsigned int internalFlags)
{
unsigned char *rv = NULL;
remote_secret_get_value_args args;
@@ -3182,6 +3183,12 @@ remoteSecretGetValue (virSecretPtr secret, size_t *value_size,
remoteDriverLock (priv);
+ /* internalFlags intentionally do not go over the wire */
+ if (internalFlags) {
+ remoteError(VIR_ERR_NO_SUPPORT, "%s", _("no internalFlags support"));
+ goto done;
+ }
+
make_nonnull_secret (&args.secret, secret);
args.flags = flags;
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index c45ba51..02cdbb9 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -873,12 +873,15 @@ cleanup:
}
static unsigned char *
-secretGetValue(virSecretPtr obj, size_t *value_size, unsigned int flags)
+secretGetValue(virSecretPtr obj, size_t *value_size, unsigned int flags,
+ unsigned int internalFlags)
{
virSecretDriverStatePtr driver = obj->conn->secretPrivateData;
unsigned char *ret = NULL;
virSecretEntryPtr secret;
+ virCheckFlags(0, NULL);
+
secretDriverLock(driver);
secret = secretFindByUUID(driver, obj->uuid);
@@ -898,7 +901,7 @@ secretGetValue(virSecretPtr obj, size_t *value_size, unsigned int flags)
goto cleanup;
}
- if ((flags & VIR_SECRET_GET_VALUE_INTERNAL_CALL) == 0 &&
+ if ((internalFlags & VIR_SECRET_GET_VALUE_INTERNAL_CALL) == 0 &&
secret->def->private) {
virSecretReportError(VIR_ERR_OPERATION_DENIED, "%s",
_("secret is private"));
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH v2 0/5] delete volumes while it is building
by Guannan Ren
This is the version 2 of patches for deleting volume while it is being built.
based on the first version: https://www.redhat.com/archives/libvir-list/2011-July/msg00535.html.
The patches is an attempt to spawn a new thread for volume building in storageVolumeCreateXML(),
then, the initial thread is waiting for the cancelling signal from storageVolumeDelete().
When it gets the signal, it uses pthread_cancel() to stop the process of volume building, then tell
storageVolumeDelete() to continue its job.
I go through the codes in other parts of libvirt briefly, such as nodedevice, network. It is rare
to spawn a new thread, so this worth a shot or probably not.
Any idea is appreciated.
13 years, 4 months
[libvirt] The future of virDomainBlockCopy API
by Jiri Denemark
Hi,
With the current changes of block copy implementation in qemu (which was
dropped in favor of using image streaming and snapshots to do the job) I think
it's best not to include virDomainBlockCopy API in libvirt (yet). This is for
several reasons:
- the ideal semantics of virDomainBlockCopy API would be a no-op in case of
failure, which can't be achieved with snapshot/image streaming combo since
the domain is switched to the new image before any copying starts instead of
when everything is finished
- since monitor/cancellation APIs are designed with future block operations in
mind, it will be easy to provide virDomainBlockCopy in the future if we feel
the need for it
- with BlockPull and Snapshot APIs in place, users/apps can do block copy by
creating a snapshot of a disk and running BlockPull on it to make the new
image independent on the original disk image
- the two phase process makes it easy to resume image streaming in case it
failed for a recoverable reason
With current (WIP) snapshot support, one would use virDomainSnapshotCreateXML
asking for a disk snapshot only (no memory) with the following XML:
<domainsnapshot>
<name>whatever</name>
<disk name='/path/to/image1' snapshot='no'/>
<disk name='/path/to/image2' snapshot='yes'>
<volsnapshot>
<name>disk snapshot name</name>
<image name='/another/path/to/image2.new'/>
</volsnapshot>
</disk>
</domainsnapshot>
This will switch the domain to /another/path/to/image2.new with
/path/to/image2 as its backing store. The new image can then be made
independent on its backing store by calling virDomainBlockPull on it.
Jirka
13 years, 4 months
Re: [libvirt] [PATCH] virsh: Expose virDomainMigrateSetMaxSpeed API to virsh
by Hui Kang
Hi,
I checked the libvirt git tree. It seems that this patch has not been applied.
I think to use virsh command line to control the migration bandwidth is useful. Thanks.
- Hui
API virDomainMigrateSetMaxSpeed was introduced since 0.9.0, but
no command in virsh yet.
---
tools/virsh.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 5 +++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index d98be1c..ab83ba9 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -4301,6 +4301,50 @@ done:
}
/*
+ * "migrate-setspeed" command
+ */
+static const vshCmdInfo info_migrate_setspeed[] = {
+ {"help", N_("Set the maximum migration bandwidth")},
+ {"desc", N_("Set the maximum migration bandwidth (in Mbps) for a domain "
+ "which is being migrated to another host.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_migrate_setspeed[] = {
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+ {"bandwidth", VSH_OT_INT, VSH_OFLAG_REQ, N_("migration bandwidth limit in Mbps")},
+ {NULL, 0, 0, NULL}
+};
+
+static bool
+cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
+{
+ virDomainPtr dom = NULL;
+ unsigned long bandwidth = 0;
+ bool ret = false;
+
+ if (!vshConnectionUsability(ctl, ctl->conn))
+ return false;
+
+ if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
+ return false;
+
+ if (vshCommandOptUL(cmd, "bandwidth", &bandwidth) < 0) {
+ vshError(ctl, "%s", _("migrate: Invalid bandwidth"));
+ goto done;
+ }
+
+ if (virDomainMigrateSetMaxSpeed(dom, bandwidth, 0) < 0)
+ goto done;
+
+ ret = true;
+
+done:
+ virDomainFree(dom);
+ return ret;
+}
+
+/*
* "net-autostart" command
*/
static const vshCmdInfo info_network_autostart[] = {
@@ -11080,6 +11124,8 @@ static const vshCmdDef domManagementCmds[] = {
{"migrate", cmdMigrate, opts_migrate, info_migrate, 0},
{"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime,
opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime, 0},
+ {"migrate-setspeed", cmdMigrateSetMaxSpeed,
+ opts_migrate_setspeed, info_migrate_setspeed, 0},
{"reboot", cmdReboot, opts_reboot, info_reboot, 0},
{"restore", cmdRestore, opts_restore, info_restore, 0},
{"resume", cmdResume, opts_resume, info_resume, 0},
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 7ed3003..98adc90 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -542,6 +542,11 @@ Set maximum tolerable downtime for a domain which is being live-migrated to
another host. The I<downtime> is a number of milliseconds the guest is allowed
to be down at the end of live migration.
+=item B<migrate-setspeed> I<domain-id> I<bandwidth>
+
+Set the maximum migration bandwidth (in Mbps) for a domain which is being
+migrated to another host.
+
=item B<reboot> I<domain-id>
Reboot a domain. This acts just as if the domain had the B<reboot>
--
1.7.4
13 years, 4 months
[libvirt] [PATCH] virsh: avoid double free of domain
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
* tools/virsh.c: avoid double free of domain, when weight value of blkiotune
less than 0, codes will free domain and jump to cleanup section, however,
cleanup will free domain again.
Detected in valgrind run:
==21297== ERROR SUMMARY: 20 errors from 20 contexts (suppressed: 69 from 8)
==21297==
==21297== 1 errors in context 1 of 20:
==21297== Invalid read of size 4
==21297== at 0x40E209B: virDomainFree (libvirt.c:2096)
==21297== by 0x8065274: cmdBlkiotune (virsh.c:3695)
==21297== by 0x8054CC1: vshCommandRun (virsh.c:13135)
==21297== by 0x806B967: main (virsh.c:14487)
==21297== Address 0x446ad48 is 0 bytes inside a block of size 36 free'd
==21297== at 0x4005B0A: free (vg_replace_malloc.c:325)
==21297== by 0x406814D: virFree (memory.c:310)
==21297== by 0x40D6635: virReleaseDomain (datatypes.c:243)
==21297== by 0x40D6C5E: virUnrefDomain (datatypes.c:280)
==21297== by 0x40E20B9: virDomainFree (libvirt.c:2101)
==21297== by 0x8065297: cmdBlkiotune (virsh.c:3613)
==21297== by 0x8054CC1: vshCommandRun (virsh.c:13135)
==21297== by 0x806B967: main (virsh.c:14487)
==21297==
==21297==
==21297== 1 errors in context 2 of 20:
==21297== Invalid read of size 4
==21297== at 0x40E1FE6: virDomainFree (libvirt.c:2092)
==21297== by 0x8065274: cmdBlkiotune (virsh.c:3695)
==21297== by 0x8054CC1: vshCommandRun (virsh.c:13135)
==21297== by 0x806B967: main (virsh.c:14487)
==21297== Address 0x446ad48 is 0 bytes inside a block of size 36 free'd
==21297== at 0x4005B0A: free (vg_replace_malloc.c:325)
==21297== by 0x406814D: virFree (memory.c:310)
==21297== by 0x40D6635: virReleaseDomain (datatypes.c:243)
==21297== by 0x40D6C5E: virUnrefDomain (datatypes.c:280)
==21297== by 0x40E20B9: virDomainFree (libvirt.c:2101)
==21297== by 0x8065297: cmdBlkiotune (virsh.c:3613)
==21297== by 0x8054CC1: vshCommandRun (virsh.c:13135)
==21297== by 0x806B967: main (virsh.c:14487)
* how to reproduce?
% valgrind -v --leak-check=full virsh blkiotune guestname --weight -1
---
tools/virsh.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index e75a249..cba249a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3610,7 +3610,6 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
if (weight) {
nparams++;
if (weight < 0) {
- virDomainFree(dom);
vshError(ctl, _("Invalid value of %d for I/O weight"), weight);
goto cleanup;
}
--
1.7.3.4
13 years, 4 months
[libvirt] virsh vcpucount problem
by Eric Blake
Right now, 'virsh vcpucount' understands --current differently than all
other commands that understand --current. That is, --current is not a
synonym for whichever of --live or --config matches the current domain
state, but a counterpart of --maximum.
I'm about to teach VIR_AFFECT_CURRENT to the virDomainGetVcpusFlags
command. Do we fix 'virsh vcpucount --current' to map to this new flag
and come up with a new option that means the opposite of --maximum, or
do we just leave the virsh interface stuck the way it is?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
13 years, 4 months
[libvirt] [PATCH] build: Fix protocol-structs generation in VPATH build
by Jiri Denemark
$@ already included $(srcdir)
---
src/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 54b1ca0..94a9a43 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -241,7 +241,7 @@ PDWTAGS = \
-e '}' \
> $@-t; \
case $$? in 8) exit 0;; 0) ;; *) exit 1;; esac; \
- diff -u $@-t $(srcdir)/$@; st=$$?; rm -f $@-t; exit $$st; \
+ diff -u $@-t $@; st=$$?; rm -f $@-t; exit $$st; \
else \
echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \
echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
--
1.7.6
13 years, 4 months
[libvirt] [PATCH] docs: improve virsh man page synopses
by Eric Blake
"optional" is not a very good meta-syntactic construct in our man
page. I scrubbed this, and additionally improved some documentation
on mutually exclusive options. For example,
{[--live] [--config] | --current}
implies that the set must be satisfied ({}), and within the set, you
either have a mandatory --current, or an optional combination of 0,
1, or both --live and --config.
* tools/virsh.pod: Use "[name]" rather than "optional name" for
optional arguments.
---
I finally did something to address a pet peeve of mine.
tools/virsh.pod | 199 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 108 insertions(+), 91 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 1a98ec1..c6549f1 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -115,7 +115,7 @@ The following commands are generic i.e. not specific to a domain.
=over 4
-=item B<help> optional I<command-or-group>
+=item B<help> [I<command-or-group>]
This lists each of the virsh commands. When used without options, all
commands are listed, one per line, grouped into related categories,
@@ -177,7 +177,7 @@ Running hypervisor: Xen 3.0.0
=back
-=item B<cd> optional I<directory>
+=item B<cd> [I<directory>]
Will change current directory to I<directory>. The default directory
for the B<cd> command is the home directory or, if there is no I<HOME>
@@ -189,7 +189,7 @@ This command is only available in interactive mode.
Will print the current directory.
-=item B<connect> I<URI> optional I<--readonly>
+=item B<connect> I<URI> [I<--readonly>]
(Re)-Connect to the hypervisor. When the shell is first started, this
is automatically run with the I<URI> parameter requested by the C<-c>
@@ -240,14 +240,14 @@ and size of the physical memory. The output corresponds to virNodeInfo
structure. Specifically, the "CPU socket(s)" field means number of CPU
sockets per NUMA cell.
-=item B<nodecpustats> optional I<cpu> I<--percent>
+=item B<nodecpustats> [I<cpu>] [I<--percent>]
Returns cpu stats of the node.
If I<cpu> is specified, this will prints specified cpu statistics only.
If I<--percent> is specified, this will prints percentage of each kind of cpu
statistics during 1 second.
-=item B<nodememstats> optional I<cell>
+=item B<nodememstats> [I<cell>]
Returns memory stats of the node.
If I<cell> is specified, this will prints specified cell statistics only.
@@ -266,7 +266,7 @@ The XML also show the NUMA topology information if available.
Inject NMI to the guest.
-=item B<list> optional I<--inactive> I<--all>
+=item B<list> [I<--inactive> | I<--all>]
Prints information about one or more domains. If no domains are
specified it prints out information about running domains.
@@ -333,7 +333,7 @@ crashed.
=back
-=item B<freecell> optional { I<--cellno> B<cellno> | I<--all> }
+=item B<freecell> [B<cellno> | I<--all>]
Prints the available amount of memory on the machine or within a
NUMA cell if I<cellno> is provided. If I<--all> is provided instead
@@ -366,7 +366,7 @@ I<domain-id> can be specified as a short integer, a name or a full UUID.
=over 4
-=item B<autostart> optional I<--disable> I<domain-id>
+=item B<autostart> [I<--disable>] I<domain-id>
Configure a domain to be automatically started at boot.
@@ -379,7 +379,7 @@ I<devname> parameter refers to the device alias of an alternate
console, serial or parallel device configured for the guest.
If omitted, the primary console will be opened.
-=item B<create> I<FILE> optional I<--console> I<--paused> I<--autodestroy>
+=item B<create> I<FILE> [I<--console>] [I<--paused>] [I<--autodestroy>]
Create a domain from an XML <file>. An easy way to create the XML
<file> is to use the B<dumpxml> command to obtain the definition of a
@@ -450,7 +450,7 @@ Returns information about jobs running on a domain.
Convert a domain Id (or UUID) to domain name
-=item B<domstate> I<domain-id> optional I<--reason>
+=item B<domstate> I<domain-id> [I<--reason>]
Returns state about a domain. I<--reason> tells virsh to also print
reason for the state.
@@ -475,7 +475,8 @@ configuration format named by I<format>.
Dumps the core of a domain to a file for analysis.
-=item B<dumpxml> I<domain-id> optional I<--inactive> I<--security-info> I<--update-cpu>
+=item B<dumpxml> I<domain-id> [I<--inactive>] [I<--security-info>]
+[I<--update-cpu>]
Output the domain information as an XML dump to stdout, this format can be used
by the B<create> command. Additional options affecting the XML dump may be
@@ -485,7 +486,7 @@ Using I<--security-info> security sensitive information will also be included
in the XML dump. I<--update-cpu> updates domain CPU requirements according to
host CPU.
-=item B<echo> optional I<--shell> I<--xml> I<arg>...
+=item B<echo> [I<--shell>] [I<--xml>] [I<arg>...]
Echo back each I<arg>, separated by space. If I<--shell> is
specified, then the output will be single-quoted where needed, so that
@@ -518,16 +519,16 @@ the domain, it will automatically be started from this saved state.
Remove the B<managedsave> state file for a domain, if it exists. This
ensures the domain will do a full boot the next time it is started.
-=item B<maxvcpus> optional I<type>
+=item B<maxvcpus> [I<type>]
Provide the maximum number of virtual CPUs supported for a guest VM on
this connection. If provided, the I<type> parameter must be a valid
type attribute for the <domain> element of XML.
-=item B<migrate> optional I<--live> I<--p2p> I<--direct> I<--tunnelled>
-I<--persistent> I<--undefinesource> I<--suspend> I<--copy-storage-all>
-I<--copy-storage-inc> I<--verbose> I<domain-id> I<desturi> I<migrateuri>
-I<dname> I<--timeout>
+=item B<migrate> [I<--live>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
+[I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
+[I<--copy-storage-inc>] [I<--verbose>] I<domain-id> I<desturi> [I<migrateuri>]
+[I<dname>] [I<timeout>]
Migrate domain to another host. Add I<--live> for live migration; I<--p2p>
for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -544,7 +545,8 @@ I<migrateuri> is the migration URI, which usually can be omitted.
I<dname> is used for renaming the domain to new name during migration, which
also usually can be omitted.
-I<--timeout> forces guest to suspend when live migration exceeds timeout, and
+I<--timeout number> forces guest to suspend when live migration exceeds
+I<number> seconds, and
then the migration will complete offline. It can only be used with I<--live>.
B<Note>: The I<desturi> parameter for normal migration and peer2peer migration
@@ -607,10 +609,10 @@ between the creation and restore point. For a more complete system
restore point, where the disk state is saved alongside the memory
state, see the B<snapshot> family of commands.
-=item B<schedinfo> optional I<--set> B<parameter=value> I<domain-id> I<--config>
-I<--live> I<--current>
+=item B<schedinfo> [I<--set> B<parameter=value>] I<domain-id> {[I<--config>]
+[I<--live>] | I<--current>}
-=item B<schedinfo> optional I<--weight> B<number> optional I<--cap> B<number>
+=item B<schedinfo> [I<--weight> B<number>] [I<--cap> B<number>]
I<domain-id>
Allows you to show (and set) the domain scheduler parameters. The parameters
@@ -633,7 +635,7 @@ Therefore, -1 is a useful shorthand for 262144.
B<Note>: The weight and cap parameters are defined only for the
XEN_CREDIT scheduler and are now I<DEPRECATED>.
-=item B<screenshot> I<domain-id> optional I<imagefilepath> I<--screen> B<screenID>
+=item B<screenshot> I<domain-id> [I<imagefilepath>] [I<--screen> B<screenID>]
Takes a screenshot of a current domain console and stores it into a file.
Optionally, if hypervisor supports more displays for a domain, I<screenID>
@@ -642,8 +644,8 @@ of screen. In case of multiple graphics cards, heads are enumerated before
devices, e.g. having two graphics cards, both with four heads, screen ID 5
addresses the second head on the second card.
-=item B<setmem> I<domain-id> B<kilobytes> optional I<--config> I<--live>
-I<--current>
+=item B<setmem> I<domain-id> B<kilobytes> {[I<--config>] [I<--live>] |
+I<--current>}
Change the memory allocation for a guest domain.
If I<--live> is specified, perform a memory balloon of a running guest.
@@ -661,8 +663,8 @@ rounds the parameter up unless the kB argument is evenly divisible by 1024
For Xen, you can only adjust the memory of a running domain if the domain is
paravirtualized or running the PV balloon driver.
-=item B<setmaxmem> I<domain-id> B<kilobytes> optional I<--config> I<--live>
-I<--current>
+=item B<setmaxmem> I<domain-id> B<kilobytes> {[I<--config>] [I<--live>] |
+I<--current>}
Change the maximum memory allocation limit for a guest domain.
If I<--live> is specified, affect a running guest.
@@ -681,9 +683,9 @@ vSphere/ESX, 263168 (257MB) would be rounded up because it's not a multiple
of 4MB, while 266240 (260MB) is valid without rounding.
-=item B<memtune> I<domain-id> optional I<--hard-limit> B<kilobytes>
-optional I<--soft-limit> B<kilobytes> optional I<--swap-hard-limit>
-B<kilobytes> optional I<--min-guarantee> B<kilobytes>
+=item B<memtune> I<domain-id> [I<--hard-limit> B<kilobytes>]
+[I<--soft-limit> B<kilobytes>] [I<--swap-hard-limit> B<kilobytes>]
+[I<--min-guarantee> B<kilobytes>]
Allows you to display or set the domain memory parameters. Without
flags, the current settings are displayed; with a flag, the
@@ -727,7 +729,7 @@ value are kilobytes (i.e. blocks of 1024 bytes).
=back
-=item B<blkiotune> I<domain-id> optional I<--weight> B<weight>
+=item B<blkiotune> I<domain-id> [I<--weight> B<weight>]
Display or set the blkio parameters. QEMU/KVM supports I<--weight>.
I<--weight> is in range [100, 1000].
@@ -739,8 +741,8 @@ Both I<--live> and I<--current> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
-=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
-I<--live>
+=item B<setvcpus> I<domain-id> I<count> [I<--maximum>] [I<--config> |
+I<--live>]
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
@@ -778,7 +780,7 @@ 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.
-=item B<start> I<domain-name> optional I<--console> I<--paused> I<--autodestroy>
+=item B<start> I<domain-name> [I<--console>] [I<--paused>] [I<--autodestroy>]
Start a (previously defined) inactive domain, either from the last
B<managedsave> state, or via a fresh boot if no managedsave state is
@@ -810,8 +812,8 @@ is not available the processes will provide an exit code of 1.
Undefine the configuration for an inactive domain. Since it's not running
the domain name or UUID must be used as the I<domain-id>.
-=item B<vcpucount> I<domain-id> optional I<--maximum> I<--current>
-I<--config> I<--live>
+=item B<vcpucount> I<domain-id> [I<--maximum>] {I<--current> |
+[I<--config>] [I<--live>]}
Print information about the virtual cpu counts of the given
I<domain-id>. If no flags are specified, all possible counts are
@@ -830,8 +832,8 @@ values; these two flags cannot both be specified.
Returns basic information about the domain virtual CPUs, like the number of
vCPUs, the running time, the affinity to physical processors.
-=item B<vcpupin> I<domain-id> optional I<vcpu> I<cpulist> I<--live> I<--config>
-I<--current>
+=item B<vcpupin> I<domain-id> [I<vcpu>] [I<cpulist>] {[I<--live>]
+[I<--config>] | I<--current>}
Query or change the pinning of domain VCPUs to host physical CPUs. To
pin a single I<vcpu>, specify I<cpulist>; otherwise, you can query one
@@ -876,9 +878,9 @@ See the documentation to learn about libvirt XML format for a device.
For cdrom and floppy devices, this command only replaces the media within
the single existing device; consider using B<update-device> for this usage.
-=item B<attach-disk> I<domain-id> I<source> I<target> optional
-I<--driver driver> I<--subdriver subdriver> I<--type type>
-I<--mode mode> I<--persistent> I<--sourcetype soucetype>
+=item B<attach-disk> I<domain-id> I<source> I<target>
+[I<--driver driver>] [I<--subdriver subdriver>] [I<--type type>]
+[I<--mode mode>] [I<--persistent>] [I<--sourcetype soucetype>]
Attach a new disk device to the domain.
I<source> and I<target> are paths for the files and devices.
@@ -890,9 +892,9 @@ I<mode> can specify the two specific mode I<readonly> or I<shareable>.
I<persistent> indicates the changes will affect the next boot of the domain.
I<sourcetype> can indicate the type of source (block|file)
-=item B<attach-interface> I<domain-id> I<type> I<source> optional
-I<--target target> I<--mac mac> I<--script script> I<--model model>
-I<--persistent>
+=item B<attach-interface> I<domain-id> I<type> I<source>
+[I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>]
+[I<--persistent>]
Attach a new network interface to the domain.
I<type> can be either I<network> to indicate a physical network device or I<bridge> to indicate a bridge to a device.
@@ -914,14 +916,14 @@ as command B<attach-device>.
Detach a disk device from a domain. The I<target> is the device as seen
from the domain.
-=item B<detach-interface> I<domain-id> I<type> optional I<--mac mac>
+=item B<detach-interface> I<domain-id> I<type> [I<--mac mac>]
Detach a network interface from a domain.
I<type> can be either I<network> to indicate a physical network device or I<bridge> to indicate a bridge to a device.
It is recommended to use the I<mac> option to distinguish between the interfaces
if more than one are present on the domain.
-=item B<update-device> I<domain-id> I<file> optional I<--persistent> I<--force>
+=item B<update-device> I<domain-id> I<file> [I<--persistent>] [I<--force>]
Update the characteristics of a device associated with I<domain-id>, based on
the device definition in an XML I<file>. If the I<--persistent> option is
@@ -943,7 +945,7 @@ but the way to name a virtual network is either by its name or UUID.
=over 4
-=item B<net-autostart> I<network> optional I<--disable>
+=item B<net-autostart> I<network> [I<--disable>]
Configure a virtual network to be automatically started at boot.
The I<--disable> option disable autostarting.
@@ -986,7 +988,7 @@ variables, and defaults to C<vi>.
Returns basic information about the I<network> object.
-=item B<net-list> optional I<--inactive> or I<--all>
+=item B<net-list> [I<--inactive> | I<--all>]
Returns the list of active networks, if I<--all> is specified this will also
include defined but inactive networks, if I<--inactive> is specified only the
@@ -1038,7 +1040,7 @@ not started.
Destroy (stop) a given host interface, such as by running "if-down" to
disable that interface from active use. This takes effect immediately.
-=item B<iface-dumpxml> I<interface> optional I<--inactive>
+=item B<iface-dumpxml> I<interface> [I<--inactive>]
Output the host interface information as an XML dump to stdout. If
I<--inactive> is specified, then the output reflects the persistent
@@ -1059,7 +1061,7 @@ except that it does some error checking.
The editor used can be supplied by the C<$VISUAL> or C<$EDITOR> environment
variables, and defaults to C<vi>.
-=item B<iface-list> optional I<--inactive> or I<--all>
+=item B<iface-list> [I<--inactive> | I<--all>]
Returns the list of active host interfaces. If I<--all> is specified
this will also include defined but inactive interfaces. If
@@ -1119,19 +1121,20 @@ pools are similar to the ones used for domains.
=over 4
-=item B<find-storage-pool-sources> I<type> optional I<srcSpec>
+=item B<find-storage-pool-sources> I<type> [I<srcSpec>]
Returns XML describing all storage pools of a given I<type> that could
be found. If I<srcSpec> is provided, it is a file that contains XML
to further restrict the query for pools.
-=item B<find-storage-pool-sources> I<type> optional I<host> I<port>
+=item B<find-storage-pool-sources-as> I<type> [I<host>] [I<port>]
+[I<initiator>]
Returns XML describing all storage pools of a given I<type> that could
-be found. If I<host> and I<port> are provided, they control where the
-query is performed.
+be found. If I<host>, I<port>, or I<initiator> are provided, they control
+where the query is performed.
-=item B<pool-autostart> I<pool-or-uuid> optional I<--disable>
+=item B<pool-autostart> I<pool-or-uuid> [I<--disable>]
Configure whether I<pool> should automatically start at boot.
@@ -1143,8 +1146,9 @@ Build a given pool.
Create and start a pool object from the XML I<file>.
-=item B<pool-create-as> I<name> I<--print-xml> I<type> optional I<source-host>
-I<source-path> I<source-dev> I<source-name> <target> I<--source-format format>
+=item B<pool-create-as> I<name> I<--print-xml> I<type> [I<source-host>]
+[I<source-path>] [I<source-dev>] [I<source-name>] [<target>]
+[I<--source-format format>]
Create and start a pool object I<name> from the raw parameters. If
I<--print-xml> is specified, then print the XML of the pool object
@@ -1155,8 +1159,9 @@ I<type>.
Create, but do not start, a pool object from the XML I<file>.
-=item B<pool-define-as> I<name> I<--print-xml> I<type> optional I<source-host>
-I<source-path> I<source-dev> I<source-name> <target> I<--source-format format>
+=item B<pool-define-as> I<name> I<--print-xml> I<type> [I<source-host>]
+[I<source-path>] [I<source-dev>] [I<source-name>] [<target>]
+[I<--source-format format>]
Create, but do not start, a pool object I<name> from the raw parameters. If
I<--print-xml> is specified, then print the XML of the pool object
@@ -1199,7 +1204,7 @@ variables, and defaults to C<vi>.
Returns basic information about the I<pool> object.
-=item B<pool-list> optional I<--inactive> I<--all> I<--details>
+=item B<pool-list> [I<--inactive> | I<--all>] [I<--details>]
List pool objects known to libvirt. By default, only pools in use by
active domains are listed; I<--inactive> lists just the inactive
@@ -1247,7 +1252,7 @@ B<Example>
vi newvolume.xml (or make changes with your other text editor)
virsh vol-create differentstoragepool newvolume.xml
-=item B<vol-create-from> I<pool-or-uuid> I<FILE> [optional I<--inputpool>
+=item B<vol-create-from> I<pool-or-uuid> I<FILE> [I<--inputpool>
I<pool-or-uuid>] I<vol-name-or-key-or-path>
Create a volume, using another volume as input.
@@ -1257,9 +1262,9 @@ I<--inputpool> I<pool-or-uuid> is the name or uuid of the storage pool the
source volume is in.
I<vol-name-or-key-or-path> is the name or key or path of the source volume.
-=item B<vol-create-as> I<pool-or-uuid> I<name> I<capacity> optional
-I<--allocation> I<size> I<--format> I<string> I<--backing-vol>
-I<vol-name-or-key-or-path> I<--backing-vol-format> I<string>
+=item B<vol-create-as> I<pool-or-uuid> I<name> I<capacity>
+[I<--allocation> I<size>] [I<--format> I<string>] [I<--backing-vol>
+I<vol-name-or-key-or-path>] [I<--backing-vol-format> I<string>]
Create a volume from a set of arguments.
I<pool-or-uuid> is the name or UUID of the storage pool to create the volume
@@ -1276,73 +1281,84 @@ volume to be used if taking a snapshot of an existing volume.
I<--backing-vol-format> I<string> is the format of the snapshot backing volume;
raw, bochs, qcow, qcow2, vmdk, host_device.
-=item B<vol-clone> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path> I<name>
+=item B<vol-clone> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
+I<name>
Clone an existing volume. Less powerful, but easier to type, version of
B<vol-create-from>.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool to create the volume in.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool to create
+the volume in.
I<vol-name-or-key-or-path> is the name or key or path of the source volume.
I<name> is the name of the new volume.
-=item B<vol-delete> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
+=item B<vol-delete> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
Delete a given volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in.
I<vol-name-or-key-or-path> is the name or key or path of the volume to delete.
-=item B<vol-upload> [optional I<--pool> I<pool-or-uuid> I<--offset> I<bytes> I<--length> I<bytes>] I<vol-name-or-key-or-path> I<local-file>
+=item B<vol-upload> [I<--pool> I<pool-or-uuid>] [I<--offset> I<bytes>]
+[I<--length> I<bytes>] I<vol-name-or-key-or-path> I<local-file>
Upload the contents of I<local-file> to a storage volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in.
I<vol-name-or-key-or-path> is the name or key or path of the volume to wipe.
I<--offset> is the position in the storage volume at which to start writing
the data. I<--length> is an upper bound of the amount of data to be uploaded.
An error will occurr if the I<local-file> is greater than the specified length.
-=item B<vol-download> [optional I<--pool> I<pool-or-uuid> I<--offset> I<bytes> I<--length> I<bytes>] I<vol-name-or-key-or-path> I<local-file>
+=item B<vol-download> [I<--pool> I<pool-or-uuid>] [I<--offset> I<bytes>]
+[I<--length> I<bytes>] I<vol-name-or-key-or-path> I<local-file>
Download the contents of I<local-file> from a storage volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in.
I<vol-name-or-key-or-path> is the name or key or path of the volume to wipe.
I<--offset> is the position in the storage volume at which to start reading
the data. I<--length> is an upper bound of the amount of data to be downloaded.
-=item B<vol-wipe> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
+=item B<vol-wipe> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
-Wipe a volume, ensure data previously on the volume is not accessible to future reads.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
+Wipe a volume, ensure data previously on the volume is not accessible to
+future reads. I<--pool> I<pool-or-uuid> is the name or UUID of the storage
+pool the volume is in.
I<vol-name-or-key-or-path> is the name or key or path of the volume to wipe.
-=item B<vol-dumpxml> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
+=item B<vol-dumpxml> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
Output the volume information as an XML dump to stdout.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
-I<vol-name-or-key-or-path> is the name or key or path of the volume to output the XML of.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in. I<vol-name-or-key-or-path> is the name or key or path of the volume
+to output the XML of.
-=item B<vol-info> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
+=item B<vol-info> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
Returns basic information about the given storage volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
-I<vol-name-or-key-or-path> is the name or key or path of the volume to return information for.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in. I<vol-name-or-key-or-path> is the name or key or path of the volume
+to return information for.
-=item B<vol-list> [optional I<--pool>] I<pool-or-uuid> optional I<--details>
+=item B<vol-list> [I<--pool> I<pool-or-uuid>] [I<--details>]
Return the list of volumes in the given storage pool.
I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool.
The I<--details> option instructs virsh to additionally display volume
type and capacity related information where available.
-=item B<vol-pool> [optional I<--uuid>] I<vol-key-or-path>
+=item B<vol-pool> [I<--uuid>] I<vol-key-or-path>
Return the pool name or UUID for a given volume. By default, the pool name is
returned. If the I<--uuid> option is given, the pool UUID is returned instead.
I<vol-key-or-path> is the key or path of the volume to return the pool
information for.
-=item B<vol-path> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-key>
+=item B<vol-path> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key>
Return the path for a given volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in.
I<vol-name-or-key> is the name or key of the volume to return the path for.
=item B<vol-name> I<vol-key-or-path>
@@ -1350,11 +1366,12 @@ I<vol-name-or-key> is the name or key of the volume to return the path for.
Return the name for a given volume.
I<vol-key-or-path> is the key or path of the volume to return the name for.
-=item B<vol-key> [optional I<--pool> I<pool-or-uuid>] I<vol-name-or-path>
+=item B<vol-key> [I<--pool> I<pool-or-uuid>] I<vol-name-or-path>
Return the volume key for a given volume.
-I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume is in.
-I<vol-name-or-path> is the name or path of the volume to return the volume key for.
+I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
+is in. I<vol-name-or-path> is the name or path of the volume to return the
+volume key for.
=back
@@ -1413,7 +1430,7 @@ used to represent properties of snapshots.
=over 4
-=item B<snapshot-create> I<domain> optional I<xmlfile>
+=item B<snapshot-create> I<domain> [I<xmlfile>]
Create a snapshot for domain I<domain> with the properties specified in
I<xmlfile>. The only properties settable for a domain snapshot are the
@@ -1421,8 +1438,8 @@ I<xmlfile>. The only properties settable for a domain snapshot are the
automatically filled in by libvirt. If I<xmlfile> is completely omitted,
then libvirt will choose a value for all fields.
-=item B<snapshot-create-as> I<domain> optional I<--print-xml>
-I<name> I<description>
+=item B<snapshot-create-as> I<domain> [I<--print-xml>]
+[I<name>] [I<description>]
Create a snapshot for domain I<domain> with the given <name> and
<description>; if either value is omitted, libvirt will choose a
@@ -1543,7 +1560,7 @@ attaching to an externally launched QEMU process. There may be
issues with the guest ABI changing upon migration, and hotunplug
may not work.
-=item B<qemu-monitor-command> I<domain> I<command> optional I<--hmp>
+=item B<qemu-monitor-command> I<domain> I<command> [I<--hmp>]
Send an arbitrary monitor command I<command> to domain I<domain> through the
qemu monitor. The results of the command will be printed on stdout. If
--
1.7.4.4
13 years, 4 months