- 12 1月, 2018 2 次提交
-
-
由 Michal Privoznik 提交于
In the future, completer callbacks will receive partially parsed command (and thus possibly incomplete). However, we still want them to use command options fetching APIs we already have (e.g. vshCommandOpt*()) and at the same time don't report any errors (nor call any asserts). Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
由 Michal Privoznik 提交于
In the future, this function is going to be called from vshReadlineParse() to provide parsed input for completer callbacks. The idea is to allow the callbacks to provide more specific data. For instance, for the following input: virsh # domifaddr --domain fedora --interface <TAB><TAB> the --interface completer callback is going to be called. Now, it is more user friendly if the completer offers only those interfaces found in 'fedora' domain. But in order to do that it needs to be able to retrieve partially parsed result. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 03 11月, 2017 1 次提交
-
-
由 Andrea Bolognani 提交于
Right-aligning backslashes when defining macros or using complex commands in Makefiles looks cute, but as soon as any changes is required to the code you end up with either distractingly broken alignment or unnecessarily big diffs where most of the changes are just pushing all backslashes a few characters to one side. Generated using $ git grep -El '[[:blank:]][[:blank:]]\\$' | \ grep -E '*\.([chx]|am|mk)$$' | \ while read f; do \ sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \ done Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
- 12 4月, 2017 1 次提交
-
-
由 Peter Krempa 提交于
Avoid the annoying issue where the public object freeing APIs overwrite the error set by helper functions, since they don't invoke the callback. The new helper remembers the error only if no previous error was set.
-
- 20 9月, 2016 1 次提交
-
-
由 Erik Skultety 提交于
Change the logic in a way, so that VSH_CMD_FLAG_ALIAS behaves similarly to how VSH_OT_ALIAS for command options, i.e. there is no need for code duplication for the alias and the aliased command structures. Along with that change, switch any existing VSH_CMD_FLAG_ALIAS occurrences to this new format. Also, since this patch introduces a new command structure element, adjust the virsh-self-test test to make sure we won't ever miss to specify the '.alias' member for an aliased command because doing that would lead to an internal error. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 14 9月, 2016 1 次提交
-
-
由 Michal Privoznik 提交于
This command should be exposed to other shells of ours. They are gonna need it as soon as we want to test them too. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 06 9月, 2016 1 次提交
-
-
由 Nishith Shah 提交于
This patch changes the signature of vshCompleters, allowing to pass along some data that we might want to along with the completers; for example, we might want to pass the autocomplete vshControl along with the completer, in case the completer requires a connection to libvirtd. Signed-off-by: NNishith Shah <nishithshah.2211@gmail.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 28 7月, 2016 1 次提交
-
-
由 Erik Skultety 提交于
Since commit 834c5720 which extracted the generic functionality out of virsh and made it available for other clients like virt-admin to make use of it, it also introduced a bug when it renamed the original VIRSH_ environment variables to VSH_ variables. Virt-admin of course suffers from the same bug, so this patch modifies the generic module vsh.c to construct the correct name for environment variables of each client from information it has. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357363Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 22 6月, 2016 1 次提交
-
-
由 Ján Tomko 提交于
We already have a syntax-check to prohibit direct use of these allocation functions.
-
- 29 3月, 2016 1 次提交
-
-
由 Peter Krempa 提交于
Historically we've used 'unsigned long' and allowed wrapping of negative numbers for bandwidth values. Add a helper that will simplify adding support for scaled integers and support for byte granularity while keeping the compatibility with the older approach.
-
- 15 2月, 2016 1 次提交
-
-
由 Peter Krempa 提交于
The macro would eat the first parameter. In some cases the format string for vshPrint was eaten. In other cases the calls referenced variables which did not exist in the given context. Avoid errors by doing compile time checking.
-
- 21 12月, 2015 1 次提交
-
-
由 Erik Skultety 提交于
Commmit df8192aa introduced admin related rename and some minor (caused by automated approach, aka sed) and some more severe isues along with it. First reason to revert is the inconsistency with libvirt library. Although we deal with the daemon directly rather than with a specific hypervisor, we still do have a connection. That being said, contributors might get under the impression that AdmDaemonNew would spawn/start a new daemon (since it's admin API, why not...), or AdmDaemonClose would do the exact opposite or they might expect DaemonIsAlive report overall status of the daemon which definitely isn't the case. The second reason to revert this patch is renaming virt-admin client. The client tool does not necessarily have to reflect the names of the API's it's using in his internals. An example would be 's/vshAdmConnect/vshAdmDaemon' where noone can be certain of what the latter function really does. The former is quite expressive about some connection magic it performs, but the latter does not say anything, especially when vshAdmReconnect and vshAdmDisconnect were left untouched.
-
- 09 12月, 2015 1 次提交
-
-
由 Ján Tomko 提交于
This function does not set an error. Make it obvious in its name to discourage its usage without reporting an error in the caller.
-
- 01 12月, 2015 1 次提交
-
-
由 Martin Kletzander 提交于
virAdmConnect was named after virConnect, but after some discussions, most of the APIs called will be working with remote daemon and starting them virAdmDaemon will make more sense. Only possibly controversal name is CloseCallback (de)registration, and connecting to the daemon (which will still be Open/Close), but even this makes sense if one thinks about the daemon being opened and closed, e.g. as file, etc. This way all the APIs working with the daemon will start with virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter and that will better suit with other namings as well (virDomain*, virAdmServer*, etc.). Because in virt-admin, the connection name does not refer to a struct that would have a connect in its name, also adjust 'connname' in clients. And because it is not used anywhere in the vsh code, move it from there into each client. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 04 9月, 2015 3 次提交
-
-
由 Erik Skultety 提交于
There's no reason why debug initialization could not be made completely hidden, just like readline initialization is. The point of the global initializer vshInit is to make initialization of smaller features transparent to the user/caller.
-
由 Erik Skultety 提交于
Commit a0b6a36f separated vshInitDebug from the original vshInit (before virsh got split and vshInit became virshInit - commit 834c5720) in order to be able to debug command line parsing. After the parsing is finished, debugging is reinitialized to work properly. There might as well be other features that require re-initialization as the command line could specify parameters that override our defaults which had been set prior to calling vshArgvParse.
-
由 Erik Skultety 提交于
As part of the effort to stay consistent, change the vshInit signature from returning int to returning bool. Moreover, remove the unnecessary error label as there is no cleanup that would make use of it.
-
- 14 8月, 2015 1 次提交
-
-
由 Erik Skultety 提交于
In order to share as much virsh' logic as possible with upcomming virt-admin client we need to split virsh logic into virsh specific and client generic features. Since majority of virsh methods should be generic enough to be used by other clients, it's much easier to rename virsh specific data to virshX than doing this vice versa. It moved generic virsh commands (including info and opts structures) to generic module vsh.c. Besides renaming methods and structures, this patch also involves introduction of a client specific control structure being referenced as private data in the original control structure, introduction of a new global vsh Initializer, which currently doesn't do much, but there is a potential for added functionality in the future. Lastly it introduced client hooks which are especially necessary during client connecting phase.
-
- 02 6月, 2015 1 次提交
-
-
由 Andrea Bolognani 提交于
This will allow us to use vshError() to report errors from inside vshCommandOpt*(), instead of replicating the same logic and error messages all over the place. We also have more context inside the vshCommandOpt*() functions, for example the actual value used on the command line, which means we can produce more detailed error messages. vshCommandOptBool() is the exception here, because it's explicitly designed not to report any error.
-
- 04 5月, 2015 1 次提交
-
-
由 Pavel Hrdina 提交于
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 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.
-