- 15 4月, 2015 1 次提交
-
-
由 Eric Blake 提交于
Commit a0670aef caused a regression in 'virsh event' and 'virsh qemu-monitor-event' - if a user tries to filter the command to a specific domain, an error message is printed: $ virsh event dom --loop error: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA option and then the command continues as though no domain had been supplied (giving events for ALL domains, instead of the requested one). This is because the code was incorrectly assuming that all "domain" options would be supplied via a mandatory VSH_OT_DATA, even though "domain" is optional for these two commands, so we had changed them to VSH_OT_STRING to quit failing for other reasons (ever since it was decided that VSH_OT_DATA and VSH_OT_STRING should no longer be synonyms). In looking at the situation, though, the code for looking up a domain was making a pointless check for whether the option exists prior to finding the option's string value, as vshCommandOptStringReq does just fine at reporting any errors when looking up a string whether or not the option was present. So this is a case of regression fixing by pure code deletion :) * tools/virsh-domain.c (vshCommandOptDomainBy): Drop useless filter. * tools/virsh-interface.c (vshCommandOptInterfaceBy): Likewise. * tools/virsh-network.c (vshCommandOptNetworkBy): Likewise. * tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise. * tools/virsh-secret.c (vshCommandOptSecret): Likewise. * tools/virsh.h (vshCmdHasOption): Drop unused function. * tools/virsh.c (vshCmdHasOption): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 02 4月, 2015 2 次提交
- 20 2月, 2015 1 次提交
-
-
由 Martin Kletzander 提交于
When editing a domain with 'virsh edit' and failing validation, the usual message pops up: Failed. Try again? [y,n,f,?]: Turning off validation can be useful, mainly for testing (but other purposes too), so this patch adds support for relaxing definition in virsh-edit and makes 'virsh edit <domain>' more usable. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 06 9月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Expose the new flag just added to virDomainGetBlockJobInfo. With --raw, the presence or absence of --bytes determines which flag to use in the single API call. Without --raw, the use of --bytes forces an error if the server doesn't support it, otherwise, the code tries to silently fall back to scaling the MiB/s value. My goal is to eventually also support --bytes in bandwidth mode; but that's a bit further down the road (and needs a new API flag added in libvirt.h first). This changes the human output, but the previous patch added raw output precisely so that we can have flexibility with the human output. For this commit, I used qemu-monitor-command to force an unusual bandwidth, but the same will be possible once qemu implements virDomainBlockCopy: Before: Block Copy: [100 %] Bandwidth limit: 2 MiB/s After: Block Copy: [100 %] Bandwidth limit: 1048577 bytes/s (1.000 MiB/s) The cache avoids having to repeatedly checking whether the flag works when talking to an older server, when multiple blockjob commands are issued during a batch session and the user is manually polling for job completion. * tools/virsh.h (_vshControl): Add a cache. * tools/virsh.c (cmdConnect, vshReconnect): Initialize the cache. * tools/virsh-domain.c (opts_block_job): Add --bytes. * tools/virsh.pod (blockjob): Document this. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 19 8月, 2014 1 次提交
-
-
由 Chunyan Liu 提交于
A possible fix to issue: http://www.redhat.com/archives/libvir-list/2014-August/thread.html#00227 While doing migration on KVM host, found problem sometimes: VM is already running on the target host and disappears from source host, but 'virsh migrate' command line hangs, cannot exit normally. If pressing "ENTER" key, it will exit. The code hangs at tools/virsh-domain.c: cmdMigrate ->vshWatchJob->poll(): poll() is trying to select pipe_fd, which is used to receive message from doMigrate thread. In debugging, found that doMigrate finishes and at the end it does call safewrite() to write the retval ('0' or '1') to pipe_fd, and the write is completed. But cmdMigrate poll() cannot get the event. If pressing "ENTER" key, poll() can get the event and select pipe_fd, then command line can exit. In current code, authentication thread which is called by vshConnect will use stdin, and at the same time, in cmdMigrate main process, poll() is listening to stdin, that probably affect poll() to get pipe_fd event. Better to move authentication before vshWatchJob. With this change, above problem does not exist. Signed-off-by: NChunyan Liu <cyliu@suse.com>
-
- 12 6月, 2014 3 次提交
-
-
由 Peter Krempa 提交于
To follow the new semantics of the vshCommandOptToU* functions convert this one to reject negative numbers too. To allow using -1 for "maximum" semantics for the vol-*load two bandwidth functions that use this helper introduce vshCommandOptULongLongWrap.
-
由 Peter Krempa 提交于
To follow the new semantics of the vshCommandOptToU* functions convert this one to reject negative numbers too. To allow using -1 for "maximum" semantics for the two bandwidth functions that use this helper introduce vshCommandOptULWrap. Although currently the migrate-setspeed function for the qemu driver will reject -1 as maximum.
-
由 Peter Krempa 提交于
Use virStrToLong_uip instead of virStrToLong_ui to reject negative numbers in the helper. None of the callers expects the wraparound "feature" for negative numbers. Also add a function that allows wrapping of negative numbers as it might be used in the future and be explicit about the new semantics in the function docs.
-
- 09 4月, 2014 1 次提交
-
-
由 Li Yang 提交于
The original comment of vshCmdInfo: "name" - command name Actually it's 'help' and the short description of command, not the command name. Signed-off-by: NLi Yang <liyang.fnst@cn.fujitsu.com>
-
- 18 3月, 2014 1 次提交
-
-
由 Martin Kletzander 提交于
Introducing keepalive similarly to Guannan around 2 years ago. Since we want to introduce keepalive for every connection, it makes sense to wrap the connecting function into new virsh one that can deal keepalive as well. Function vshConnect() is now used for connecting and keepalive added in that function (if possible) helps preventing long waits e.g. while nework goes down during migration. This patch also adds the options for keepalive tuning into virsh and fails connecting only when keepalives are explicitly requested and cannot be set (whether it is due to missing support in connected driver or remote server). If not explicitely requested, a debug message is printed (hence the addition to virsh-optparse test). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1073506 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=822839Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 21 2月, 2014 2 次提交
-
-
由 Eric Blake 提交于
I plan to add 'virsh event' to virsh-domain.c and 'virsh net-event' to virsh-network.c; but as they will share quite a bit of common boilerplate, it's better to set that up now in virsh.c. * tools/virsh.h (_vshControl): Add fields. (vshEventStart, vshEventWait, vshEventDone, vshEventCleanup): New prototypes. * tools/virsh.c (vshEventFd, vshEventOldAction, vshEventInt) (vshEventTimeout): New helper variables and functions. (vshEventStart, vshEventWait, vshEventDone, vshEventCleanup): Implement new functions. (vshInit, vshDeinit, main): Manage event timeout. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Several virsh commands ask for a --timeout parameter in seconds, then use it to control interfaces that operate on millisecond limits; I also plan on adding a 'virsh event' command that also does this. Factor this into a common function. * tools/virsh.h (vshCommandOptTimeoutToMs): New prototype. * tools/virsh.c (vshCommandOptTimeoutToMs): New function. * tools/virsh-domain.c (cmdBlockCommit, cmdBlockCopy) (cmdBlockPull, cmdMigrate): Use it. (vshWatchJob): Adjust timeout scale. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 10月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
In commit b46c4787 I changed the code to watch long running jobs in virsh. Unfortunately I didn't take into account that poll may get a hangup if the terminal is not a TTY and will be closed. This patch avoids polling the STDIN fd when there's no TTY.
-
- 18 9月, 2013 1 次提交
-
-
由 Tomas Meszaros 提交于
completer and completer_flags added to the _vshCmdOptDef structure so it will be possible for completion generators to conveniently call option completer functions with desired flags. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 05 9月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Recent patches to fix handling of Ctrl-C when interacting with ssh are not portable to mingw, which lacks termios handling. The simplest solution is to just compile that code out, and if someone ever appears that has a serious interest in getting virsh fully functional even with ssh connections, they can provide patches at that time. * tools/virsh.h (_vshControl): Make termattr conditional. * tools/virsh.c (vshTTYIsInterruptCharacter) (vshTTYDisableInterrupt, vshTTYRestore, cfmakeraw, vshTTYMakeRaw) (main): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 03 9月, 2013 2 次提交
-
-
由 Peter Krempa 提交于
Move the function to virsh.c to the rest of the TTY managing functions and change the code so that it mirrors the rest.
-
由 Peter Krempa 提交于
This patch adds instrumentation to allow modification of config of the terminal in virsh and successful reset of the state afterwards. The added helpers allow to disable receiving of SIGINT when pressing the key sequence (Ctrl+C usualy). This normally sends SIGINT to the foreground process group which kills ssh processes used for transport of the data.
-
- 29 8月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Noticed while reviewing another patch that had an accidental mismatch due to refactoring. An audit of the code showed that very few callers of vshCommandOpt were expecting a return of -2, indicating programmer error, and of those that DID check, they just propagated that status to yet another caller that did not check. Fix this by making the code blatantly warn the programmer, rather than silently ignoring it and possibly doing the wrong thing downstream. I know that we frown on assert()/abort() inside libvirtd (libraries should NEVER kill the program that linked them), but as virsh is an app rather than the library, and as this is not the first use of assert() in virsh, I think this approach is okay. * tools/virsh.h (vshCommandOpt): Drop declaration. * tools/virsh.c (vshCommandOpt): Make static, and add a parameter. Abort on programmer errors rather than making callers repeat that logic. (vshCommandOptInt, vshCommandOptUInt, vshCommandOptUL) (vshCommandOptString, vshCommandOptStringReq) (vshCommandOptLongLong, vshCommandOptULongLong) (vshCommandOptBool): Adjust callers. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 20 8月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
At a slightly larger memory expense allow stealing of items from the string array returned from vshStringToArray and turn the result into a string list compatible with virStringSplit. This will allow to use the common dealloc function. This patch also fixes a few forgotten checks of return from vshStringToArray and one memory leak.
-
- 21 3月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
This patch adds three macros to the virsh source tree that help to easily check for mutually exclusive parameters. VSH_EXCLUSIVE_OPTIONS_EXPR has four arguments, two expressions to check and two names of the parameters to print in the message. VSH_EXCLUSIVE_OPTIONS is more specific and check the command structure for the parameters using vshCommandOptBool. VSH_EXCLUSIVE_OPTIONS_VAR is meant to check boolean variables with the same name as the parameters.
-
- 04 2月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
This patch adds a helper function with similar semantics to vshCommandOptString that requests a string argument, but does some error reporting without the need to do it in the functions themselves. The error reporting also provides information about the parameter whose retrieval failed.
-
- 21 12月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
- 03 12月, 2012 1 次提交
-
-
由 Peter Krempa 提交于
Libvirt's helper API's when called directly don't raise the error so that virsh remembers it. Subsequent calls to libvirt API's might reset the error. In case of schedinfo virDomainFree() in the cleanup section resets the error when virTypedParameterAssignFromStr() fails. This patch adds function vshSaveLibvirtError() that can be called after calling libvirt helper APIs to ensure the error is remembered.
-
- 21 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
-
- 17 9月, 2012 1 次提交
-
-
由 Osier Yang 提交于
This improve helper vshStringToArray to accept const string as argument instead. To not convert the const string when using vshStringToArray, and thus avoid motifying it.
-
- 06 9月, 2012 2 次提交
-
-
由 Osier Yang 提交于
Move definition of MATCH from virsh-domain-monitor.c into virsh.h, and rename it as VSH_MATCH for further use. * tools/virsh-domain-monitor.c: Change MATCH into VSH_MATCH * tools/virsh.h: Define VSH_MATCH
-
由 Osier Yang 提交于
tools/virsh.c: New helper function vshStringToArray. tools/virsh.h: Declare vshStringToArray. tools/virsh-domain.c: use the helper in cmdUndefine.
-
- 31 8月, 2012 1 次提交
-
-
由 Peter Krempa 提交于
Now that vshCommandRun() checks for the connection automaticaly, remove all of the redundant checks in the code. vshConnectionUsability() no longer needs to be exported and this patch marks it static.
-
- 21 8月, 2012 3 次提交
-
-
由 Eric Blake 提交于
Another worthwhile split, needed one more public function. * tools/virsh-nodedev.h: New file. * tools/Makefile.am (virsh_SOURCES): Build it. * tools/virsh-nodedev.c: Use new header. * tools/virsh.c: Likewise. (vshTreePrint): Export. * tools/virsh.h (vshTreePrint): Declare.
-
由 Eric Blake 提交于
In preparation for splitting virsh-interface.c, I found these functions need to be declared in virsh.h, as well as one that belongs more properly in virsh-domain.h. Also, since we use the VSH_BY* flags in more than one function, I improved how they are used. * tools/virsh.h (vshNameSorter, vshCmdHasOption): Declare. (VSH_BYID): Turn into enum. (vshCommandOptDomainBy): Move... * tools/virsh-domain.h): ...here. * tools/virsh.c: (vshNameSorter): Export. (cmd_has_option): Rename... (vshCmdHasOption): ...and export. (vshCommandOptDomainBy): Move... * tools/virsh-domain.c (vshCommandOptDomainBy): ...here, adjust signature, and check flags. * tools/virsh-network.c (vshCommandOptNetworkBy): Update callers. * tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise. * tools/virsh-secret.c (vshCommandOptSecret): Likewise. * tools/virsh-domain-monitor.c (includes): Likewise. * tools/virsh-host.c (includes): Likewise.
-
由 Eric Blake 提交于
Another file worth compiling on its own instead of by .c inclusion. * tools/virsh-domain-monitor.h: New file. * tools/Makefile.am (virsh_SOURCES): Build it. * tools/virsh.h (vshGetDomainDescription): Move to correct header. * tools/virsh-domain-monitor.c: Use new header. * tools/virsh.c: Likewise. * tools/virsh-domain.c: Likewise.
-
- 20 8月, 2012 2 次提交
-
-
由 Eric Blake 提交于
Convert the exported items in virsh.h to use a common 'vsh' prefix. * tools/virsh.h (VIRSH_MAX_XML_FILE): Rename... (VSH_MAX_XML_FILE): ...and parenthesize. (DIFF_MSEC, CTRL_CLOSE_BRACKET): Delete. (vshUsage, vshInit, vshDeinit, vshParseArgv): Remove prototype. (editWriteToTempFile, editFile, editReadBackFile, prettyCapacity) (virshReportError): Rename... (vshEditWriteToTempFile, vshEditFile, vshEditReadBackFile) (vshPrettyCapacity, vshReportError): ...into vsh namespace. (jobWatchTimeoutFunc): Move to virsh-domain.c. * tools/virsh.c (vshCommandRun): Inline former DIFF_MSEC. (main): Inline former CTRL_CLOSE_BRACKET. (vshUsage, vshInit, vshDeinit, vshParseArgv): Make static. (prettyCapacity, virshReportError, editWriteToTempFile, editFile): Fix naming, and adjust usage. (vshAskReedit, vshCommandRun, vshEventLoop, vshInit): Adjust usage. * tools/virsh-domain.c (cmdAttachDevice, cmdCPUCompare) (cmdCPUBaseline, cmdCreate, cmdDefine, cmdDetachDevice) (cmdUpdateDevice, cmdDesc, cmdUndefine, cmdStart, cmdVcpucount) (cmdAttachDevice, cmdDomjobinfo): Likewise. * tools/virsh-edit.c (do): Likewise. * tools/virsh-interface.c (cmdInterfaceDefine): Likewise. * tools/virsh-network.c (cmdNetworkCreate, cmdNetworkDefine): Likewise. * tools/virsh-nodedev.c (cmdNodeDeviceCreate): Likewise. * tools/virsh-nwfilter.c (cmdNWFilterDefine): Likewise. * tools/virsh-pool.c (cmdPoolCreate, cmdPoolDefine) (cmdPoolDiscoverSources, cmdPoolList): Likewise. * tools/virsh-secret.c (cmdSecretDefine): Likewise. * tools/virsh-snapshot.c (cmdSnapshotCreate, vshSnapshotCreate) (vshLookupSnapshot, cmdSnapshotEdit, cmdSnapshotCurrent) (vshGetSnapshotParent): Likewise. * tools/virsh-volume.c (cmdVolCreate, cmdVolCreateFrom) (cmdVolInfo, cmdVolList): Likewise.
-
由 Daniel P. Berrange 提交于
* cfg.mk: Whitelist virsh.h instead of virsh.c for strcasecmp check * tools/virsh-domain.h, tools/virsh.h: Fix #define indentation
-
- 18 8月, 2012 3 次提交
-
-
由 Eric Blake 提交于
C99 says that __foo naming is reserved for the compiler. Besides, we had several different styles in use; this consolidates things to set up the typedefs up front then declare the types with consistent naming. * tools/virsh.h: Use consistent struct naming. * tools/virsh.c (_vshCommandParser): Likewise.
-
由 Eric Blake 提交于
The virsh-domain.c file was pretty self-contained; the only entry point was the table of command definitions. The bulk of this patch is making more functions in virsh.c reusable. A later patch will clean up poor naming choices. * tools/Makefile.am (virsh_SOURCES): Build virsh-domain.c. * tools/virsh-domain.h: New file. * tools/virsh.h (virshReportError, vshResetLibvirtError) (vshAskReedit, vshStreamSink): Declare. * tools/virsh.c: Switch from using .c to .h. (virshReportError, vshResetLibvirtError, vshAskReedit) (vshStreamSink, prettyCapacity): Export. (vshCatchInt): Move... * tools/virsh-domain.c: ...into sole user. Use header.
-
由 Eric Blake 提交于
Having one .c file include another does not give any compilation benefits; move towards modular .o files by first splitting out reused declarations into a new virsh.h. This patch doesn't try very hard to see which functions are used or not, to make it easier to review the file split. Future patches can further trim the header to be smaller. * tools/Makefile.am (virsh_SOURCES): List new file, and prepare for others. * tools/virsh.c: Split declarations... * tools/virsh.h: ...into new file, and make several functions non-static. * tools/virsh-domain-monitor.c (vshGetDomainDescription): Make non-static.
-