History | View | Annotate | Download (58.6 kB)
w64: Fix time conversion for some versions of MinGW-w64
tb.time is a time value, but not necessarily of the same size as time_t:while time_t is 64 bit for w64, tb.time still is 32 bit only.
Therefore we need en explicit conversion.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Merge remote-tracking branch 'sstabellini/saverestore-8' into staging
Introduce "xen-save-devices-state"
- add an "is_ram" flag to SaveStateEntry;
- register_savevm_live sets is_ram for live_savevm devices;
- introduce a "xen-save-devices-state" QAPI command that can be used to savethe state of all devices, but not the RAM or the block devices of the...
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
vmstate: fix varrays with uint32_t indexes
VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checkedVMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(),but we don't check this bit in vmstate_save_state().
Signed-off-by: Amos Kong <akong@redhat.com>...
Purge migration of (almost) everything to do with monitors
The Monitor object is passed back and forth within the migration/savevmcode so that it can print errors and progress to the user.
However, that approach assumes a HMP monitor, being completely invalid...
qapi: Convert migrate
The migrate command is one of those commands where HMP and QMP completelymix up together. This made the conversion to the QAPI (which separates thecommand into QMP and HMP parts) a bit difficult.
The first important change to be noticed is that this commit completes the...
Fix vmstate_register_ram() for rom/device regions
rom/device regions have a ram_addr that is composed of both an I/O handler(low bits) and RAM region (high bits); but qemu_ram_set_idstr() expects justa RAM region. Mask the I/O handler to make it happy....
vmstate, memory: decouple vmstate from memory API
Currently creating a memory region automatically registers it forlive migration. This differs from other state (which is enumeratedin a VMStateDescription structure) and ties the live migration codeinto the memory core....
qcow2: Allow >4 GB VM state
This is a compatible extension to the snapshot header format that allowssaving a 64 bit VM state size.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
stdio_fclose: return -errno on errors (v2)
This is what qemu_fclose() expects.
Changes v1 -> v2: - Add braces to if statement to match coding style
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
savevm: use qemu_file_set_error() instead of setting last_error directly
Some code uses qemu_file_set_error() already, so use it everywherewhen setting last_error, for consistency.
qemu_fclose: return last_error if set (v3)
This will make sure no error will be missed as long as callers alwayscheck for qemu_fclose() return value. For reference, this is thecomplete list of qemu_fclose() callers:
- exec_close(): already fixed to check for negative values, not -1...
stdio_pclose: return -errno on error (v3)
Changes v1 -> v2: - On success, keep returning pclose() return value, instead of always 0.
Changes v2 -> v3: - Add braces on if statements to match coding style
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>...
Merge remote-tracking branch 'kwolf/for-anthony' into staging
block: convert qemu_aio_flush() calls to bdrv_drain_all()
Many places in QEMU call qemu_aio_flush() to complete all pendingasynchronous I/O. Most of these places actually want to drain all blockrequests but there is no block layer API to do so.
This patch introduces the bdrv_drain_all() API to wait for requests...
fix spelling in main directory
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
ivshmem: use migration blockers to prevent live migration in peer mode (v2)
Now when you try to migrate with ivshmem, you get a proper QMP error:
(qemu) migrate tcp:localhost:1025Migration is disabled when using feature 'peer mode' in device 'ivshmem'(qemu)...
savevm: qemu_fille_buffer() used to return one error for reads of size 0.
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-timer: move more stuff out of qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Merge remote-tracking branch 'quintela/migration-pull' into staging
migration: change has_error to contain errno values
We normally already have an errno value. When not, abuse EIO.
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: return real error code
make functions propagate errno, instead of just using -EIO. Add acomment about what are the return value of qemu_savevm_state_iterate().
migration: rename qemu_file_has_error to qemu_file_get_error
Now the function returned errno, so it is better the new name.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
savevm: Rename has_error to last_error field
Now the field contains the last error name, so rename acordingly.
migration: use qemu_file_get_error() return value when possible
migration: make *save_live return errors
Make *save_live() return negative values when there is one error, andupdates all callers to check for the error.
savevm: teach qemu_fill_buffer to do partial refills
We will need on next patch to be able to lookahead on next patch
v2: rename "used" to "pending" (Alex Williams)
Signed-off-by: Juan Quintela<quintela@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
savevm: some coding style cleanups
This patch will make moving code on next patches and having checkpatchhappy easier.
savevm: define qemu_get_byte() using qemu_peek_byte()
Signed-off-by: Juan Quintela<quintela@redhat.com>
savevm: improve subsections detection on load
We add qemu_peek_buffer, that is identical to qemu_get_buffer, justthat it don't update f->buf_index.
We add a paramenter to qemu_peek_byte() to be able to peek more thanone byte.
Once this is done, to see if we have a subsection we look:...
Revert "savevm: fix corruption in vmstate_subsection_load()."
This reverts commit eb60260de0b050a5e8ab725e84d377d0b44c43ae.
Conflicts:
savevm.c
We changed qemu_peek_byte() prototype, just fixed the rejects.
Signed-off-by: Juan Quintela<quintela@redhat.com>...
savevm: qemu_savevm_state(): Drop stop VM logic
qemu_savevm_state() has some logic to stop the VM and to (or not to)resume it. But this seems to be a big noop, as qemu_savevm_state()is only called by do_savevm() when the VM is already stopped.
So, let's drop qemu_savevm_state()'s stop VM logic....
RunState: Rename enum values as generated by the QAPI
Next commit will convert the query-status command to use theRunState type as generated by the QAPI.
In order to "transparently" replace the current enum by the QAPIone, we have to make some changes to some enum values....
Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),we pass a VMSTOP macro as the 'reason' argument. This is not idealbecause the VMSTOP macros tell why qemu stopped and not exactlywhat the current VM state is....
Drop the vm_running global variable
Use runstate_is_running() instead, which is introduced by this commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
savevm: Include writable devices with removable media
savevm and loadvm silently ignore block devices with removable media,such as floppies and SD cards. Rolling back a VM to a previouscheckpoint will not roll back writes to block devices with removable...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote-tracking branch 'kraxel/migration.2' into staging
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
vmstate: add no_migrate flag to VMStateDescription
This allows to easily tag devices as non-migratable,so any attempt to migrate a virtual machine with thedevice in question active will make migration fail.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reset system before loadvm
In case we load the vmstate during incoming migration, we start from aclean, default machine state as we went through system reset before. Butif we load from a snapshot, the machine can be in any state. That cancause troubles if loading an older image which does not carry all state...
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fix some typos in comments and documentation
helpfull -> helpfulusefull -> usefulcotrol -> control
and a grammar fix.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Move CPU related functions to cpus.h
Move declarations of CPU related functions to cpus.h. Adjust the only user.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix migration uint8 arrys handled
commit 82fa39b75181b730d6d4d09f443bd26bcfcd045c
only contains half of the fix. It forgots the save state fix forUINT8 indexes.
Anthony, please apply, without this migration using hpet is broken.(only current user)....
Merge branch 'for-anthony' of git://github.com/bonzini/qemu
change all rt_clock references to use millisecond resolution accessors
This was done with:
sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \ $(git grep -l 'get_clock\>.*rt_clock' ) sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \...
change all other clock references to use nanosecond resolution accessors
sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' )...
Add error message for loading snapshot without VM state
It already fails, but it didn't tell the user why.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>
vmstate: Fix varrays with uint8 indexes
vmstate: add UINT32 VARRAYS
vmstate: add VMSTATE_UINT32_EQUAL
Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actuallyhave nothing to do with the EXCP_* defines used so far. At this chance,specify more detailed reasons so that VM state change handlers canevaluate them....
savevm: fix corruption in vmstate_subsection_load().
Although it's rare to happen in live migration, when the head of abyte stream contains 0x05 which is the marker of subsection, theloader gets corrupted because vmstate_subsection_load() continues even...
blockdev: Fix regression in -drive if=scsi,index=N
Before commit 622b520f, index=12 meant bus=1,unit=5.
Since the commit, it means bus=0,unit=12. The drive is created, butnot the guest device. That's because the controllers we use withif=scsi drives (lsi53c895a and esp) support only 7 units, and...
savevm: Fix no_migrate
The no_migrate save state flag is currently only checked in thelast phase of migration. This means that we potentially wastea lot of time and bandwidth with the live state handlers beforewe ever check the no_migrate flags. The error message printed...
migration/savevm: no need to flush requests
There's no need to flush requests after vmstopas vmstop does it for us automatically now.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Tested-by: Jason Wang <jasowang@redhat.com>
migration: allow rate > 4g
I'd like to disable bandwidth limit or make it very high,Use int64_t all over to make values >= 4g work.
add VMSTATE_BOOL
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: malc <av1474@comtv.ru>
Delete write only variables
Compiling with GCC 4.6.0 20100925 produced warnings like:/src/qemu/net/tap-win32.c: In function 'tap_win32_open':/src/qemu/net/tap-win32.c:582:12: error: variable 'hThread' set but not used [-Werror=unused-but-set-variable]...
Fix OpenBSD build warning
Fix this warning: CC savevm.o/src/qemu/savevm.c: In function `do_savevm':/src/qemu/savevm.c:1900: warning: passing arg 1 of `localtime_r' from incompatible pointer type
It looks like on OpenBSD the type of tv_sec in struct timeval is still...
monitor: make 'info snapshots' show only fully available snapshots
The output generated by 'info snapshots' shows only snapshots that exist on theblock device that saves the VM state. This output can cause an user toerroneously try to load an snapshot that is not available on all block devices....
savevm: Generate a name when run without one
When savevm is run without a name, the name stays blank and the snapshot issaved anyway.
The new behavior is when savevm is run without parameters a name will becreated automaticaly, so the snapshot is accessible to the user without needing...
Support marking a device as non-migratable
A non-migratable device should be removed before migration and re-added after.
Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
loadvm: improve tests before bdrv_snapshot_goto()
This patch improves the resilience of the load_vmstate() function, doingfurther and better ordered tests.
In load_vmstate(), if there is any error on bdrv_snapshot_goto(), except if theerror is on VM state device, load_vmstate() will return zero and the VM will be...
savevm: Fix memory leak of compat struct
Forgot to check for and free these.
Found-by: Zachary Amsden <zamsden@redhat.com>Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vmstate: add subsections code
This commit adds subsections for each device section.Subsections is the way to handle information that don't need to be sentto de destination of a migration because its values are not needed. It isthe way to handle optional information. Notice that only the source can...
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
savevm: Make use of DeviceState
For callers that pass a device we can traverse up the qdev tree andmake use of the BusInfo.get_dev_path information for creating uniquesavevm id strings. This avoids needing to rely on the instance number,which can cause problems with device initialization order and hotplug....
savevm: Survive hot-unplug of snapshot device
savevm.c keeps a pointer to the snapshot block device. If you manageto get that device deleted, the pointer dangles, and the next snapshotoperation will crash & burn. Unplugging a guest device that uses it...
block: Decouple savevm from DriveInfo
We find snapshots by iterating over the list of drives defined withdrive_init(). This misses host block devices defined by other means.Such means don't exist now, but will be introduced later in thisseries.
Iterate over all host block devices instead, with bdrv_next()....
savevm: Really verify if a drive supports snapshots
Both bdrv_can_snapshot() and bdrv_has_snapshot() does not work as advertized.
First issue: Their names implies different porpouses, but they do the same thingand have exactly the same code. Maybe copied and pasted and forgotten?...
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
migration: respect exit status with exec:
This patch makes sure that if the exec: process exits with a non-zero returnstatus, we treat the migration as failed.
This fixes https://bugs.launchpad.net/qemu/+bug/391879
vmstate: Add support for alias ID
Some legacy users (mostly PC devices) of vmstate_register manageinstance IDs on their own, and that unfortunately in a way that isincompatible with automatically generated ones. This so far preventsswitching those users to vmstates that are registered by qdev....
vmstate: Drop unused post_save handler
No device makes use of it anymore.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix the RARP protocol ID
The packet(s) sent out after migration are supposed to be RAPR type ofpackets. If they are supposed to go anywhere useful, the RAPR ethernetidentifier needs to be fix.
Also see http://www.iana.org/assignments/ethernet-numbers for 0x8035 for...
Merge remote branch 'markus/qerror' into staging
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
savevm: Fix -loadvm to report errors to stderr, not the monitor
A monitor may not even exist.
Change load_vmstate() to use qemu_error() instead of monitor_printf().Parameter mon is now unused, remove it.
Fix a typo in error message
KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load relatedsynchronization points in favor of four(!) generic hooks:
- cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave)...
fix savevm command without id or tag
savevm without id or tag segfaults in:
(gdb) bt#0 0x00007f600a83bf8a in __strcmp_sse42 () from /lib64/libc.so.6#1 0x00000000004745b6 in bdrv_snapshot_find (bs=<value optimized out>, sn_info=0x7fff996be280, name=0x0) at savevm.c:1631...
savevm.c: fix warning with _FORTIFY_SOURCE
CC savevm.occ1: warnings being treated as errorssavevm.c: In function 'file_put_buffer':savevm.c:342: error: ignoring return value of 'fwrite', declared with attribute warn_unused_resultmake: *** [savevm.o] Error 1...
live migration: Serialize vmstate saving in stage 2
The effect of this patch with current block migration is that its stage2, ie. the first full walk-through of the block devices will beperformed completely before RAM migration starts. This ensures that...
live migration: Allow cleanup after cancellation or error
Introduce qemu_savevm_state_cancel and inject a stage -1 to cancel alive migration. This gives the involved subsystems a chance to clean updynamically allocated resources. Namely, the block migration layer can...
live migration: Propagate output monitor to callback handler
In order to allow proper progress reporting to the monitor thatinitiated the migration, forward the monitor reference through themigration layer down to SaveLiveStateHandler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
vmstate: Add support for VBUFFERS
Support for buffer that are pointed by a pointer (i.e. not embedded)where the size that we want to use is a field in the state.We also need a new place to store where to start in the middle of thebuffer, as now it is a pointer, not the offset of the 1st field....
vmstate: Add support for multiplying size for a constant
When the size that we want to transmit is in another field, but in anunit different that bytes
vmstate: Avoid seeking
Seeking on vmstate save/load does not work if the underlying file is astream. We could try to make all QEMUFile* forward-seek-aware, but firstattempts in this direction indicated that it's saner to convert the fewqemu_fseek-on-vmstates users to plain reads/writes....
vmstate: fix missing ARRAY_OF_POINTERS support on save state
net: fix qemu_announce_self()
Now that we have a way to iterate NICs.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add support for GNU/kFreeBSD
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Block live migration
This patch introduces block migration called during live migration. Blockare being copied to the destination in an async way. First the code willtransfer the whole disk and then transfer all dirty blocks accumulted duringthe migration....
Fix incoming migration
commit b04c4134d6de28c249277de19e523bfbe4aebbd6broke incoming migration. After talking with Gleb, code was intendedto be the way is in this fix. This fixes migration here.
savevm: Delete existing snapshots in all images
When creating a snapshot we can run into the situation that the first diskdoesn't have a snapshot, but the second one does have one with the same name asthe new snapshot.
In this case, qemu doesn't recognize that there is a snapshot to be...
net: use qemu_send_packet_raw() in qemu_announce_self()
Use qemu_send_packet_raw to send gratuitous arp. This will ensure thatvnet header is handled properly.
Also, avoid sending the gratuitous packet to the guest. There doesn'tappear to be any reason for doing that and the code will currently just...
net: remove unused includes of if_tun.h and if_tap.h
Looks like these are just artifacts of vl.c being split up.
vmstate: Add VMSTATE_BUFFER_UNUSED
It allows to have 'things' in savevm format not backed in the device stateSigned-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>