qmp: Add QMP query-named-block-nodes to list the named BlockDriverState nodes.
Signed-off-by: Benoit Canet <benoit@irqsave.net>Reviewed-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Allow the user to define "node-name" option both on command line and QMP.
Signed-off-by: Benoit Canet <benoit@irqsave.net>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qapi: Add "backing" to BlockStats
Currently there is no way to query BlockStats of the backing chain. Thisadds "backing" field into BlockStats to make it possible.
The comment of "parent" is reworded.
Signed-off-by: Fam Zheng <famz@redhat.com>Reviewed-by: Benoit Canet <benoit@irqsave.net>...
block: Add bs->node_name to hold the name of a bs node of the bs graph.
Add the minimum of code to prepare for the following patches.
qcow2: fix wrong value of L1E_OFFSET_MASK, L2E_OFFSET_MASK and REFT_OFFSET_MASK
Accoring to qcow spec, the offset fields in l1e, l2e and ref table entrystart at bit 9. The offset is cluster offset, and the smallest possiblecluster size is 512 bytes.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>...
vmdk: Check for overhead when opening
Report an error if file size is even smaller than metadata.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-progress: Drop unused include
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Benoit Canet <benoit@irqsave.net>
qemu-progress: Fix progress printing on SIGUSR1
Since commit a7aae221 ('Switch SIG_IPI to SIGUSR1'), SIGUSR1 is blockedduring startup, breaking the progress report in tools.
This patch reenables the signal when initialising a progress report.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
Documentation: qemu-img: Mention SIGUSR1 progress report
Document the SIGUSR1 behaviour of qemu-img. Also, added compare to thelist of subcommands that support -p.
sheepdog: fix 'qemu-img map'
It was muted in the previous commit 4bc74be9. Let's revive it since nothingprevents us to do it.
With this patch, following command will work as other formats:
$ qemu-img map sheepdog:image
Cc: qemu-devel@nongnu.orgCc: Kevin Wolf <kwolf@redhat.com>...
drive mirror:fix memory leak
In the function mirror_iteration() > qemu_iovec_init(),it allocates memory for op>qiov.iov, when the write request calls back,but in the function mirror_iteration_done(), it only frees the op,not free the op->qiov.iov, so this causes memory leak....
vmdk: Fix format specific information (create type) for streamOptimized
Previously the field is wrong:
$ ./qemu-img create -f vmdk -o subformat=streamOptimized /tmp/a.vmdk 1G
$ ./qemu-img info /tmp/a.vmdk image: /tmp/a.vmdk file format: vmdk...
dataplane: fix shadowed return value
Propagate the error return value from get_indirect(). This bug wasintroduced in commit 4d684832 ("vring: create a common function to parsedescriptors").
Reviewed-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
block: fix backing file segfault
When a backing file is opened such that (1) a protocol is directlyused as the block driver and (2) the block driver has bdrv_file_open,bdrv_open_backing_file segfaults. The problem arises becausebdrv_open_common returns without setting bd->backing_hd->file....
block: Add bdrv_open_image()
Add a common function for opening images to be used for block driversspecified through BlockdevRefs in an option QDict. The difference frombdrv_file_open() is that this function may invoke bdrv_open() instead,allowing auto-detection of the driver to be used; and second, it...
block: Use bdrv_open_image() in bdrv_open()
Using bdrv_open_image() instead of bdrv_file_open() directly inbdrv_open() is easier.
Signed-off-by: Max Reitz <mreitz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Allow recursive "file"s
It should be possible to use a format as a driver for a file which inturn requires another file, i.e., nesting file formats.
Allowing nested file formats results in e.g. qcow2 BlockDriverStatesnever being directly passed to bdrv_open_common() from bdrv_file_open(),...
blockdev: Move "file" to legacy_opts
Specifying the image filename through the "file" option is a legacyoption and should not be supported by blockdev-add (in that case, givinga string for "file" references an existing block device).
Signed-off-by: Max Reitz <mreitz@redhat.com>...
blkdebug: Allow command-line file configuration
Introduce the "image" option as an alternative to specifying the imagethrough the filename.
blkverify: Allow command-line configuration
Introduce the "test" and "raw" options for specifying images.
blkverify: Don't require protocol filename
If the filename is not prefixed by "blkverify:" inblkverify_parse_filename(), the blkverify driver was not selectedthrough that protocol prefix, but by an explicit command line (or QMP)option (like driver=blkverify)....
qapi: Add "errno" to the list of polluted words
Using "errno" directly as an identifier results in various syntaxerrors; therefore it should be added to the list of polluted words.
qapi: QMP interface for blkdebug and blkverify
Add structures to support blkdebug and blkverify in blockdev-add.
qemu-io: Make filename optional
Giving a filename is actually not essential, since it can be specifiedthrough the options as well - on the contrary: Sometimes a filename mustnot be given.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
tests: Add test for qdict_array_split()
Add a test case for qdict_array_split() in tests/check-qdict.c.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests: Add test for qdict_flatten()
Add a test case for qdict_flatten() in tests/check-qdict.c. This testcase covers the flattening of subordinate QLists as well.
iotests: Test new blkdebug/blkverify interface
Add a test for the new blkdebug/blkverify interface.
This test is not written in Python, although it uses QMP. This isbecause it invokes the qemu-io HMP command, which outputs errors tostderr instead of returning them through QMP. Filtering and testing that...
iotests: Test file format nesting
Add a test for nested image formats.
readline: decouple readline from the monitor
Make the readline.c functionality reusable. Instead of callingmonitor_printf() and monitor_flush() directly, invoke function pointersprovided by the user.
This way readline.c does not know about Monitor and other users will be...
readline: move readline to a generic location
Now that the monitor and readline are decoupled, readline.h no longerbelongs in include/monitor/. Put the header into include/qemu/.
Move the source file into util/ so it can be linked as part oflibqemuutil.a....
osdep: add qemu_set_tty_echo()
Using stdin with readline.c requires disabling echo and line buffering.Add a portable wrapper to set the terminal attributes under Linux andWindows.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-io: use readline.c
Use readline.c for command-line history. There was support for GNUReadline and BSD Editline but it was never compiled in. Since QEMU hasits own readline.c, just use that when qemu-io runs with stdin attachedto a terminal.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-io: add command completion
Autocomplete qemu-io commands at the interactive prompt.
Note this only completes command names and not their options.
blkdebug: Use errp for read_config()
Use an Error variable in the read_config() function.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blkdebug: Don't require sophisticated filename
If the filename is not prefixed by "blkdebug:" inblkdebug_parse_filename(), the blkdebug driver was not selected throughthat protocol prefix, but by an explicit command line option(file.driver=blkdebug or something similar). Contrary to the current...
qdict: Add qdict_array_split()
This function splits a QDict consisting of entries prefixed byincrementally enumerated indices into a QList of QDicts.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
qapi: extend qdict_flatten() for QLists
Reversing qdict_array_split(), qdict_flatten() should flatten QLists aswell by interpreting them as QDicts where every entry's key is itsindex.
This allows bringing QDicts with QLists from QMP commands to the same...
qemu-option: Add qemu_config_parse_qdict()
This function basically parses command-line options given as a QDictreplacing a config file.
For instance, the QDict {"section.opt1": 42, "section.opt2": 23}corresponds to the config file:
[section]opt1 = 42...
blkdebug: Always call read_config()
Move the check whether there actually is a config file into theread_config() function.
blkdebug: Use command-line in read_config()
Use qemu_config_parse_qdict() to parse the command-line options inaddition to the config file.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Allow reference for bdrv_file_open()
Allow specifying a reference to an existing block device (by name) forbdrv_file_open() instead of a filename and/or options.
block: Pass reference to bdrv_file_open()
With that now being possible, bdrv_open() should try to extract a blockdevice reference from the options and pass it to bdrv_file_open().
block: Allow block devices without files
blkdebug and blkverify will, in order to retain compatibility, notsupport the field "file" implicitly through bdrv_open(). In order to beable to use those drivers without giving a filename anyway, it isnecessary to be able to have block devices without files implicitly...
rbd: switch from pipe to QEMUBH completion notification
rbd callbacks are called from non-QEMU threads. Up until now a pipe wasused to signal completion back to the QEMU iothread.
The pipe writer code handles EAGAIN using select(2). The select(2) API...
qemu-iotests: Introduce _unsupported_imgopts
Introduce _unsupported_imgopts that causes _notrun for specific imageoptions.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Add _unsupported_imgopts for vmdk subformats
Some cases are not applicable for vmdk subformats those don't supportcertain features, e.g. backing file, and some others can't run onmult-file image, e.g. monolithicFlat. This adds declaration in test...
qemu-iotests: Clean up all extents for vmdk
This modifies _cleanup_test_img to remove all the extent files listed by"qemu-img info"'s format specific information.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
block/iscsi: return -ENOMEM if an async call fails immediately
if an async libiscsi call fails directly it can only be dueto an out of memory condition. All other errors are returnedthrough the callback.
Signed-off-by: Peter Lieven <pl@kamp.de>Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>...
gluster: Convert aio routines into coroutines
Convert the read, write, flush and discard implementations from aio-basedones to coroutine based ones.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
gluster: Implement .bdrv_co_write_zeroes for gluster
Support .bdrv_co_write_zeroes() from gluster driver by using GlusterFS APIglfs_zerofill() that off-loads the writing of zeroes to GlusterFS server.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>...
gluster: Add support for creating zero-filled image
GlusterFS supports creation of zero-filled file on GlusterFS volumeby means of an API called glfs_zerofill(). Use this API from QEMU tocreate an image that is filled with zeroes by using the preallocation...
sheepdog: fix clone operation by 'qemu-img create -b'
We should pass base_inode->vdi_id to base_vdi_id of SheepdogVdiReq so that sheepcan create a clone instead a fresh volume.
This fixes following command:
qemu-create -b sheepdog:base sheepdog:clone...
qtest: Fix the bug about disable vnc causes "make check" fail
When we disable vnc from "./configure", QEMU can't use the vnc option.So qtest can't use the "vnc -none ", otherwise "make check" fails.If QEMU uses "-display none", "-vnc none" is excrescent, So we just need to drop it....
docs: qcow2 compat=1.1 is now the default
Commit 9117b47717ad208b12786ce88eacb013f9b3dd1c ("qcow2: Change defaultfor new images to compat=1.1") changed the default qcow2 image formatversion but forgot to update qemu-doc.texi and qemu-img.texi.
vmdk: Fix big flat extent IO
Local variable "n" as int64_t avoids overflow with large sector numbercalculation. See test case change for failure case.
Revert "error: Don't use error_report() for assertion msgs."
This reverts commit d32934c84c72f57e78d430c22974677b7bcabe5d.
The original implementation before this patch makes abortive errormessages much more friendly. The underlying bug that required this...
tests: Add libqemustub to qom-interface-check
The recent addition of util/error.c's dependency on error_report()causes this test to fail to link due to a number of missing monitorrelated symbols. All these symbols are however defined by libqemustub.Add this libary to the link....
SPARC: Fix LEON3 power down instruction
Synchronize the program counter before the power down helper callotherwise interrupts will return to the wrong context.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>Reviewed-by: Richard Henderson <rth@twiddle.net>...
error: Don't use error_report() for assertion msgs.
Use fprintf(stderr instead. This removes dependency of libqemuutil.aon the monitor.
We can further justify this change, in that this code path should onlytrigger under a fatal error condition. fprintf-stderr is probably the...
Merge remote branch 'luiz/queue/qmp' into qmpq
Microblaze: Convert Microblaze-pic handling to GPIOs
This patch uses inbound GPIO lines (IRQ and FIR) forinterrupts instead of using the old pic_cpu method,which doesn't correspond to real hardware.
This creates the CPU's inbound IRQ and FIR GPIO lines and...
target-arm: Switch ARMCPUInfo arrays to use terminator entries
Switch the ARMCPUInfo arrays in cpu.c and cpu64.c to use a terminatorentry rather than looping based on ARRAY_SIZE. The latter causescompile warnings on some versions of gcc if the configure options...
Merge remote-tracking branch 'quintela/tags/migration/20140113' into staging
migration.next for 20140113
kvm: use directly cpu_physical_memory_* api for tracking dirty pages
Performance is important in this function, and we want to optimize even further.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
kvm: refactor start address calculation
memory: move bitmap synchronization to its own function
We want to have all the functions that handle directly the dirtybitmap near. We will change it later.
memory: syncronize kvm bitmap using bitmaps operations
If bitmaps are aligned properly, use bitmap operations. If they arenot, just use old bit at a time code.
ram: split function that synchronizes a range
This function is the only bit where we care about speed.
migration: synchronize memory bitmap 64bits at a time
We use the old code if the bitmaps are not aligned
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Document it
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
memory: use bit 2 for migration
For historical reasons it was bit 3. Once there, create a constant toknow the number of clients.
memory: make sure that client is always inside range
memory: only resize dirty bitmap when memory size increases
memory: cpu_physical_memory_clear_dirty_flag() result is never used
bitmap: Add bitmap_zero_extend operation
memory: split dirty bitmap into three
After all the previous patches, spliting the bitmap gets direct.
Note: For some reason, I have to move DIRTY_MEMORY_* definitions tothe beginning of memory.h to make compilation work.
Signed-off-by: Juan Quintela <quintela@redhat.com>...
memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
memory: unfold cpu_physical_memory_set_dirty() in its only user
memory: unfold cpu_physical_memory_set_dirty_flag()
memory: make cpu_physical_memory_get_dirty() the main function
And make cpu_physical_memory_get_dirty_flag() to use it. It used tobe the other way around.
memory: cpu_physical_memory_get_dirty() is used as returning a bool
memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
Now all functions use the same wording that bitops/bitmap operations
memory: use find_next_bit() to find dirty bits
This operation is way faster than doing it bit by bit.
memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
We were setting a range of bits, so use bitmap_set().
Note: xen has always been wrong, and should have used start insteadof addr from the beginning.
memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
We were clearing a range of bits, so use bitmap_clear().
memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
All uses except one really want the other meaning.
memory: make cpu_physical_memory_reset_dirty() take a length parameter
We have an end parameter in all the callers, and this make it coherentwith the rest of cpu_physical_memory_* functions, that also take alength parameter.
Once here, move the start/end calculation to...
memory: cpu_physical_memory_set_dirty_tracking() should return void
Result was always 0, and not used anywhere. Once there, use bool typefor the parameter.
memory: split cpu_physical_memory_* functions to its own include
All the functions that use ram_addr_t should be here.
memory: unfold memory_region_test_and_clear()
We are going to update the bitmap directly
bitmap: use long as index
Move index and size fields from int to long. We need that formigration. long is 64 bits on sane architectures, and 32bits shouldbe enough on all the 32bits architectures.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
memory: cpu_physical_memory_set_dirty_flags() result is never used
So return void.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
memory: cpu_physical_memory_set_dirty_range() return void
exec: use accessor function to know if memory is dirty
memory: create function to set a single dirty bit
exec: create function to get a single dirty bit
memory: make cpu_physical_memory_is_dirty return bool
memory: all users of cpu_physical_memory_get_dirty used only one flag
So cpu_physical_memory_get_dirty_flags is not needed anymore
memory: set single dirty flags when possible
memory: cpu_physical_memory_set_dirty_range() always dirty all flags
So remove the flag argument and do it directly. After this change,there is nothing else using cpu_physical_memory_set_dirty_flags() soremove it.