[PATCH] formatdomain.rst: update slice xml in "Hard drives" part
by “Meina
Update slice xml from block lun disk because it doesn't support storage slice
Signed-off-by: Meina Li <meili(a)redhat.com>
---
docs/formatdomain.rst | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 1b9b221611..44aee9fa77 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2381,9 +2381,6 @@ paravirtualized driver is specified via the ``disk`` element.
<disk type='block' device='lun'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sda'>
- <slices>
- <slice type='storage' offset='12345' size='123'/>
- </slices>
<reservations managed='no'>
<source type='unix' path='/path/to/qemu-pr-helper' mode='client'/>
</reservations>
@@ -2393,10 +2390,14 @@ paravirtualized driver is specified via the ``disk`` element.
</disk>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
- <source dev='/dev/sda'/>
+ <source dev='/dev/sda'>
+ <slices>
+ <slice type='storage' offset='12345' size='123'/>
+ </slices>
+ </source>
<geometry cyls='16383' heads='16' secs='63' trans='lba'/>
<blockio logical_block_size='512' physical_block_size='4096'/>
- <target dev='hdj' bus='ide'/>
+ <target dev='sda' bus='scsi'/>
</disk>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw'/>
--
2.27.0
3 years, 6 months
[PATCH] bash-completion: Fix argument passing to $1
by Michal Privoznik
Our vsh bash completion string is merely just a wrapper over
virsh/virt-admin complete (cmdComplete) - a hidden command that
uses internal readline completion to generate list of candidates.
But this means that we have to pass some additional arguments to
the helper process: e.g. connection URI and R/O flag.
Candidates are printed on a separate line each (and can contain
space), which means that when bash is reading the helper's output
into an array, it needs to split items on '\n' char - hence the
IFS=$'\n' prefix on the line executing the helper. This was
introduced in b889594a70.
But this introduced a regression - those extra arguments we might
pass are stored in a string and previously were split on a space
character (because $IFS was kept untouched and by default
contains space). But now, after the fix that's no longer the case
and thus virsh/virt-admin sees ' -r -c URI' as one argument.
The solution is to take $IFS out of the picture by storing the
extra arguments in an array instead of string.
Fixes: b889594a7092440dc916e3f43eeeaca2684571ee
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/bash-completion/vsh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh
index bbb25fc3eb..402945a8c5 100644
--- a/tools/bash-completion/vsh
+++ b/tools/bash-completion/vsh
@@ -30,12 +30,12 @@ _vsh_complete()
c=$((++c))
done
- CMDLINE=
+ CMDLINE=( )
if [ -n "${RO}" ]; then
- CMDLINE="${CMDLINE} -r"
+ CMDLINE+=("-r")
fi
if [ -n "${URI}" ]; then
- CMDLINE="${CMDLINE} -c ${URI}"
+ CMDLINE+=("-c" "${URI}")
fi
INPUT=( "${COMP_WORDS[@]:$i:$COMP_CWORD}" )
@@ -56,7 +56,7 @@ _vsh_complete()
# the name of the command whose arguments are being
# completed.
# Therefore, we might just run $1.
- IFS=$'\n' A=($($1 ${CMDLINE} complete -- "${INPUT[@]}" 2>/dev/null))
+ IFS=$'\n' A=($($1 ${CMDLINE[@]} complete -- "${INPUT[@]}" 2>/dev/null))
COMPREPLY=($(compgen -W "${A[*]%--}" -- ${cur}))
__ltrim_colon_completions "$cur"
--
2.26.3
3 years, 6 months
[PATCH 0/3] tests: qemuxml2argv negative tests for hugepages and numatune
by Han Han
Han Han (3):
tests: negative test for hugepages with anonymous memory backing
tests: negative test for hugepages with ondemand mode
tests: negative test of binding memnode cellid to an nonexist guest
cell
.../qemuxml2argvdata/hugepages-anonymous.err | 1 +
.../qemuxml2argvdata/hugepages-anonymous.xml | 25 +++++++++++++++
tests/qemuxml2argvdata/hugepages-ondemand.err | 1 +
tests/qemuxml2argvdata/hugepages-ondemand.xml | 25 +++++++++++++++
...une-memnode-cellid-nonexist-guest-cell.err | 1 +
...une-memnode-cellid-nonexist-guest-cell.xml | 31 +++++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
7 files changed, 87 insertions(+)
create mode 100644 tests/qemuxml2argvdata/hugepages-anonymous.err
create mode 100644 tests/qemuxml2argvdata/hugepages-anonymous.xml
create mode 100644 tests/qemuxml2argvdata/hugepages-ondemand.err
create mode 100644 tests/qemuxml2argvdata/hugepages-ondemand.xml
create mode 100644 tests/qemuxml2argvdata/numatune-memnode-cellid-nonexist-guest-cell.err
create mode 100644 tests/qemuxml2argvdata/numatune-memnode-cellid-nonexist-guest-cell.xml
--
2.30.2
3 years, 6 months
[PATCH 0/1] replace the method in several files
by Luke Yue
Using `git grep -n "\[0\].*'/'"` to find files that may need the
treatment, then judge and replace. There may be some files replaced by
mistake though.
Luke Yue (1):
Replace AbsPath judgement method with g_path_is_absolute()
src/conf/backup_conf.c | 2 +-
src/conf/snapshot_conf.c | 2 +-
src/conf/storage_source_conf.c | 2 +-
src/lxc/lxc_native.c | 2 +-
src/qemu/qemu_block.c | 2 +-
src/storage_file/storage_source.c | 2 +-
src/util/vircommand.c | 2 +-
src/vbox/vbox_snapshot_conf.c | 2 +-
src/vmware/vmware_conf.c | 2 +-
src/vmware/vmware_driver.c | 2 +-
tests/virtestmock.c | 2 +-
tools/virt-login-shell-helper.c | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
--
2.31.1
3 years, 6 months
[libvirt PATCH v2 1/3] nodedev: fix potential leak of command
by Jonathon Jongsma
When returning early due to errors, cmd will be leaked. Use an autoptr
to handle these early returns without leaking memory.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/node_device/node_device_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index b0cc63ed42..e565cc29ec 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -724,7 +724,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
char **errbuf)
{
g_autofree char *parent_addr = NULL;
- virCommand *cmd = NULL;
+ g_autoptr(virCommand) cmd = NULL;
const char *subcommand = virMdevctlCommandTypeToString(cmd_type);
g_autofree char *inbuf = NULL;
@@ -787,7 +787,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
virCommandSetErrorBuffer(cmd, errbuf);
- return cmd;
+ return g_steal_pointer(&cmd);
}
--
2.26.3
3 years, 6 months
[PATCH 00/10] qemu: Fix block job cancelling
by Peter Krempa
Since -blockdev support was introduced qemuDomainBlockJobAbort was using
the wrong API to terminate the blockjob since we care about sync
finishing semantics.
Additionally for cases where we don't care we can force-finish the jobs
such as when cancelling an migration with NBD disk copy.
Peter Krempa (10):
qemumonitorjsontest: Add test for 'qemuMonitorJSONBlockJobCancel'
qemuMonitorJSONBlockJobCancel: Refactor cleanup
qemu: monitor: Add 'force' argument for 'block-job-cancel' QMP command
qemuDomainBlockJobAbort: Don't use 'job-cancel' instead of
'block-job-cancel'
qemuBackupJobCancelBlockjobs: Replace qemuMonitorJobCancel by
qemuMonitorBlockJobCancel
qemuBlockJobRefreshJobs: Replace qemuMonitorJobCancel by
qemuMonitorBlockJobCancel
qemuMigrationSrcNBDCopyCancel*: Rename 'check' to 'abortMigration'
qemuMigrationSrcNBDCopyCancelOne: Force-cancel disk copy jobs when
aborting migration
qemuMigrationSrcNBDCopyCancelled: Use do-while loop instead of jumping
back
qemu: monitor: Remove qemuMonitorJobCancel
src/qemu/qemu_backup.c | 2 +-
src/qemu/qemu_blockjob.c | 2 +-
src/qemu/qemu_driver.c | 7 +--
src/qemu/qemu_migration.c | 106 ++++++++++++++++++-----------------
src/qemu/qemu_monitor.c | 20 ++-----
src/qemu/qemu_monitor.h | 8 +--
src/qemu/qemu_monitor_json.c | 48 +++-------------
src/qemu/qemu_monitor_json.h | 8 +--
tests/qemumonitorjsontest.c | 4 +-
9 files changed, 75 insertions(+), 130 deletions(-)
--
2.30.2
3 years, 6 months
[libvirt PATCH v2] storage_backend_fs: use MKFS ony if WITH_STORAGE_FS is defined
by Pavel Hrdina
The code in storage_backend_fs is used for storage_dir and storage_fs
drivers so some parts need to be guarded by checking for
WITH_STORAGE_FS.
Fixes: 16c69e7aaed4cabfd8e8c19cc326854d4c480437
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
GitLab CI faild on MacOS and FreeBSD where storage_fs is disabled.
Changes in v2:
- guard only virFindFileInPath instead of the whole function
src/storage/storage_backend_fs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index af645ea9de..be3c3c6839 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -402,7 +402,11 @@ virStorageBackendExecuteMKFS(const char *device,
const char *format)
{
g_autoptr(virCommand) cmd = NULL;
- g_autofree char *mkfs = virFindFileInPath(MKFS);
+ g_autofree char *mkfs = NULL;
+
+#if WITH_STORAGE_FS
+ mkfs = virFindFileInPath(MKFS);
+#endif /* WITH_STORAGE_FS */
if (!mkfs) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -412,7 +416,7 @@ virStorageBackendExecuteMKFS(const char *device,
return -1;
}
- cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
+ cmd = virCommandNewArgList(mkfs, "-t", format, NULL);
/* use the force, otherwise mkfs.xfs won't overwrite existing fs.
* Similarly mkfs.ext2, mkfs.ext3, and mkfs.ext4 require supplying -F
--
2.30.2
3 years, 6 months
[libvirt PATCH] storage_backend_fs: use MKFS ony if WITH_STORAGE_FS is defined
by Pavel Hrdina
The code in storage_backend_fs is used for storage_dir and storage_fs
drivers so some parts need to be guarded by checking for
WITH_STORAGE_FS.
Fixes: 16c69e7aaed4cabfd8e8c19cc326854d4c480437
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
GitLab CI faild on MacOS and FreeBSD where storage_fs is disabled.
src/storage/storage_backend_fs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index af645ea9de..e6a348521d 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -401,6 +401,7 @@ static int
virStorageBackendExecuteMKFS(const char *device,
const char *format)
{
+#if WITH_STORAGE_FS
g_autoptr(virCommand) cmd = NULL;
g_autofree char *mkfs = virFindFileInPath(MKFS);
@@ -431,6 +432,7 @@ virStorageBackendExecuteMKFS(const char *device,
if (virCommandRun(cmd, NULL) < 0)
return -1;
+#endif /* WITH_STORAGE_FS */
return 0;
}
--
2.30.2
3 years, 6 months
[libvirt PATCH 00/10] Refactor more XML parsing boilerplate code, part II
by Tim Wiederhake
For background, see
https://listman.redhat.com/archives/libvir-list/2021-April/msg00668.html
Tim Wiederhake (10):
virDomainVirtioOptionsParseXML: Use virXMLProp*
virDomainDeviceBootParseXML: Use virXMLProp*
virDomainDeviceISAAddressParseXML: Use virXMLProp*
virDomainDiskSourceNVMeParse: Use virXMLProp*
virDomainChrSourceDefParseFile: Use virXMLProp*
virDomainChrSourceDefParseLog: Use virXMLProp*
virDomainAudioJackParse: Use virXMLProp*
virDomainVideoResolutionDefParseXML: Use virXMLProp*
virDomainVsockDefParseXML: Use virXMLProp*
virDomainLoaderDefParseXML: Use virXMLProp*
src/conf/domain_conf.c | 246 +++++++++--------------------------------
1 file changed, 52 insertions(+), 194 deletions(-)
--
2.26.3
3 years, 6 months
[PATCH 00/21] Refactoring conf to use XPath
by Kristina Hanicova
This series reworks the outdated way of parsing XML to parsing by XPath,
which is more obvious and saves a few lines of code.
Kristina Hanicova (21):
conf: Propagate xmlXPathContextPtr into
virDomainHostdevSubsysUSBDefParseXML()
Refactoring virDomainHostdevSubsysUSBDefParseXML() to use XPath
conf: Propagate xmlXPathContextPtr into virDomainBlkioDeviceParseXML()
Refactoring virDomainBlkioDeviceParseXML() to use XPath
conf: Propagate xmlXPathContextPtr into
virDomainHostdevSubsysPCIDefParseXML()
Refactoring virDomainHostdevSubsysPCIDefParseXML() to use XPath
conf: Propagate xmlXPathContextPtr into virDomainLeaseDefParseXML()
Refactoring virDomainLeaseDefParseXML() to use XPath
Refactoring virDomainDiskDefParseXML() to use XPath
Refactoring virDomainControllerDefParseXML() to use XPath
Refactoring virDomainFSDefParseXML() to use XPath
Refactoring virDomainNetDefParseXML() to use XPath
conf: Propagate xmlXPathContextPtr into
virDomainChrDefParseTargetXML()
Refactoring virDomainChrDefParseTargetXML() to use XPath
Refactoring virDomainChrSourceDefParseXML() to use XPath
Refactoring virDomainChrDefParseXML() to use XPath
Refactoring virDomainSmartcardDefParseXML() to use XPath
Refactoring virDomainGraphicsDefParseXMLSpice() to use XPath
conf: Propagate xmlXPathContextPtr into
virDomainVideoDriverDefParseXML()
Refactoring virDomainVideoDriverDefParseXML() to use XPath
Refactoring virDomainVideoDefParseXML() to use XPath
src/conf/domain_conf.c | 1786 +++++++++++++++++-----------------------
1 file changed, 777 insertions(+), 1009 deletions(-)
--
2.30.2
3 years, 6 months