]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agobhyve: Fix declaration of 'params' in 'bhyveParsePCIFbuf'
Peter Krempa [Mon, 12 Apr 2021 16:18:49 +0000 (18:18 +0200)]
bhyve: Fix declaration of 'params' in 'bhyveParsePCIFbuf'

In commit ad80bba90a3 I mistakenly didn't delete '**' from the
variable declaration when converting it to 'GStrv' and deleted the
'separator' variable since it was declared on the same line as a
different variable.

Fixes: ad80bba90a3
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4 years agoci: README: Mention necessary step for cirrus to pick up the github project
Peter Krempa [Wed, 7 Apr 2021 08:59:26 +0000 (10:59 +0200)]
ci: README: Mention necessary step for cirrus to pick up the github project

Unless you create such an commit, cirrus-ci.com will not pick up the
github project and cirrus-run will fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: qemucapabilitiesdata: Fix wrong command identifier in caps_4.0.0.riscv64.replies
Peter Krempa [Thu, 8 Apr 2021 15:08:09 +0000 (17:08 +0200)]
tests: qemucapabilitiesdata: Fix wrong command identifier in caps_4.0.0.riscv64.replies

Commit cbd4ab4cc69 added a hunk with a broken reply ID.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemucapabilitiesdata: Fix formatting of manually added hunk
Peter Krempa [Thu, 8 Apr 2021 14:50:18 +0000 (16:50 +0200)]
tests: qemucapabilitiesdata: Fix formatting of manually added hunk

Commit 66c5674e797 added a query for the device properties of 'usb-host'
but the command header isn't formated the same way as if it were
autogenerated. Reformat all the files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2xmltest: Always include basic set of capabilities
Peter Krempa [Fri, 9 Apr 2021 13:41:53 +0000 (15:41 +0200)]
qemuxml2xmltest: Always include basic set of capabilities

Use virQEMUCapsInitQMPBasicArch to add the basic set of capabilities
which all qemu versions will get.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Parse 'arch' from XML early
Peter Krempa [Fri, 9 Apr 2021 13:18:41 +0000 (15:18 +0200)]
qemuxml2argvtest: Parse 'arch' from XML early

If we want to provide correct (fake) caps already for the XML parser we
need to be able to parse the arch early so that we can properly
initialize the caps cache prior to calling the XML parser.

This patch adds code which parses the arch and updates the caps cache
prior to the parse step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Rewrite parsing of XMLs to provide earlier parsing
Peter Krempa [Wed, 31 Mar 2021 14:11:42 +0000 (16:11 +0200)]
qemuxml2argvtest: Rewrite parsing of XMLs to provide earlier parsing

In upcoming patches we'll need to parse a certain bit of XML before
calling the full XML parser. This effectively open-codes what
virDomainDefParseFile to reach virDomainDefParseNode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirQEMUCapsInitQMPBasicArch: Use switch for arch-based decisions
Peter Krempa [Tue, 30 Mar 2021 15:05:01 +0000 (17:05 +0200)]
virQEMUCapsInitQMPBasicArch: Use switch for arch-based decisions

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2(argv|xml)test: Don't exit early when testQemuInfoSetArgs fails
Peter Krempa [Fri, 26 Mar 2021 17:21:34 +0000 (18:21 +0100)]
qemuxml2(argv|xml)test: Don't exit early when testQemuInfoSetArgs fails

Set the return code to failure and continue testing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2xmltest: testInfoSetPaths: Remove return value
Peter Krempa [Fri, 26 Mar 2021 17:53:32 +0000 (18:53 +0100)]
qemuxml2xmltest: testInfoSetPaths: Remove return value

The function doesn't fail. Remove the return value and checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs/platforms: Drop separate link to qemu-kvm on repology.org
Peter Krempa [Fri, 26 Mar 2021 16:12:54 +0000 (17:12 +0100)]
docs/platforms: Drop separate link to qemu-kvm on repology.org

The qemu-kvm page redirects to qemu on repology.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoRemove test 'args' file rewrapping infrastructure
Peter Krempa [Tue, 6 Apr 2021 14:49:47 +0000 (16:49 +0200)]
Remove test 'args' file rewrapping infrastructure

All tests which use files with 'ldargs' and 'args' suffix as output now
use the internal and better line splitting.

Remove the test-wrap-argv.py script, the syntax check which used it and
the helper rewrapping the output when regenerating test output.

For any further use, we require code to use virCommand anyways and thus
it has internal wrapping now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonodedevmdevctltest: Use internal linewrapping and variable command path stripping
Peter Krempa [Fri, 9 Apr 2021 07:21:28 +0000 (09:21 +0200)]
nodedevmdevctltest: Use internal linewrapping and variable command path stripping

Remove `nodedevCompareToFile` which was stripping the path to mdevctl
since it's no longer needed if we use the new features of
virCommandSetDryRun.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agobhyvexml2argvtest: Use internal wrapping of command line arguments
Peter Krempa [Wed, 31 Mar 2021 08:46:36 +0000 (10:46 +0200)]
bhyvexml2argvtest: Use internal wrapping of command line arguments

virCommandToString has the possibility to return an already wrapped
string with better format than what we get from the test wrapper script.

The main advantage is that arguments for an option are always on the
same line which makes it more easy to see what changed in a diff and
prevents re-wrapping of the line if a wrapping point moves over the
threshold.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonwfilterxml2firewalldata: Use internal wrapping to wrap output files
Peter Krempa [Tue, 6 Apr 2021 12:19:40 +0000 (14:19 +0200)]
nwfilterxml2firewalldata: Use internal wrapping to wrap output files

As with previous commits use virCommandSetDryRun to invoke
virCommandToString so that it returns pre-wrapped string.

Since virCommand is better aware of where the arguments terminate we can
see an improvement where comments are no longer line-wrapped.

The changes to the 'commonRules' strings were done with the following
regex:

 s/ -/ \\\\\\n-/

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonetworkxml2firewalltest: Use internal wrapping of command line arguments
Peter Krempa [Wed, 31 Mar 2021 08:46:36 +0000 (10:46 +0200)]
networkxml2firewalltest: Use internal wrapping of command line arguments

virCommandSetDryRun allows to invoke virCommandToString so that the
command string is already wrapped.

We now also need to load the base arguments file without unwrapping the
arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agostoragevolxml2argvtest: Use internal wrapping of command line arguments
Peter Krempa [Wed, 31 Mar 2021 08:46:36 +0000 (10:46 +0200)]
storagevolxml2argvtest: Use internal wrapping of command line arguments

virCommandToString has the possibility to return an already wrapped
string with better format than what we get from the test wrapper script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agostoragepoolxml2argvtest: Use internal wrapping of command line arguments
Peter Krempa [Wed, 31 Mar 2021 08:46:36 +0000 (10:46 +0200)]
storagepoolxml2argvtest: Use internal wrapping of command line arguments

virCommandToString has the possibility to return an already wrapped
string with better format than what we get from the test wrapper script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agostorage: Format mount options before positional arguments
Peter Krempa [Tue, 6 Apr 2021 14:40:42 +0000 (16:40 +0200)]
storage: Format mount options before positional arguments

Move calls to virStorageBackendFileSystemMountAddOptions earlier so that
the options are formatted before the positional arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Use internal wrapping of command line arguments
Peter Krempa [Wed, 31 Mar 2021 08:46:36 +0000 (10:46 +0200)]
qemuxml2argvtest: Use internal wrapping of command line arguments

virCommandToString has the possibility to return an already wrapped
string with better format than what we get from the test wrapper script.

The main advantage is that arguments for an option are always on the
same line which makes it more easy to see what changed in a diff and
prevents re-wrapping of the line if a wrapping point moves over the
threshold.

Additionally the used output is the same we have in the VM log file when
a VM is starting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agosyntax-check: Remove 90 char limit for 'argv' files
Peter Krempa [Wed, 31 Mar 2021 07:39:29 +0000 (09:39 +0200)]
syntax-check: Remove 90 char limit for 'argv' files

Splitting lines with arguments causes in many cases a rewrap if the
arguments are modified making it harder to see what actually changed.

In upcoming patches some rewrapping of 'args' files will be removed so
remove this check first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCommandToStringFull: Improve linebreaking behaviour
Peter Krempa [Tue, 6 Apr 2021 13:17:42 +0000 (15:17 +0200)]
virCommandToStringFull: Improve linebreaking behaviour

Put multiple values for an option if followed by another option as used
in certain iptables arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirTestLoadFileJSON: Don't try to unwrap JSON documents
Peter Krempa [Wed, 31 Mar 2021 07:29:22 +0000 (09:29 +0200)]
virTestLoadFileJSON: Don't try to unwrap JSON documents

Use virFileReadAll to load the file instead of virTestLoadFile which
tries to unwrap the file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirTestCompareToFile: Add possibility to skip unwrapping of input file
Peter Krempa [Wed, 31 Mar 2021 07:18:57 +0000 (09:18 +0200)]
virTestCompareToFile: Add possibility to skip unwrapping of input file

In some cases we might want to compare already wrapped data against a
wrapped file. Introduce virTestCompareToFileFull with a 'unwrap' boolean
which will control the unwrapping.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotestutils: Remove unused virTestClearCommandPath
Peter Krempa [Tue, 6 Apr 2021 09:24:47 +0000 (11:24 +0200)]
testutils: Remove unused virTestClearCommandPath

virCommand(ToString) now provides the functionality internally so we
don't have to keep the string-munging function around.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonwfilterebiptablestest: Strip path from test output via virCommandSetDryRun
Peter Krempa [Tue, 6 Apr 2021 09:21:21 +0000 (11:21 +0200)]
nwfilterebiptablestest: Strip path from test output via virCommandSetDryRun

Enable the internal path clearing instead of using
virTestClearCommandPath.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonwfilterxml2firewalltest: Strip path from test output via virCommandSetDryRun
Peter Krempa [Tue, 6 Apr 2021 09:21:21 +0000 (11:21 +0200)]
nwfilterxml2firewalltest: Strip path from test output via virCommandSetDryRun

Enable the internal path clearing instead of using
virTestClearCommandPath.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agonetworkxml2firewalltest: Strip path from test output via virCommandSetDryRun
Peter Krempa [Tue, 6 Apr 2021 09:21:21 +0000 (11:21 +0200)]
networkxml2firewalltest: Strip path from test output via virCommandSetDryRun

Enable the internal path clearing instead of using
virTestClearCommandPath.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCommandSetDryRun: Add flags to linebreak and strip prefix from the command buffer
Peter Krempa [Tue, 6 Apr 2021 08:56:23 +0000 (10:56 +0200)]
virCommandSetDryRun: Add flags to linebreak and strip prefix from the command buffer

virCommandToStringFull used internally when virCommandSetDryRun is
requested allows to strip command path and wrap lines nicely. Expose
these via virCommandSetDryRun so that tests can use those features
instead of local hacks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCommandSetDryRun: Rework resetting of the dry run data
Peter Krempa [Thu, 1 Apr 2021 15:54:09 +0000 (17:54 +0200)]
virCommandSetDryRun: Rework resetting of the dry run data

While virCommandSetDryRun is used in tests only, there were some cases
when error paths would not call the function with NULL arguments to
reset the dry run infrastructure.

Introduce virCommandDryRunToken type which must be allocated via
virCommandDryRunTokenNew and passed to virCommandSetDryRun.

This way we can use automatic variable cleaning to trigger the cleanup
of virCommandSetDryRun parameters and also the use of the token variable
ensures that all callers of virCommandSetDryRun clean up after
themselves and also that the token isn't left unused in the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: storagepoolxml2argvtest: Use integrated command path stripping
Peter Krempa [Tue, 6 Apr 2021 16:38:57 +0000 (18:38 +0200)]
tests: storagepoolxml2argvtest: Use integrated command path stripping

Replace virTestClearCommandPath by virCommandToStringFull which allows
to strip the command prefix internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirCommandToString: Allow stripping command path
Peter Krempa [Thu, 1 Apr 2021 14:09:54 +0000 (16:09 +0200)]
virCommandToString: Allow stripping command path

In tests we don't want to use the full path to commands as it's
unpleasant to keep that working on all systems.

Add an integrated way to strip the prefix which will be used to replace
virTestClearCommandPath() as a more systemic solution.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2xmloutdata: Remove unused symlinks to test XML files
Peter Krempa [Fri, 26 Mar 2021 17:09:33 +0000 (18:09 +0100)]
qemuxml2xmloutdata: Remove unused symlinks to test XML files

The symlinks are not used by the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2xmloutdata: Remove unused output XML files
Peter Krempa [Fri, 26 Mar 2021 17:01:06 +0000 (18:01 +0100)]
qemuxml2xmloutdata: Remove unused output XML files

The files are no longer referenced by existing test cases. Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvdata: Remove unused 'xml' files
Peter Krempa [Fri, 26 Mar 2021 16:47:17 +0000 (17:47 +0100)]
qemuxml2argvdata: Remove unused 'xml' files

The files are no longer referenced by either qemuxml2argvtest or
qemuxml2xmltest. Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvdata: Remove unused 'args' files
Peter Krempa [Fri, 26 Mar 2021 16:39:43 +0000 (17:39 +0100)]
qemuxml2argvdata: Remove unused 'args' files

The files were added in error (audio-*) for test cases which produce an
error, left over after converting to DO_TEST_CAPS_LATEST
(disk-detect-zeroes), or left over after splitting test cases
(disk-network-tlsx509).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: string: Remove pointless test for virStringListFreeCount
Peter Krempa [Tue, 23 Mar 2021 17:33:26 +0000 (18:33 +0100)]
tests: string: Remove pointless test for virStringListFreeCount

It's way more useful to run valgrind against the rest of the code than
this test to see whether virStringListFreeCount works. Remove the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virstring: Remove the virStringSplitCount wrapper funcion
Peter Krempa [Tue, 23 Mar 2021 17:17:40 +0000 (18:17 +0100)]
util: virstring: Remove the virStringSplitCount wrapper funcion

Callers which need the count of elements now count it in place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirVMXParseConfig: Replace virStringSplitCount by g_strsplit
Peter Krempa [Thu, 1 Apr 2021 13:36:49 +0000 (15:36 +0200)]
virVMXParseConfig: Replace virStringSplitCount by g_strsplit

Remove the last usage of virStringSplitCount

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSystemdActivationInitFromNames: Replace virStringSplit by g_strsplit
Peter Krempa [Thu, 1 Apr 2021 13:35:39 +0000 (15:35 +0200)]
virSystemdActivationInitFromNames: Replace virStringSplit by g_strsplit

While the code invokes the string list length calculation twice, it
happens only on error path, which by itself should never happen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoopenvzParseBarrierLimit: Rework string handling
Peter Krempa [Thu, 1 Apr 2021 13:34:52 +0000 (15:34 +0200)]
openvzParseBarrierLimit: Rework string handling

Use g_strsplit instead of virStringSplitCount and automatically free the
temporary string list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoxenParseXLVnuma: Replace virStringSplitCount by g_strsplit
Peter Krempa [Thu, 1 Apr 2021 13:34:03 +0000 (15:34 +0200)]
xenParseXLVnuma: Replace virStringSplitCount by g_strsplit

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoxenParsePCI: Replace virStringSplitCount by g_strsplit
Peter Krempa [Thu, 1 Apr 2021 13:33:22 +0000 (15:33 +0200)]
xenParsePCI: Replace virStringSplitCount by g_strsplit

Count the number of elements in place just for the check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virresctrl: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Tue, 23 Mar 2021 17:06:33 +0000 (18:06 +0100)]
util: virresctrl: Use g_strsplit instead of virStringSplitCount

In 3 of 4 instances the code didn't even need the count of the elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virresctrl: Remove empty 'cleanup' sections
Peter Krempa [Tue, 23 Mar 2021 16:50:52 +0000 (17:50 +0100)]
util: virresctrl: Remove empty 'cleanup' sections

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virresctrl: Use automatic memory freeing
Peter Krempa [Tue, 23 Mar 2021 16:45:16 +0000 (17:45 +0100)]
util: virresctrl: Use automatic memory freeing

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirResctrlAllocGetUnused: Use g_autoptr for variables of virResctrlAlloc type
Peter Krempa [Tue, 23 Mar 2021 16:43:47 +0000 (17:43 +0100)]
virResctrlAllocGetUnused: Use g_autoptr for variables of virResctrlAlloc type

Refactor the handling of variables so that the cleanup section can be
sanitized.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirResctrlAllocNewFromInfo: Use g_autoptr for 'ret'
Peter Krempa [Tue, 23 Mar 2021 16:42:31 +0000 (17:42 +0100)]
virResctrlAllocNewFromInfo: Use g_autoptr for 'ret'

Remove 'cleanup' and 'error' labels by switching 'ret' to automatic
pointer and stealing it in the return statement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirResctrlAllocNewFromInfo: Restrict variable scope and use automatic freeing
Peter Krempa [Tue, 23 Mar 2021 16:11:42 +0000 (17:11 +0100)]
virResctrlAllocNewFromInfo: Restrict variable scope and use automatic freeing

Move variables into the loop which uses them and use automatic freeing
for temporarily allocated variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirResctrlGetCacheInfo: Restrict variable scope and use automatic freeing
Peter Krempa [Tue, 23 Mar 2021 16:11:42 +0000 (17:11 +0100)]
virResctrlGetCacheInfo: Restrict variable scope and use automatic freeing

Move variables into the loop which uses them and use automatic freeing
for temporarily allocated variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agostorage: zfs: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Tue, 23 Mar 2021 15:46:15 +0000 (16:46 +0100)]
storage: zfs: Use g_strsplit instead of virStringSplitCount

Both instances just check the length once. Replicate that faithfully.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageBackendZFSRefreshPool: Reduce scope of 'tokens'
Peter Krempa [Tue, 23 Mar 2021 15:44:59 +0000 (16:44 +0100)]
virStorageBackendZFSRefreshPool: Reduce scope of 'tokens'

Declare it in the loop that actually uses it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agostorage: zfs: Don't split string if we need only first/last component
Peter Krempa [Tue, 23 Mar 2021 15:41:50 +0000 (16:41 +0100)]
storage: zfs: Don't split string if we need only first/last component

Use str(r)chr to find the correct bit rather than fully splitting the
string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageSourceParseBackingJSONUriCookies: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Tue, 23 Mar 2021 08:12:19 +0000 (09:12 +0100)]
virStorageSourceParseBackingJSONUriCookies: Use g_strsplit instead of virStringSplitCount

Count the elements after splitting the string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirshParseRateStr: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Tue, 23 Mar 2021 08:10:18 +0000 (09:10 +0100)]
virshParseRateStr: Use g_strsplit instead of virStringSplitCount

Count the elements after splitting the string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirshParseRateStr: Refactor cleanup
Peter Krempa [Tue, 23 Mar 2021 07:35:42 +0000 (08:35 +0100)]
virshParseRateStr: Refactor cleanup

Use g_auto for the string list and remove 'ret' and 'cleanup'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirHostValidateGetCPUFlags: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Tue, 23 Mar 2021 05:52:54 +0000 (06:52 +0100)]
virHostValidateGetCPUFlags: Use g_strsplit instead of virStringSplitCount

We don't need the count of elements to iterate the list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agobhyveParsePCIFbuf: Use g_strsplit instead of virStringSplitCount
Peter Krempa [Mon, 22 Mar 2021 17:10:54 +0000 (18:10 +0100)]
bhyveParsePCIFbuf: Use g_strsplit instead of virStringSplitCount

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirshParseEventStr: Use g_strsplit and automatic memory freeing
Peter Krempa [Mon, 22 Mar 2021 17:06:45 +0000 (18:06 +0100)]
virshParseEventStr: Use g_strsplit and automatic memory freeing

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirLogParseOutput: Replace virStringSplitCount by g_strsplit
Peter Krempa [Mon, 22 Mar 2021 17:02:28 +0000 (18:02 +0100)]
virLogParseOutput: Replace virStringSplitCount by g_strsplit

Unfortunately here we do need the count of elements. Use g_strv_length
to calculate it so that virStringSplitCount can be removed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirLogParseFilter: Replace virStringSplitCount by g_strsplit
Peter Krempa [Mon, 22 Mar 2021 16:59:14 +0000 (17:59 +0100)]
virLogParseFilter: Replace virStringSplitCount by g_strsplit

We don't really need the count.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirLogParseFilters: Refactor string list handling
Peter Krempa [Mon, 22 Mar 2021 16:38:24 +0000 (17:38 +0100)]
virLogParseFilters: Refactor string list handling

Rewrite the code to remove the need to calculate the string list count.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirLogParseOutputs: Refactor string list handling
Peter Krempa [Mon, 22 Mar 2021 16:38:24 +0000 (17:38 +0100)]
virLogParseOutputs: Refactor string list handling

Rewrite the code to remove the need to calculate the string list count.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virlog: Remove pointless 'cleanup' labels
Peter Krempa [Mon, 22 Mar 2021 16:52:55 +0000 (17:52 +0100)]
util: virlog: Remove pointless 'cleanup' labels

Previous refactors left empty cleanup labels. Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: virlog: Use g_auto(GStrv) instead of g_strfreev in cleanup section
Peter Krempa [Mon, 22 Mar 2021 16:47:41 +0000 (17:47 +0100)]
util: virlog: Use g_auto(GStrv) instead of g_strfreev in cleanup section

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageFileParseBackingStoreStr: use g_strsplit instead of virStringSplitCount
Peter Krempa [Mon, 22 Mar 2021 16:00:41 +0000 (17:00 +0100)]
virStorageFileParseBackingStoreStr: use g_strsplit instead of virStringSplitCount

The presence of the second element can be checked by looking at it
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirJSONValueObjectDeflattenWorker: use g_strsplit instead of virStringSplitCount
Peter Krempa [Mon, 22 Mar 2021 16:00:41 +0000 (17:00 +0100)]
virJSONValueObjectDeflattenWorker: use g_strsplit instead of virStringSplitCount

The presence of the second element can be checked by looking at it
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainDiskAddISCSIPoolSourceHost: use g_strsplit instead of virStringSplitCount
Peter Krempa [Mon, 22 Mar 2021 16:00:41 +0000 (17:00 +0100)]
virDomainDiskAddISCSIPoolSourceHost: use g_strsplit instead of virStringSplitCount

Count the elements directly using g_strv_length.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoRemove virStorageFileCanonicalizePath
Peter Krempa [Mon, 22 Mar 2021 16:33:41 +0000 (17:33 +0100)]
Remove virStorageFileCanonicalizePath

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Remove testing of virStorageFileCanonicalizePath
Peter Krempa [Mon, 22 Mar 2021 16:31:42 +0000 (17:31 +0100)]
tests: Remove testing of virStorageFileCanonicalizePath

Remove the last code using the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageFileBackendGlusterPriv: Remove 'cannonpath'
Peter Krempa [Mon, 22 Mar 2021 16:29:47 +0000 (17:29 +0100)]
virStorageFileBackendGlusterPriv: Remove 'cannonpath'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agostorage_file: Remove virStorageFileBackendFsPriv
Peter Krempa [Mon, 22 Mar 2021 16:28:21 +0000 (17:28 +0100)]
storage_file: Remove virStorageFileBackendFsPriv

The private data structure is no longer used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoRemove virStorageSourceGetUniqueIdentifier file backend API
Peter Krempa [Mon, 22 Mar 2021 16:25:55 +0000 (17:25 +0100)]
Remove virStorageSourceGetUniqueIdentifier file backend API

The API isn't used any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageSourceGetMetadata: Use depth limit instead of unique path checking
Peter Krempa [Mon, 22 Mar 2021 16:21:12 +0000 (17:21 +0100)]
virStorageSourceGetMetadata: Use depth limit instead of unique path checking

Prevent unbounded chains by limiting the recursion depth of
virStorageSourceGetMetadataRecurse to the maximum number of image layers
we limit anyways.

This removes the last use of virStorageSourceGetUniqueIdentifier which
will allow us to delete some crusty old infrastructure which isn't
really needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainStorageSourceValidateDepth: Define chain depth as macro
Peter Krempa [Mon, 22 Mar 2021 16:03:47 +0000 (17:03 +0100)]
qemuDomainStorageSourceValidateDepth: Define chain depth as macro

The magic constant will be used in one more place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: json: Remove virJSONValueNewArrayFromBitmap
Peter Krempa [Thu, 8 Apr 2021 11:42:30 +0000 (13:42 +0200)]
util: json: Remove virJSONValueNewArrayFromBitmap

The function is used only inside of the file. We can open-code it and
remove it as it's not very useful.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoutil: json: Remove virJSONValueGetArrayAsBitmap
Peter Krempa [Thu, 8 Apr 2021 11:37:10 +0000 (13:37 +0200)]
util: json: Remove virJSONValueGetArrayAsBitmap

The function is not used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirQEMUBuildCommandLineJSONArrayBitmap: Open code bitmap conversion
Peter Krempa [Thu, 8 Apr 2021 11:35:33 +0000 (13:35 +0200)]
virQEMUBuildCommandLineJSONArrayBitmap: Open code bitmap conversion

Add a simpler algorithm converting the JSON array to bitmap so that
virJSONValueGetArrayAsBitmap can be removed in next step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 12 Apr 2021 07:57:11 +0000 (09:57 +0200)]
Translated using Weblate (Korean)

Currently translated at 32.9% (3485 of 10581 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Translated using Weblate (Korean)

Currently translated at 32.8% (3481 of 10581 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agomeson: Drop readline kludge
Andrea Bolognani [Tue, 6 Apr 2021 12:56:38 +0000 (14:56 +0200)]
meson: Drop readline kludge

Both FreeBSD ports and Homebrew on macOS have readline 8.1 now,
and that version contains a correct pkg-config file so the kludge
is no longer necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoapi: Add 'flags' param to virNodeDeviceCreate/Undefine()
Jonathon Jongsma [Fri, 9 Apr 2021 15:50:03 +0000 (10:50 -0500)]
api: Add 'flags' param to virNodeDeviceCreate/Undefine()

Follow best practices and add a unsigned int flags parameter to these
new APIs that have not been in a release yet.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonodedev: fix release version in comments for new API
Jonathon Jongsma [Fri, 9 Apr 2021 15:38:41 +0000 (10:38 -0500)]
nodedev: fix release version in comments for new API

The comments mistakenly say 7.2.0, when they were actually merged during
the 7.3 development cycle.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodownloads.html: Add a link to GPG key used signing releases
Jiri Denemark [Thu, 1 Apr 2021 15:05:44 +0000 (17:05 +0200)]
downloads.html: Add a link to GPG key used signing releases

While the key is available on public GPG key servers, having it locally
at https://libvirt.org/sources/gpg_key.asc is even better.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovsh: fix memory leak in vshCommandParse
Ján Tomko [Tue, 6 Apr 2021 12:23:31 +0000 (14:23 +0200)]
vsh: fix memory leak in vshCommandParse

One of the error branches used a plain free where vshCommandFree
was required.

https://bugzilla.redhat.com/show_bug.cgi?id=1943415

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: avoid delay when defining a new mdev
Jonathon Jongsma [Mon, 1 Mar 2021 20:36:10 +0000 (14:36 -0600)]
nodedev: avoid delay when defining a new mdev

When calling virNodeDeviceDefineXML() to define a new mediated device,
we call virMdevctlDefine() and then wait for the new device to appear in
the driver's device list before returning. This caused long delays due
to the behavior of nodeDeviceFindNewMediatedDevice(). This function
checks to see if the device is in the list and then waits for 5s before
checking again.

Because mdevctl is relatively slow to query the list of defined
devices[0], the newly-defined device was generally not in the device
list when we first checked. This results in libvirt almost always taking
at least 5s to complete this API call for mediated devices, which is
unacceptable.

In order to avoid this long delay, we resort to a workaround. If the
call to virMdevctlDefine() was successful, we can assume that this new
device will exist the next time we query mdevctl for new devices. So we
simply add this provisional device definition directly to the nodedev
driver's device list and return from the function. At some point in the
future, the mdevctl handler will run and the "official" device will be
processed, which will update the provisional device if any new details
need to be added.

The reason that this is not necessary for virNodeDeviceCreateXML() is
because detecting newly-created (not defined) mdevs happens through
udev instead of mdevctl. And nodeDeviceFindNewMediatedDevice() always
calls 'udevadm settle' before checking to see whether the device is in
the list. This allows us to wait just long enough for all udev events to
be processed, so the device is almost always in the list the first time
we check and so we almost never end up hitting the 5s sleep.

[0] on my machine, 'mdevctl list --defined' took around 0.8s to
complete for only 3 defined mdevs.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: factor out function to add mediated devices
Jonathon Jongsma [Tue, 2 Mar 2021 17:14:06 +0000 (11:14 -0600)]
nodedev: factor out function to add mediated devices

To accomodate re-use of this functionality in a following patch, split
out the processing of an individual mdev definition into a separate
function.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: add docs about mdev attribute order
Jonathon Jongsma [Mon, 22 Feb 2021 19:58:05 +0000 (13:58 -0600)]
nodedev: add docs about mdev attribute order

Mention that mdev attribute order is significant.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: fix hang when destroying an mdev in use
Jonathon Jongsma [Tue, 2 Feb 2021 22:21:21 +0000 (16:21 -0600)]
nodedev: fix hang when destroying an mdev in use

Calling `mdevctl stop` for a mediated device that is in use by an active
domain will block until that vm exits (or the vm closes the device).
Since the nodedev driver cannot query the hypervisor driver to see
whether any active domains are using the device, we resort to a
workaround that relies on the fact that a vfio group can only be opened
by one user at a time. If we get an EBUSY error when attempting to open
the group file, we assume the device is in use and refuse to try to
destroy that device.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: add ability to specify UUID for new mdevs
Jonathon Jongsma [Fri, 29 Jan 2021 22:24:50 +0000 (16:24 -0600)]
nodedev: add ability to specify UUID for new mdevs

Use the new <uuid> element in the mdev caps to define and start devices
with a specific UUID.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: add <uuid> element to mdev caps
Jonathon Jongsma [Fri, 29 Jan 2021 21:24:10 +0000 (15:24 -0600)]
nodedev: add <uuid> element to mdev caps

It will be useful to be able to specify a particular UUID for a mediated
device when defining the node device. To accomodate that, allow this to
be specified in the xml schema. This patch also parses and formats that
value to the xml, but does not yet use it.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agovirsh: add "nodedev-start" command
Jonathon Jongsma [Thu, 9 Jul 2020 21:05:41 +0000 (16:05 -0500)]
virsh: add "nodedev-start" command

This virsh command maps to virNodeDeviceCreate(), which starts a node
device that has been previously defined by virNodeDeviceDefineXML().
This is only supported for mediated devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoapi: add virNodeDeviceCreate()
Jonathon Jongsma [Thu, 18 Jun 2020 15:21:13 +0000 (10:21 -0500)]
api: add virNodeDeviceCreate()

This new API function provides a way to start a persistently-defined
mediate device that was defined by virNodeDeviceDefineXML() (or one that
was defined externally via mdevctl)

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agovirsh: add nodedev-undefine command
Jonathon Jongsma [Mon, 13 Jul 2020 21:56:48 +0000 (16:56 -0500)]
virsh: add nodedev-undefine command

Add a virsh command that maps to virNodeDeviceUndefine().

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agovirsh: Factor out function to find node device
Jonathon Jongsma [Mon, 17 Aug 2020 21:21:48 +0000 (16:21 -0500)]
virsh: Factor out function to find node device

Several functions accept providing a node device by name or by wwnn,wwpn
pair. Extract the logic to do this into a function that can be used by
both callers.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoapi: add virNodeDeviceUndefine()
Jonathon Jongsma [Thu, 2 Jul 2020 20:14:30 +0000 (15:14 -0500)]
api: add virNodeDeviceUndefine()

This interface allows you to undefine a persistently defined (but
inactive) mediated devices. It is implemented via 'mdevctl'

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: refactor tests to support mdev undefine
Jonathon Jongsma [Fri, 13 Nov 2020 16:45:33 +0000 (10:45 -0600)]
nodedev: refactor tests to support mdev undefine

mdevctl 'stop' and 'undefine' commands take the same uuid parameter, so
refactor the test infrastructure to share common implementation for both
of these commands. The 'undefine' command will be introduced in a
following patch.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agovirsh: add nodedev-define command
Jonathon Jongsma [Mon, 13 Jul 2020 21:40:47 +0000 (16:40 -0500)]
virsh: add nodedev-define command

Add a virsh command that maps to virNodeDeviceDefineXML().

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agovirsh: Add --inactive, --all to nodedev-list
Jonathon Jongsma [Fri, 10 Jul 2020 19:47:01 +0000 (14:47 -0500)]
virsh: Add --inactive, --all to nodedev-list

Now that we can filter active and inactive node devices in
virConnectListAllNodeDevices(), add these switches to the virsh command.

Eventual output (once everything is hooked up):

    virsh # nodedev-list --cap mdev
    mdev_bd2ea955_3402_4252_8c17_7468083a0f26

    virsh # nodedev-list --inactive --cap mdev
    mdev_07d8b8b0_7e04_4c0f_97ed_9214ce12723c
    mdev_927c040f_ae7d_4a35_966e_286ba6ebbe1c

    virsh # nodedev-list --all --cap mdev
    mdev_07d8b8b0_7e04_4c0f_97ed_9214ce12723c
    mdev_927c040f_ae7d_4a35_966e_286ba6ebbe1c
    mdev_bd2ea955_3402_4252_8c17_7468083a0f26

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoapi: add virNodeDeviceDefineXML()
Jonathon Jongsma [Mon, 11 May 2020 16:40:26 +0000 (11:40 -0500)]
api: add virNodeDeviceDefineXML()

With mediated devices, we can now define persistent node devices that
can be started and stopped. In order to take advantage of this, we need
an API to define new node devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: add function to generate mdevctl define command
Jonathon Jongsma [Wed, 27 Jan 2021 16:55:07 +0000 (10:55 -0600)]
nodedev: add function to generate mdevctl define command

Abstract out the function used to generate the commandline for 'mdevctl
start' since they take the same arguments. Add tests to ensure that
we're generating the command properly.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>