[libvirt] Bootstrap fail, but non-useful message :/
by Justin Clift
Hi Eric,
Just ran ./autogen.sh on an OSX box with only the system provided
autotools installed, and got this:
************************************************************************************
Copying file po/remove-potcdate.sin
./bootstrap: patching m4/gettext.m4 to remove need for intl/* ...
./bootstrap: glibtoolize -c -f ...
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
glibtoolize: copying file `build-aux/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
glibtoolize: copying file `m4/libtool.m4'
glibtoolize: copying file `m4/ltoptions.m4'
glibtoolize: copying file `m4/ltsugar.m4'
glibtoolize: copying file `m4/ltversion.m4'
glibtoolize: copying file `m4/lt~obsolete.m4'
./bootstrap: aclocal -I gnulib/m4 --force -I m4 ...
configure.ac:13: warning: macro `AM_SILENT_RULES' not found in library
./bootstrap: autoconf --force ...
configure.ac:60: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:512: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:627: error: possibly undefined macro: PKG_CHECK_MODULES
Failed to bootstrap, please investigate.
$
************************************************************************************
This system is using the "MacPorts" packaging system instead of Homebrew.
The problem was easy enough to resolve by installing the newer autoconf
and automake MacPorts provides.
But, I'm concerned about the less-than-helpful error message given here.
Isn't the bootstrap supposed to detect the required versions of things (as specified
in the .conf file), and inform us clearly if they're not found?
Regards and best wishes,
Justin Clift
14 years, 4 months
[libvirt] [PATCH] correct the arguments of migrate_speed
by Wen Congyang
When we set migrate_speed by json, we receive the following
error message:
libvirtError: internal error unable to execute QEMU command
'migrate_set_speed': Invalid parameter type, expected: number
The reason is that: the arguments of migrate_set_speed
by json is json number, not json string.
Signed-off-by: Wen Congyang <wency(a)cn.fujitsu.com>
---
src/qemu/qemu_monitor_json.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index da51a4f..2576dc5 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1453,17 +1453,13 @@ int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon,
unsigned long bandwidth)
{
int ret;
- char *bandwidthstr;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
- if (virAsprintf(&bandwidthstr, "%lum", bandwidth) < 0) {
- virReportOOMError();
- return -1;
- }
cmd = qemuMonitorJSONMakeCommand("migrate_set_speed",
- "s:value", bandwidthstr,
+ "U:value",
+ /* 1048576 = 1024 * 1024 */
+ (uint64_t)bandwidth * 1048576,
NULL);
- VIR_FREE(bandwidthstr);
if (!cmd)
return -1;
--
1.7.1
14 years, 4 months
[libvirt] [PATCH v2 0/5] Support of auto-dump on watchdog event in libvirtd
by Hu Tao
This patch series adds a new watchdog action `dump' which lets libvirtd
can do auto-dump when receiving a watchdog event from qemu guest.
In order to make the function work, there must be a watchdog device
added to guest, and guest must have a watchdog daemon running, for
example, /etc/init.d/watchdog start or auto-started on boot.
Hu Tao (5):
Add a threadpool implementation
Fall back to QEMUD_SAVE_FORMAT_RAW if compression method fails.
Add a new function doCoreDump
Add a watchdog action `dump'
I am one of the authors
AUTHORS | 1 +
src/Makefile.am | 3 +-
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/qemu/qemu.conf | 5 +
src/qemu/qemu_conf.c | 13 +++-
src/qemu/qemu_conf.h | 4 +
src/qemu/qemu_driver.c | 229 +++++++++++++++++++++++++++++++++---------------
src/util/threadpool.c | 140 +++++++++++++++++++++++++++++
src/util/threadpool.h | 35 ++++++++
10 files changed, 361 insertions(+), 71 deletions(-)
create mode 100644 src/util/threadpool.c
create mode 100644 src/util/threadpool.h
--
1.7.3
--
Thanks,
Hu Tao
14 years, 4 months
[libvirt] [PATCH] tests: Fix detection of expected errors
by Jiri Denemark
---
tests/nwfilterxml2xmltest.c | 15 +++++----------
tests/qemuxml2argvtest.c | 8 +++-----
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index 070aa98..9cad913 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -25,7 +25,7 @@ static char *abs_srcdir;
static int testCompareXMLToXMLFiles(const char *inxml,
const char *outxml,
- bool expect_warning) {
+ bool expect_error) {
char inXmlData[MAX_FILE];
char *inXmlPtr = &(inXmlData[0]);
char outXmlData[MAX_FILE];
@@ -33,26 +33,21 @@ static int testCompareXMLToXMLFiles(const char *inxml,
char *actual = NULL;
int ret = -1;
virNWFilterDefPtr dev = NULL;
- char *log;
if (virtTestLoadFile(inxml, &inXmlPtr, MAX_FILE) < 0)
goto fail;
if (virtTestLoadFile(outxml, &outXmlPtr, MAX_FILE) < 0)
goto fail;
- if (!(dev = virNWFilterDefParseString(NULL, inXmlData)))
- goto fail;
+ virResetLastError();
- if ((log = virtTestLogContentAndReset()) == NULL)
+ if (!(dev = virNWFilterDefParseString(NULL, inXmlData)))
goto fail;
- if ((*log != '\0') != expect_warning) {
- free(log);
+ if (!!virGetLastError() != expect_error)
goto fail;
- }
- free(log);
- if (expect_warning) {
+ if (expect_error) {
/* need to suppress the errors */
virResetLastError();
}
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b149ef4..c5e0448 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -84,6 +84,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
free(virtTestLogContentAndReset());
+ virResetLastError();
if (qemudBuildCommandLine(conn, &driver,
vmdef, &monitor_chr, 0, flags,
@@ -91,11 +92,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
NULL, NULL, migrateFrom, NULL) < 0)
goto fail;
- if ((log = virtTestLogContentAndReset()) == NULL)
- goto fail;
-
- if (!!strstr(log, ": error :") != expectError) {
- if (virTestGetDebug())
+ if (!!virGetLastError() != expectError) {
+ if (virTestGetDebug() && (log = virtTestLogContentAndReset()))
fprintf(stderr, "\n%s", log);
goto fail;
}
--
1.7.3.2
14 years, 4 months
[libvirt] [PATCH] docs: updated c# bindings with arnauds latest changes
by Justin Clift
---
docs/csharp.html.in | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/docs/csharp.html.in b/docs/csharp.html.in
index 45ff35a..62da6a8 100644
--- a/docs/csharp.html.in
+++ b/docs/csharp.html.in
@@ -155,7 +155,7 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>enum</td><td>virConnectFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>struct</td><td>virDomain</td><td>Yes, an IntPtr as the struct is not public</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>struct</td><td>virDomainBlockInfo</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>struct</td><td>virDomainBlockStatsInfo</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
+ <tr><td>struct</td><td>virDomainBlockStatsInfo</td><td>Yes</td><td>Yes</td><td>virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainCoreDumpFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>enum</td><td>virDomainCreateFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>enum</td><td>virDomainDeviceModifyFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
@@ -174,8 +174,8 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>enum</td><td>virDomainEventType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventUndefinedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventWatchdogAction</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>struct</td><td>virDomainInfo</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
- <tr><td>struct</td><td>virDomainInterfaceStatsStruct</td><td>Yes</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>struct</td><td>virDomainInfo</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>struct</td><td>virDomainInterfaceStatsStruct</td><td>Yes</td><td>Yes</td><td>virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virDomainJobInfo</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>enum</td><td>virDomainJobType</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>enum</td><td>virDomainMemoryFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
@@ -213,7 +213,7 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>enum</td><td>virStreamFlags</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>struct</td><td>virVcpuInfo</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>enum</td><td>virVcpuState</td><td>No</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>struct</td><td>virError</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>struct</td><td>virError</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
</table>
<p> </p>
@@ -256,7 +256,7 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virConnectListDefinedInterfaces </td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectListDefinedNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectListDefinedStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virConnectListDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virConnectListDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectListInterfaces</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes, if the host handle the method</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectListNWFilters </td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectListNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
@@ -266,13 +266,13 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virConnectNumOfDefinedInterfaces</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfDefinedNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfDefinedStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virConnectNumOfDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virConnectNumOfDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectNumOfInterfaces</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfNWFilters</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfNetworks </td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfSecrets</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectNumOfStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
- <tr><td>virConnectOpen</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen, virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virConnectOpen</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen, virEventRegisterImpl, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectOpenAuth</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectOpenReadOnly</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virConnectRef</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
@@ -280,7 +280,7 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virDomainAttachDevice</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainAttachDeviceFlags</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainBlockPeek</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainBlockStats</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainBlockStats</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainCoreDump</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainCreate</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainCreateLinux</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
@@ -295,11 +295,11 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virDomainGetBlockInfo</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetConnect</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetID</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainGetInfo</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainGetInfo</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainGetJobInfo</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetMaxMemory</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetMaxVcpus</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainGetName</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virDomainGetName</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainGetOSType</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetSchedulerParameters</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetSchedulerType</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
@@ -307,32 +307,32 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virDomainGetUUID</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetUUIDString</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainGetVcpus</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainHasCurrentSnapshot</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainHasManagedSaveImage</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainInterfaceStats </td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainInterfaceStats </td><td>No</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainIsActive</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainIsPersistent</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainLookupByID</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
- <tr><td>virDomainLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainLookupByID</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virDomainLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainLookupByUUID</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainLookupByUUIDString</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainManagedSave</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainManagedSave </td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainManagedSaveRemove</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainMemoryPeek</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainMemoryStats</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainMigrate</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainMigrateSetMaxDowntime</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainMigrateToURI</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainMigrateToURI </td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainPinVcpu</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainReboot</td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainRef</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainRef </td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainRestore</td><td>Yes </td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainResume </td><td>Yes</td><td>function</td><td>Yes</td><td> </td><td>Yes</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainRevertToSnapshot</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainSave</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainSetAutostart</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
- <tr><td>virDomainSetMaxMemory</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
+ <tr><td>virDomainSetMaxMemory </td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainSetMemory</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainSetSchedulerParameters</td><td>No</td><td>function</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virDomainSetVcpus</td><td>Yes</td><td>function</td><td>No</td><td> </td><td>Maybe</td><td> </td><td> </td><td> </td></tr>
@@ -496,6 +496,7 @@ git clone git://libvirt.org/libvirt-csharp.git
<tr><td>virStreamSourceFunc</td><td>No</td><td>delegate</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td>virGetLastError</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnSetErrorFunc</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
+ <tr><td>virErrorFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
</table>
</body>
</html>
--
1.7.3.2
14 years, 4 months
[libvirt] Mac OS X and ruby-libvirt
by Jaromír Červenka
Hello,
I've just compiled libvirt 0.8.5 on my Mac OS X 10.6.5 and it looks
fine - virish works (also for remote connection: qemu+tcp). I would
like to install ruby-libvirt gem, but I get this error:
http://paste.opensuse.org/10756697
Could anybody help me, please? I think that it is necessary "point to"
source of libvirt, because ruby-libvirt tries to compile gem for my
system. But I don't know how to do that.
Thank you,
Jaromír Červenka
Official openSUSE community member
Web: http://www.cervajz.com/
Jabber: cervajz(a)cervajz.com
MSN: jara.cervenka(a)seznam.cz
Tel.: +420 607 592 687
Alt. e-mails:
jaromir.cervenka(a)opensuse.org,
jaromir.cervenka(a)speel.cz
14 years, 4 months
[libvirt] [v2] virsh: Categorize commands into groups for virsh help output
by Osier Yang
Change the virsh help out. The new output of "virsh help" and
"virsh --help" will be like:
Secret (help keyword 'secret'):
secret-define define or modify a secret from an XML file
secret-dumpxml secret attributes in XML
secret-set-value set a secret value
secret-get-value Output a secret value
secret-undefine undefine a secret
secret-list list secrets
Snapshot (help keyword 'snapshot'):
snapshot-create Create a snapshot
snapshot-current Get the current snapshot
snapshot-delete Delete a domain snapshot
snapshot-dumpxml Dump XML for a domain snapshot
snapshot-list List snapshots for a domain
snapshot-revert Revert a domain to a snapshot
Also support output help information of specified command group, e.g.
% ./tools/virsh help "Network Filter"
Network Filter (help keyword filter):
nwfilter-define define or update a network filter from an XML file
nwfilter-undefine undefine a network filter
nwfilter-dumpxml network filter information in XML
nwfilter-list list network filters
nwfilter-edit edit XML configuration for a network filter
Each group has a help keyword, e.g.
% ./tools/virsh help filter
Network Filter (help keyword filter):
nwfilter-define define or update a network filter from an XML file
nwfilter-undefine undefine a network filter
nwfilter-dumpxml network filter information in XML
nwfilter-list list network filters
nwfilter-edit edit XML configuration for a network filter
* tools/virsh.c:
- introduce new struct "vshCmdGrp" and macros to define the groups.
- split previous array "commands" into small arrays which are orgnized
by group
- changed some functions, such as "vshCmdDefSearch"
- commands of each group are in "alphabetical order" now.
- the commands are categorized with reference of
http://wiki.libvirt.org/page/VirshHelpV2 (by Justin)
- the modifications doesn't affect tests
* TODO:
- doc
---
tools/virsh.c | 414 ++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 281 insertions(+), 133 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index ae88cc0..123f2d7 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -131,6 +131,22 @@ typedef enum {
} vshCmdOptType;
/*
+ * Command group types
+ */
+#define VSH_CMD_GRP_DOM_MANAGEMENT "Domain Management"
+#define VSH_CMD_GRP_DOM_MONITORING "Domain Monitoring"
+#define VSH_CMD_GRP_STORAGE_POOL "Storage Pool"
+#define VSH_CMD_GRP_STORAGE_VOL "Storage Volume"
+#define VSH_CMD_GRP_NETWORK "Networking"
+#define VSH_CMD_GRP_NODEDEV "Node Device"
+#define VSH_CMD_GRP_IFACE "Interface"
+#define VSH_CMD_GRP_NWFILTER "Network Filter"
+#define VSH_CMD_GRP_SECRET "Secret"
+#define VSH_CMD_GRP_SNAPSHOT "Snapshot"
+#define VSH_CMD_GRP_HOST_AND_HV "Host and Hypervisor"
+#define VSH_CMD_GRP_VIRSH "Virsh Itself"
+
+/*
* Command Option Flags
*/
#define VSH_OFLAG_NONE 0 /* without flags */
@@ -207,8 +223,13 @@ typedef struct __vshControl {
char *historyfile; /* readline history file name */
} __vshControl;
+typedef struct vshCmdGrp {
+ const char *name;
+ const char *keyword; /* help keyword */
+ const vshCmdDef *commands;
+} vshCmdGrp;
-static const vshCmdDef commands[];
+static const vshCmdGrp cmdGroups[];
static void vshError(vshControl *ctl, const char *format, ...)
ATTRIBUTE_FMT_PRINTF(2, 3);
@@ -224,6 +245,8 @@ static int vshParseArgv(vshControl *ctl, int argc, char **argv);
static const char *vshCmddefGetInfo(const vshCmdDef *cmd, const char *info);
static const vshCmdDef *vshCmddefSearch(const char *cmdname);
static int vshCmddefHelp(vshControl *ctl, const char *name);
+static const vshCmdGrp *vshCmdGrpSearch(const char *grpname);
+static int vshCmdGrpHelp(vshControl *ctl, const char *name);
static vshCmdOpt *vshCommandOpt(const vshCmd *cmd, const char *name);
static int vshCommandOptInt(const vshCmd *cmd, const char *name, int *found);
@@ -551,19 +574,39 @@ static const vshCmdOptDef opts_help[] = {
static int
cmdHelp(vshControl *ctl, const vshCmd *cmd)
-{
- const char *cmdname = vshCommandOptString(cmd, "command", NULL);
+ {
+ const vshCmdDef *c;
+ const vshCmdGrp *g;
+ const char *name = vshCommandOptString(cmd, "command", NULL);
- if (!cmdname) {
+ if (!name) {
+ const vshCmdGrp *grp;
const vshCmdDef *def;
- vshPrint(ctl, "%s", _("Commands:\n\n"));
- for (def = commands; def->name; def++)
- vshPrint(ctl, " %-15s %s\n", def->name,
- _(vshCmddefGetInfo(def, "help")));
- return TRUE;
+ vshPrint(ctl, "%s", _("Grouped commands:\n\n"));
+
+ for (grp = cmdGroups; grp->name; grp++) {
+ vshPrint(ctl, _(" %s (help keyword '%s'):\n"), grp->name,
+ grp->keyword);
+
+ for (def = grp->commands; def->name; def++)
+ vshPrint(ctl, " %-30s %s\n", def->name,
+ _(vshCmddefGetInfo(def, "help")));
+
+ vshPrint(ctl, "\n");
+ }
+
+ return TRUE;
+ }
+
+ if ((c = vshCmddefSearch(name))) {
+ return vshCmddefHelp(ctl, name);
+ } else if ((g = vshCmdGrpSearch(name))) {
+ return vshCmdGrpHelp(ctl, name);
+ } else {
+ vshError(ctl, _("command or command group '%s' doesn't exist"), name);
+ return FALSE;
}
- return vshCmddefHelp(ctl, cmdname);
}
/*
@@ -9878,60 +9921,117 @@ cleanup:
return ret;
}
-
-/*
- * Commands
- */
-static const vshCmdDef commands[] = {
- {"help", cmdHelp, opts_help, info_help},
+static const vshCmdDef domManagementCmds[] = {
{"attach-device", cmdAttachDevice, opts_attach_device, info_attach_device},
{"attach-disk", cmdAttachDisk, opts_attach_disk, info_attach_disk},
{"attach-interface", cmdAttachInterface, opts_attach_interface, info_attach_interface},
{"autostart", cmdAutostart, opts_autostart, info_autostart},
- {"capabilities", cmdCapabilities, NULL, info_capabilities},
-#ifndef WIN32
- {"cd", cmdCd, opts_cd, info_cd},
-#endif
- {"connect", cmdConnect, opts_connect, info_connect},
#ifndef WIN32
{"console", cmdConsole, opts_console, info_console},
#endif
{"cpu-baseline", cmdCPUBaseline, opts_cpu_baseline, info_cpu_baseline},
{"cpu-compare", cmdCPUCompare, opts_cpu_compare, info_cpu_compare},
{"create", cmdCreate, opts_create, info_create},
- {"start", cmdStart, opts_start, info_start},
+ {"define", cmdDefine, opts_define, info_define},
{"destroy", cmdDestroy, opts_destroy, info_destroy},
{"detach-device", cmdDetachDevice, opts_detach_device, info_detach_device},
{"detach-disk", cmdDetachDisk, opts_detach_disk, info_detach_disk},
{"detach-interface", cmdDetachInterface, opts_detach_interface, info_detach_interface},
- {"define", cmdDefine, opts_define, info_define},
{"domid", cmdDomid, opts_domid, info_domid},
- {"domuuid", cmdDomuuid, opts_domuuid, info_domuuid},
- {"dominfo", cmdDominfo, opts_dominfo, info_dominfo},
- {"domjobinfo", cmdDomjobinfo, opts_domjobinfo, info_domjobinfo},
{"domjobabort", cmdDomjobabort, opts_domjobabort, info_domjobabort},
+ {"domjobinfo", cmdDomjobinfo, opts_domjobinfo, info_domjobinfo},
{"domname", cmdDomname, opts_domname, info_domname},
- {"domstate", cmdDomstate, opts_domstate, info_domstate},
- {"domblkstat", cmdDomblkstat, opts_domblkstat, info_domblkstat},
- {"domifstat", cmdDomIfstat, opts_domifstat, info_domifstat},
- {"dommemstat", cmdDomMemStat, opts_dommemstat, info_dommemstat},
- {"domblkinfo", cmdDomblkinfo, opts_domblkinfo, info_domblkinfo},
+ {"domuuid", cmdDomuuid, opts_domuuid, info_domuuid},
{"domxml-from-native", cmdDomXMLFromNative, opts_domxmlfromnative, info_domxmlfromnative},
{"domxml-to-native", cmdDomXMLToNative, opts_domxmltonative, info_domxmltonative},
+ {"dump", cmdDump, opts_dump, info_dump},
{"dumpxml", cmdDumpXML, opts_dumpxml, info_dumpxml},
{"echo", cmdEcho, opts_echo, info_echo},
{"edit", cmdEdit, opts_edit, info_edit},
- {"find-storage-pool-sources", cmdPoolDiscoverSources,
- opts_find_storage_pool_sources, info_find_storage_pool_sources},
{"find-storage-pool-sources-as", cmdPoolDiscoverSourcesAs,
opts_find_storage_pool_sources_as, info_find_storage_pool_sources_as},
+ {"find-storage-pool-sources", cmdPoolDiscoverSources,
+ opts_find_storage_pool_sources, info_find_storage_pool_sources},
{"freecell", cmdFreecell, opts_freecell, info_freecell},
{"hostname", cmdHostname, NULL, info_hostname},
- {"list", cmdList, opts_list, info_list},
+ {"managedsave", cmdManagedSave, opts_managedsave, info_managedsave},
+ {"managedsave-remove", cmdManagedSaveRemove, opts_managedsaveremove, info_managedsaveremove},
{"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
+ {"memtune", cmdMemtune, opts_memtune, info_memtune},
{"migrate", cmdMigrate, opts_migrate, info_migrate},
{"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime, opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
+ {"reboot", cmdReboot, opts_reboot, info_reboot},
+ {"restore", cmdRestore, opts_restore, info_restore},
+ {"resume", cmdResume, opts_resume, info_resume},
+ {"save", cmdSave, opts_save, info_save},
+ {"schedinfo", cmdSchedinfo, opts_schedinfo, info_schedinfo},
+ {"setmaxmem", cmdSetmaxmem, opts_setmaxmem, info_setmaxmem},
+ {"setmem", cmdSetmem, opts_setmem, info_setmem},
+ {"setvcpus", cmdSetvcpus, opts_setvcpus, info_setvcpus},
+ {"shutdown", cmdShutdown, opts_shutdown, info_shutdown},
+ {"start", cmdStart, opts_start, info_start},
+ {"suspend", cmdSuspend, opts_suspend, info_suspend},
+ {"ttyconsole", cmdTTYConsole, opts_ttyconsole, info_ttyconsole},
+ {"undefine", cmdUndefine, opts_undefine, info_undefine},
+ {"update-device", cmdUpdateDevice, opts_update_device, info_update_device},
+ {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
+ {"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
+ {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
+ {"version", cmdVersion, NULL, info_version},
+ {"vncdisplay", cmdVNCDisplay, opts_vncdisplay, info_vncdisplay},
+ {NULL, NULL, NULL, NULL}
+};
+
+static const vshCmdDef domMonitoringCmds[] = {
+ {"domblkinfo", cmdDomblkinfo, opts_domblkinfo, info_domblkinfo},
+ {"domblkstat", cmdDomblkstat, opts_domblkstat, info_domblkstat},
+ {"domifstat", cmdDomIfstat, opts_domifstat, info_domifstat},
+ {"dominfo", cmdDominfo, opts_dominfo, info_dominfo},
+ {"dommemstat", cmdDomMemStat, opts_dommemstat, info_dommemstat},
+ {"domstate", cmdDomstate, opts_domstate, info_domstate},
+ {"list", cmdList, opts_list, info_list},
+ {NULL, NULL, NULL, NULL}
+};
+
+static const vshCmdDef storagePoolCmds[] = {
+ {"pool-autostart", cmdPoolAutostart, opts_pool_autostart, info_pool_autostart},
+ {"pool-build", cmdPoolBuild, opts_pool_build, info_pool_build},
+ {"pool-create-as", cmdPoolCreateAs, opts_pool_X_as, info_pool_create_as},
+ {"pool-create", cmdPoolCreate, opts_pool_create, info_pool_create},
+ {"pool-define-as", cmdPoolDefineAs, opts_pool_X_as, info_pool_define_as},
+ {"pool-define", cmdPoolDefine, opts_pool_define, info_pool_define},
+ {"pool-delete", cmdPoolDelete, opts_pool_delete, info_pool_delete},
+ {"pool-destroy", cmdPoolDestroy, opts_pool_destroy, info_pool_destroy},
+ {"pool-dumpxml", cmdPoolDumpXML, opts_pool_dumpxml, info_pool_dumpxml},
+ {"pool-edit", cmdPoolEdit, opts_pool_edit, info_pool_edit},
+ {"pool-info", cmdPoolInfo, opts_pool_info, info_pool_info},
+ {"pool-list", cmdPoolList, opts_pool_list, info_pool_list},
+ {"pool-name", cmdPoolName, opts_pool_name, info_pool_name},
+ {"pool-refresh", cmdPoolRefresh, opts_pool_refresh, info_pool_refresh},
+ {"pool-start", cmdPoolStart, opts_pool_start, info_pool_start},
+ {"pool-undefine", cmdPoolUndefine, opts_pool_undefine, info_pool_undefine},
+ {"pool-uuid", cmdPoolUuid, opts_pool_uuid, info_pool_uuid},
+ {NULL, NULL, NULL, NULL}
+};
+
+static const vshCmdDef storageVolCmds[] = {
+ {"vol-clone", cmdVolClone, opts_vol_clone, info_vol_clone},
+ {"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as},
+ {"vol-create", cmdVolCreate, opts_vol_create, info_vol_create},
+ {"vol-create-from", cmdVolCreateFrom, opts_vol_create_from, info_vol_create_from},
+ {"vol-delete", cmdVolDelete, opts_vol_delete, info_vol_delete},
+ {"vol-dumpxml", cmdVolDumpXML, opts_vol_dumpxml, info_vol_dumpxml},
+ {"vol-info", cmdVolInfo, opts_vol_info, info_vol_info},
+ {"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
+ {"vol-list", cmdVolList, opts_vol_list, info_vol_list},
+ {"vol-name", cmdVolName, opts_vol_name, info_vol_name},
+ {"vol-path", cmdVolPath, opts_vol_path, info_vol_path},
+ {"vol-pool", cmdVolPool, opts_vol_pool, info_vol_pool},
+ {"vol-wipe", cmdVolWipe, opts_vol_wipe, info_vol_wipe},
+ {NULL, NULL, NULL, NULL}
+};
+static const vshCmdDef networkCmds[] = {
{"net-autostart", cmdNetworkAutostart, opts_network_autostart, info_network_autostart},
{"net-create", cmdNetworkCreate, opts_network_create, info_network_create},
{"net-define", cmdNetworkDefine, opts_network_define, info_network_define},
@@ -9944,116 +10044,104 @@ static const vshCmdDef commands[] = {
{"net-start", cmdNetworkStart, opts_network_start, info_network_start},
{"net-undefine", cmdNetworkUndefine, opts_network_undefine, info_network_undefine},
{"net-uuid", cmdNetworkUuid, opts_network_uuid, info_network_uuid},
+ {NULL, NULL, NULL, NULL}
+};
- {"iface-list", cmdInterfaceList, opts_interface_list, info_interface_list},
- {"iface-name", cmdInterfaceName, opts_interface_name, info_interface_name},
- {"iface-mac", cmdInterfaceMAC, opts_interface_mac, info_interface_mac},
- {"iface-dumpxml", cmdInterfaceDumpXML, opts_interface_dumpxml, info_interface_dumpxml},
- {"iface-define", cmdInterfaceDefine, opts_interface_define, info_interface_define},
- {"iface-undefine", cmdInterfaceUndefine, opts_interface_undefine, info_interface_undefine},
- {"iface-edit", cmdInterfaceEdit, opts_interface_edit, info_interface_edit},
- {"iface-start", cmdInterfaceStart, opts_interface_start, info_interface_start},
- {"iface-destroy", cmdInterfaceDestroy, opts_interface_destroy, info_interface_destroy},
-
- {"managedsave", cmdManagedSave, opts_managedsave, info_managedsave},
- {"managedsave-remove", cmdManagedSaveRemove, opts_managedsaveremove, info_managedsaveremove},
-
- {"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
-
- {"nodedev-list", cmdNodeListDevices, opts_node_list_devices, info_node_list_devices},
- {"nodedev-dumpxml", cmdNodeDeviceDumpXML, opts_node_device_dumpxml, info_node_device_dumpxml},
+static const vshCmdDef nodedevCmds[] = {
+ {"nodedev-create", cmdNodeDeviceCreate, opts_node_device_create, info_node_device_create},
+ {"nodedev-destroy", cmdNodeDeviceDestroy, opts_node_device_destroy, info_node_device_destroy},
{"nodedev-dettach", cmdNodeDeviceDettach, opts_node_device_dettach, info_node_device_dettach},
+ {"nodedev-dumpxml", cmdNodeDeviceDumpXML, opts_node_device_dumpxml, info_node_device_dumpxml},
+ {"nodedev-list", cmdNodeListDevices, opts_node_list_devices, info_node_list_devices},
{"nodedev-reattach", cmdNodeDeviceReAttach, opts_node_device_reattach, info_node_device_reattach},
{"nodedev-reset", cmdNodeDeviceReset, opts_node_device_reset, info_node_device_reset},
- {"nodedev-create", cmdNodeDeviceCreate, opts_node_device_create, info_node_device_create},
- {"nodedev-destroy", cmdNodeDeviceDestroy, opts_node_device_destroy, info_node_device_destroy},
+ {"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
+ {NULL, NULL, NULL, NULL}
+};
+
+static const vshCmdDef ifaceCmds[] = {
+ {"iface-define", cmdInterfaceDefine, opts_interface_define, info_interface_define},
+ {"iface-destroy", cmdInterfaceDestroy, opts_interface_destroy, info_interface_destroy},
+ {"iface-dumpxml", cmdInterfaceDumpXML, opts_interface_dumpxml, info_interface_dumpxml},
+ {"iface-edit", cmdInterfaceEdit, opts_interface_edit, info_interface_edit},
+ {"iface-list", cmdInterfaceList, opts_interface_list, info_interface_list},
+ {"iface-mac", cmdInterfaceMAC, opts_interface_mac, info_interface_mac},
+ {"iface-name", cmdInterfaceName, opts_interface_name, info_interface_name},
+ {"iface-start", cmdInterfaceStart, opts_interface_start, info_interface_start},
+ {"iface-undefine", cmdInterfaceUndefine, opts_interface_undefine, info_interface_undefine},
+ {NULL, NULL, NULL, NULL}
+};
+static const vshCmdDef nwfilterCmds[] = {
{"nwfilter-define", cmdNWFilterDefine, opts_nwfilter_define, info_nwfilter_define},
- {"nwfilter-undefine", cmdNWFilterUndefine, opts_nwfilter_undefine, info_nwfilter_undefine},
{"nwfilter-dumpxml", cmdNWFilterDumpXML, opts_nwfilter_dumpxml, info_nwfilter_dumpxml},
- {"nwfilter-list", cmdNWFilterList, opts_nwfilter_list, info_nwfilter_list},
{"nwfilter-edit", cmdNWFilterEdit, opts_nwfilter_edit, info_nwfilter_edit},
+ {"nwfilter-list", cmdNWFilterList, opts_nwfilter_list, info_nwfilter_list},
+ {"nwfilter-undefine", cmdNWFilterUndefine, opts_nwfilter_undefine, info_nwfilter_undefine},
+ {NULL, NULL, NULL, NULL}
+};
- {"pool-autostart", cmdPoolAutostart, opts_pool_autostart, info_pool_autostart},
- {"pool-build", cmdPoolBuild, opts_pool_build, info_pool_build},
- {"pool-create", cmdPoolCreate, opts_pool_create, info_pool_create},
- {"pool-create-as", cmdPoolCreateAs, opts_pool_X_as, info_pool_create_as},
- {"pool-define", cmdPoolDefine, opts_pool_define, info_pool_define},
- {"pool-define-as", cmdPoolDefineAs, opts_pool_X_as, info_pool_define_as},
- {"pool-destroy", cmdPoolDestroy, opts_pool_destroy, info_pool_destroy},
- {"pool-delete", cmdPoolDelete, opts_pool_delete, info_pool_delete},
- {"pool-dumpxml", cmdPoolDumpXML, opts_pool_dumpxml, info_pool_dumpxml},
- {"pool-edit", cmdPoolEdit, opts_pool_edit, info_pool_edit},
- {"pool-info", cmdPoolInfo, opts_pool_info, info_pool_info},
- {"pool-list", cmdPoolList, opts_pool_list, info_pool_list},
- {"pool-name", cmdPoolName, opts_pool_name, info_pool_name},
- {"pool-refresh", cmdPoolRefresh, opts_pool_refresh, info_pool_refresh},
- {"pool-start", cmdPoolStart, opts_pool_start, info_pool_start},
- {"pool-undefine", cmdPoolUndefine, opts_pool_undefine, info_pool_undefine},
- {"pool-uuid", cmdPoolUuid, opts_pool_uuid, info_pool_uuid},
-
+static const vshCmdDef secretCmds[] = {
{"secret-define", cmdSecretDefine, opts_secret_define, info_secret_define},
{"secret-dumpxml", cmdSecretDumpXML, opts_secret_dumpxml, info_secret_dumpxml},
- {"secret-set-value", cmdSecretSetValue, opts_secret_set_value, info_secret_set_value},
{"secret-get-value", cmdSecretGetValue, opts_secret_get_value, info_secret_get_value},
- {"secret-undefine", cmdSecretUndefine, opts_secret_undefine, info_secret_undefine},
{"secret-list", cmdSecretList, NULL, info_secret_list},
+ {"secret-set-value", cmdSecretSetValue, opts_secret_set_value, info_secret_set_value},
+ {"secret-undefine", cmdSecretUndefine, opts_secret_undefine, info_secret_undefine},
+ {NULL, NULL, NULL, NULL}
+};
-
+static const vshCmdDef virshCmds[] = {
+#ifndef WIN32
+ {"cd", cmdCd, opts_cd, info_cd},
+#endif
+ {"echo", cmdEcho, opts_echo, info_echo},
+ {"exit", cmdQuit, NULL, info_quit},
+ {"help", cmdHelp, opts_help, info_help},
#ifndef WIN32
{"pwd", cmdPwd, NULL, info_pwd},
#endif
{"quit", cmdQuit, NULL, info_quit},
- {"exit", cmdQuit, NULL, info_quit},
- {"reboot", cmdReboot, opts_reboot, info_reboot},
- {"restore", cmdRestore, opts_restore, info_restore},
- {"resume", cmdResume, opts_resume, info_resume},
- {"save", cmdSave, opts_save, info_save},
- {"schedinfo", cmdSchedinfo, opts_schedinfo, info_schedinfo},
- {"dump", cmdDump, opts_dump, info_dump},
- {"shutdown", cmdShutdown, opts_shutdown, info_shutdown},
- {"setmem", cmdSetmem, opts_setmem, info_setmem},
- {"setmaxmem", cmdSetmaxmem, opts_setmaxmem, info_setmaxmem},
- {"memtune", cmdMemtune, opts_memtune, info_memtune},
- {"setvcpus", cmdSetvcpus, opts_setvcpus, info_setvcpus},
- {"suspend", cmdSuspend, opts_suspend, info_suspend},
- {"ttyconsole", cmdTTYConsole, opts_ttyconsole, info_ttyconsole},
- {"undefine", cmdUndefine, opts_undefine, info_undefine},
- {"update-device", cmdUpdateDevice, opts_update_device, info_update_device},
- {"uri", cmdURI, NULL, info_uri},
-
- {"vol-create", cmdVolCreate, opts_vol_create, info_vol_create},
- {"vol-create-from", cmdVolCreateFrom, opts_vol_create_from, info_vol_create_from},
- {"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as},
- {"vol-clone", cmdVolClone, opts_vol_clone, info_vol_clone},
- {"vol-delete", cmdVolDelete, opts_vol_delete, info_vol_delete},
- {"vol-wipe", cmdVolWipe, opts_vol_wipe, info_vol_wipe},
- {"vol-dumpxml", cmdVolDumpXML, opts_vol_dumpxml, info_vol_dumpxml},
- {"vol-info", cmdVolInfo, opts_vol_info, info_vol_info},
- {"vol-list", cmdVolList, opts_vol_list, info_vol_list},
- {"vol-pool", cmdVolPool, opts_vol_pool, info_vol_pool},
- {"vol-path", cmdVolPath, opts_vol_path, info_vol_path},
- {"vol-name", cmdVolName, opts_vol_name, info_vol_name},
- {"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
-
- {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
- {"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
- {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
- {"version", cmdVersion, NULL, info_version},
- {"vncdisplay", cmdVNCDisplay, opts_vncdisplay, info_vncdisplay},
+ {NULL, NULL, NULL, NULL}
+};
+static const vshCmdDef snapshotCmds[] = {
{"snapshot-create", cmdSnapshotCreate, opts_snapshot_create, info_snapshot_create},
{"snapshot-current", cmdSnapshotCurrent, opts_snapshot_current, info_snapshot_current},
{"snapshot-delete", cmdSnapshotDelete, opts_snapshot_delete, info_snapshot_delete},
{"snapshot-dumpxml", cmdSnapshotDumpXML, opts_snapshot_dumpxml, info_snapshot_dumpxml},
{"snapshot-list", cmdSnapshotList, opts_snapshot_list, info_snapshot_list},
{"snapshot-revert", cmdDomainSnapshotRevert, opts_snapshot_revert, info_snapshot_revert},
+ {NULL, NULL, NULL, NULL}
+};
+static const vshCmdDef hostAndHypervisorCmds[] = {
+ {"capabilities", cmdCapabilities, NULL, info_capabilities},
+ {"connect", cmdConnect, opts_connect, info_connect},
+ {"freecell", cmdFreecell, opts_freecell, info_freecell},
+ {"hostname", cmdHostname, NULL, info_hostname},
{"qemu-monitor-command", cmdQemuMonitorCommand, opts_qemu_monitor_command, info_qemu_monitor_command},
-
+ {"uri", cmdURI, NULL, info_uri},
{NULL, NULL, NULL, NULL}
};
+static const vshCmdGrp cmdGroups[] = {
+ {VSH_CMD_GRP_DOM_MANAGEMENT, "domain", domManagementCmds},
+ {VSH_CMD_GRP_DOM_MONITORING, "monitor", domMonitoringCmds},
+ {VSH_CMD_GRP_STORAGE_POOL, "pool", storagePoolCmds},
+ {VSH_CMD_GRP_STORAGE_VOL, "volume", storageVolCmds},
+ {VSH_CMD_GRP_NETWORK, "network", networkCmds},
+ {VSH_CMD_GRP_NODEDEV, "nodedev", nodedevCmds},
+ {VSH_CMD_GRP_IFACE, "interface", ifaceCmds},
+ {VSH_CMD_GRP_NWFILTER, "filter", nwfilterCmds},
+ {VSH_CMD_GRP_SECRET, "secret", secretCmds},
+ {VSH_CMD_GRP_SNAPSHOT, "snapshot", snapshotCmds},
+ {VSH_CMD_GRP_HOST_AND_HV, "host", hostAndHypervisorCmds},
+ {VSH_CMD_GRP_VIRSH, "virsh", virshCmds},
+ {NULL, NULL, NULL}
+};
+
+
/* ---------------
* Utils for work with command definition
* ---------------
@@ -10135,14 +10223,54 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd)
static const vshCmdDef *
vshCmddefSearch(const char *cmdname)
{
+ const vshCmdGrp *g;
const vshCmdDef *c;
- for (c = commands; c->name; c++)
- if (STREQ(c->name, cmdname))
- return c;
+ for (g = cmdGroups; g->name; g++) {
+ for (c = g->commands; c->name; c++) {
+ if(STREQ(c->name, cmdname))
+ return c;
+ }
+ }
+
return NULL;
}
+static const vshCmdGrp *
+vshCmdGrpSearch(const char *grpname)
+{
+ const vshCmdGrp *g;
+
+ for (g = cmdGroups; g->name; g++) {
+ if(STREQ(g->name, grpname) || STREQ(g->keyword, grpname))
+ return g;
+ }
+
+ return NULL;
+}
+
+static int
+vshCmdGrpHelp(vshControl *ctl, const char *grpname)
+{
+ const vshCmdGrp *grp = vshCmdGrpSearch(grpname);
+ const vshCmdDef *cmd = NULL;
+
+ if (!grp) {
+ vshError(ctl, _("command group '%s' doesn't exist"), grpname);
+ return FALSE;
+ } else {
+ vshPrint(ctl, _(" %s (help keyword '%s'):\n"), grp->name,
+ grp->keyword);
+
+ for (cmd = grp->commands; cmd->name; cmd++) {
+ vshPrint(ctl, " %-30s %s\n", cmd->name,
+ _(vshCmddefGetInfo(cmd, "help")));
+ }
+ }
+
+ return TRUE;
+}
+
static int
vshCmddefHelp(vshControl *ctl, const char *cmdname)
{
@@ -11323,25 +11451,36 @@ vshCloseLogFile(vshControl *ctl)
static char *
vshReadlineCommandGenerator(const char *text, int state)
{
- static int list_index, len;
+ static int grp_list_index, cmd_list_index, len;
const char *name;
+ const vshCmdGrp *grp;
+ const vshCmdDef *cmds;
- /* If this is a new word to complete, initialize now. This
- * includes saving the length of TEXT for efficiency, and
- * initializing the index variable to 0.
- */
if (!state) {
- list_index = 0;
+ grp_list_index = 0;
+ cmd_list_index = 0;
len = strlen(text);
}
+ grp = cmdGroups;
+
/* Return the next name which partially matches from the
* command list.
*/
- while ((name = commands[list_index].name)) {
- list_index++;
- if (STREQLEN(name, text, len))
- return vshStrdup(NULL, name);
+ while (grp[grp_list_index].name) {
+ cmds = grp[grp_list_index].commands;
+
+ if (cmds[cmd_list_index].name) {
+ while ((name = cmds[cmd_list_index].name)) {
+ cmd_list_index++;
+
+ if (STREQLEN(name, text, len))
+ return vshStrdup(NULL, name);
+ }
+ } else {
+ cmd_list_index = 0;
+ grp_list_index++;
+ }
}
/* If no names matched, then return NULL. */
@@ -11540,7 +11679,9 @@ vshDeinit(vshControl *ctl)
static void
vshUsage(void)
{
+ const vshCmdGrp *grp;
const vshCmdDef *cmd;
+
fprintf(stdout, _("\n%s [options]... [<command_string>]"
"\n%s [options]... <command> [args...]\n\n"
" options:\n"
@@ -11551,14 +11692,21 @@ vshUsage(void)
" -q | --quiet quiet mode\n"
" -t | --timing print timing information\n"
" -l | --log <file> output logging to file\n"
- " -v | --version[=short] program version\n\n"
- " -V | --version=long version and full options\n\n"
- " commands (non interactive mode):\n"), progname, progname);
+ " -v | --version program version\n\n"
+ " commands (non interactive mode):\n\n"), progname, progname);
- for (cmd = commands; cmd->name; cmd++)
- fprintf(stdout,
- " %-15s %s\n", cmd->name, _(vshCmddefGetInfo(cmd, "help")));
+ for (grp = cmdGroups; grp->name; grp++) {
+ fprintf(stdout, _(" %s (help keyword '%s')\n"), grp->name, grp->keyword);
+ for (cmd = grp->commands; cmd->name; cmd++)
+ fprintf(stdout,
+ " %-30s %s\n", cmd->name, _(vshCmddefGetInfo(cmd, "help")));
+
+ fprintf(stdout, "\n");
+ }
+
+ fprintf(stdout, "%s",
+ _("\n (specify help <group> for details about the commands in the group)\n"));
fprintf(stdout, "%s",
_("\n (specify help <command> for details about the command)\n\n"));
return;
--
1.7.3.2
14 years, 4 months