- 21 10月, 2019 1 次提交
-
-
由 Ján Tomko 提交于
My commit removed the last use in the version for platforms without readline. Fixes: c937c1d2Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
- 20 10月, 2019 4 次提交
-
-
由 Ján Tomko 提交于
Now that we use g_strdup everywhere, delete vshStrdup. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
由 Ján Tomko 提交于
Remove all the uses of vshStrdup in favor of GLib's g_strdup. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
由 Ján Tomko 提交于
Remove the use of vshStrdup. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
由 Ján Tomko 提交于
Split the parameters to make changes more readable. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
-
- 16 10月, 2019 1 次提交
-
-
由 Ján Tomko 提交于
Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 15 10月, 2019 1 次提交
-
-
由 Ján Tomko 提交于
Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED. Signed-off-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 07 10月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
We're using gnulib to get ffs, ffsl, rotl32, count_one_bits, and count_leading_zeros. Except for rotl32 they can all be replaced with gcc/clangs builtins. rotl32 is a one-line trivial function. Reviewed-by: NJán Tomko <jtomko@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 07 8月, 2019 1 次提交
-
-
由 Daniel P. Berrangé 提交于
Now that 100% of libvirt code is forbidden in a SUID environment, we no longer need to worry about whether env variables are trustworthy or not. The virt-login-shell setuid program, which does not link to any libvirt code, will purge all environment variables, except $TERM, before invoking the virt-login-shell-helper program which uses libvirt. Reviewed-by: NMichal Privoznik <mprivozn@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 25 7月, 2019 1 次提交
-
-
由 Ján Tomko 提交于
We don't need domain_conf or libvirt-{qemu,lxc} in these generic files. Signed-off-by: NJán Tomko <jtomko@redhat.com> Acked-by: NPeter Krempa <pkrempa@redhat.com>
-
- 12 4月, 2019 1 次提交
-
-
由 Andrea Bolognani 提交于
This code is needed to use readline older than 4.1, but all our target platforms ship with at least 6.0 these days so we can safely get rid of it. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 25 3月, 2019 3 次提交
-
-
由 Eric Blake 提交于
Since test:///default resets state on every connection, writing a test that covers a sequence of commands must be done from a single session. But if the test wants to exercise particular failure modes as well as successes, it can be nice to leave witnesses in the stderr stream immediately before and after the spot where the expected error should be, to ensure the rest of the script is not causing errors. Do this by adding an --err option. Signed-off-by: NEric Blake <eblake@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Eric Blake 提交于
As the previous commit mentioned, argv mode (such as when you feed virsh via stdin with <<\EOF instead of via a single shell argument) didn't permit comments. Do this by treating any command name token that starts with # as a comment which silently eats all remaining arguments to the next newline or semicolon. Note that batch mode recognizes unquoted # at the start of any word as a command as part of the tokenizer, while this patch only treats # at the start of the command word as a comment (any other # remaining by the time vshCommandParse() is processing things was already quoted during the tokenzier, and as such was probably intended as the actual argument to the command word earlier in the line). Now I can do something like: $ virsh -c test:///default <<EOF # setup snapshot-create-as test s1 snapshot-create-as test s2 # check snapshot-list test --name EOF Signed-off-by: NEric Blake <eblake@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Eric Blake 提交于
Continuing from what I did in commit 4817dec0, now I want to write a sequence that is self-documenting. So I need comments :) Now I can do something like: $ virsh -c test:///default ' # setup snapshot-create-as test s1 snapshot-create-as test s2 # check snapshot-list test --name ' Note that this does NOT accept comments in argv mode, another patch will tackle that. (If I'm not careful, I might turn virsh into a full-fledged 'sh' replacement? Here's hoping I don't go that far...) Signed-off-by: NEric Blake <eblake@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 12 3月, 2019 2 次提交
-
-
由 Peter Krempa 提交于
It's meant for testing, not for production builds. Also we have a helper for reporting OOM errors. Introduced by 23e0bf1cSigned-off-by: NPeter Krempa <pkrempa@redhat.com>
-
由 Eric Blake 提交于
In local testing, I accidentally introduced a self-test failure, and spent way too much time debugging it. Make sure the testsuite log includes some hint as to why command option validation failed. Lone exception: allocation failure is unlikely during self-test, and if it happens, we are better off asserting (vsh.c can do this, even if libvirt.so cannot). Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com> Acked-by: NPeter Krempa <pkrempa@redhat.com>
-
- 27 2月, 2019 2 次提交
-
-
由 Eric Blake 提交于
The previous patch made it possible to split multiple commands by adding newline, but not to split a long single command. The sequence backslash-newline was being used as if it were a quoted newline character, rather than completely elided the way the shell does. Again, add more tests, although this time it seems more like I am suffering from a leaning-toothpick syndrome with all the \. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
由 Eric Blake 提交于
I wanted to do a demonstration with virsh batch mode, which takes multiple commands all packed into a single argument: $ virsh -c test:///default 'echo a; echo b;' a b but that produced a really long line, so I tried to make it more legible: $ virsh -c test:///default ' echo a; echo b; ' error: unknown command: ' ' Let's be more like the shell, and treat unquoted newline as a command separator just as we do for semicolon. In fact, with that, I can even now mix styles: $ virsh -c test:///default ' echo a; echo b echo c ' a b c Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
- 03 1月, 2019 1 次提交
-
-
由 Michal Privoznik 提交于
In 60046283 we've tried to remove Author(s): lines from comments at the beginning of our source files. Well, in some files while we removed the "Author" line we did not remove the actual list of authors. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 12 10月, 2018 1 次提交
-
-
由 Eric Blake 提交于
Commit 4f4c3b13 (v3.3) fixed an issue where performing cleanup of libvirt objects could sometimes lose error messages, by adding code to copy the libvirt error into last_error prior to cleanup paths. However, it caused a regression: on other paths, some errors are now printed twice, if libvirt still remembers in its thread-local storage that an error was set even after virsh cleared last_error. For example: $ virsh -c test:///default snapshot-delete test blah error: Domain snapshot not found: no domain snapshot with matching name 'blah' error: Domain snapshot not found: no domain snapshot with matching name 'blah' Fix things by telling libvirt to discard any thread-local errors at the same time virsh prints an error message (whether or not the libvirt error is the same as what is stored in last_error). Update the virsh-undefine testsuite (partially reverting portions of commit b620bdee, by removing -q, to more easily pinpoint which commands are causing which messages), now that there is only one error message instead of two. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 20 9月, 2018 2 次提交
-
-
由 Erik Skultety 提交于
All of the ones being removed are pulled in by internal.h. The only exception is sanlock which expects the application to include <stdint.h> before sanlock's headers, because sanlock prototypes use fixed width int, but they don't include stdint.h themselves, so we have to leave that one in place. Signed-off-by: NErik Skultety <eskultet@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Erik Skultety 提交于
It doesn't really make sense for us to have stdlib.h and string.h but not stdio.h in the internal.h header. Signed-off-by: NErik Skultety <eskultet@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 06 6月, 2018 1 次提交
-
-
由 ramyelkest 提交于
Replace instances where we previously called virGetLastError just to either get the code or to check if an error exists with virGetLastErrorCode to avoid a validity pre-check. Signed-off-by: NRamy Elkest <ramyelkest@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 11 5月, 2018 1 次提交
-
-
由 Lin Ma 提交于
Signed-off-by: NLin Ma <lma@suse.com>
-
- 10 5月, 2018 3 次提交
-
-
由 Lin Ma 提交于
Currently the VSH_OT_ARGV options don't support complete, But some of VSH_OT_ARGV options are gonna support complete in upcoming patches. Once applied the upcoming completion patches for VSH_OT_ARGV options, If we don't ignore VSH_OT_ARGV here, The vshReadlineOptionsGenerator will be called, Hence complete output will consist of the result by command completer + the result by option completer, It's confusing. e.g. $ virsh domstats --domain <TAB><TAB> --backing --interface --list-paused --perf --vcpu --balloon leap42.3 --list-persistent --raw win10 --block --list-active --list-running sles12sp3 --cpu-total --list-inactive --list-shutoff sles15 --enforce --list-other --list-transient --state After this patch and the upcoming completion patches: $ virsh domstats --domain <TAB><TAB> leap42.3 sles12sp3 sles15 win10 Signed-off-by: NLin Ma <lma@suse.com>
-
由 Lin Ma 提交于
It's helpful for users while they type certain kind of VSH_OT_ARGV options. e.g. $ virsh domstats --domain sles12sp3 --d<TAB> Signed-off-by: NLin Ma <lma@suse.com>
-
由 Lin Ma 提交于
The first entry in the returned array is the substitution for TEXT. It causes unnecessary output if other commands or options share the same prefix, e.g. $ virsh des<TAB><TAB> des desc destroy or $ virsh domblklist --d<TAB><TAB> --d --details --domain This patch fixes the above issue. Signed-off-by: NLin Ma <lma@suse.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 28 2月, 2018 1 次提交
-
-
由 Michal Privoznik 提交于
Currently if cmd->skipChecks is set (done only from completers) some basic checks are skipped because we're working over partially parsed command. See a26ff63a for more detailed explanation. Anyway, the referenced commit was too aggressive in disabling checks and effectively returned success even in clear case of failure. For instance: # domif-getlink --interface <TAB><TAB> causes virshDomainInterfaceCompleter() to be called, which calls virshDomainGetXML() which eventually calls vshCommandOptStringReq(.., name = "domain"); The --domain argument is required for the command and if not present -1 should be returned to tell the caller the argument was not found. Well, zero is returned meaning the argument was not found but it's not required either. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 25 1月, 2018 2 次提交
-
-
由 Erik Skultety 提交于
Unfortunately, we have a number of aliases in virsh and even though these are not visible any more, we have to support them. The problem is that when trying to print help for the alias, we get SIGSEGV because there isn't any @def structure anymore and we need to query the command being aliased instead. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1538570Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
由 Erik Skultety 提交于
These helpers are called from a single place only - cmdHelp wrapper and just before the wrapper invokes the helpers, it performs the search, either for command group or for the command itself, except the result is discarded and the helper therefore needs to do it again. Drop this inefficient handling and pass the @def structure rather than a name, thus preventing the helper from needing to perform the search again. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 15 1月, 2018 2 次提交
-
-
由 Michal Privoznik 提交于
When building without readline, this function does nothing but return false. Without touching any of its arguments which triggers a build error. Therefore, provide a stub that has arguments marked as unused. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 Michal Privoznik 提交于
The current state of art is as follows: 1) vshReadlineOptionsGenerator() generate all possible --options for given command, and then 2) vshReadlineOptionsPrune() clears out already provided ones from the list. Not only this brings needless memory complexity it is also not trivial to get right. We can switch to easier approach: just don't add already specified --options in the first step. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 12 1月, 2018 8 次提交
-
-
由 Michal Privoznik 提交于
This command is going to be called from bash completion script in the following form: virsh complete -- start --domain Its only purpose is to return list of possible strings for completion. Note that this is a 'hidden', unlisted command and therefore there's no documentation to it. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
Similarly to the previous commit, once we've presented an --option for a command to the user it makes no sense to offer it again. Therefore, we can prune all already specified options. For instance, after this patch: virsh # migrate --verbose <TAB><TAB> will no longer offer --verbose option. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
Instead of having completers prune returned string list based on user's input we can do that right after the callback is called. Only strings matching the prefix will be presented to the user then. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
Now that we have everything prepared we can call options' completer again. At the same time, pass partially parsed input to the completer callback - it will help the callbacks to narrow down the list of returned options based on user's input. For instance, if the completer is supposed to return list of interfaces depending on user input it may return just those interfaces defined for already specified domain. Of course, completers might ignore this parameter. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
The first argument passed to this function is vshControl *. There's no need to use void pointer. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 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 提交于
It's better to fetch list of either commands or options just once and then iterate over it. Moreover, it makes future completers way simpler as they will return string lists too. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
When returning a string that needs escaping there are two scenarios that can happen. Firstly, user already started the string with a quote (or double quote) in which case we don't need to do anything - readline takes care of that. However, if they haven't typed anything yet, we need to escape the string ourselves. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-