aboutsummaryrefslogtreecommitdiffstats
path: root/savevm.c
diff options
context:
space:
mode:
authorOt ten Thije <ottenthije@google.com>2010-09-30 14:17:10 +0100
committerOt ten Thije <ottenthije@google.com>2010-10-21 11:16:06 +0100
commit8f2de6dd4f99bf15ab55b07b88f61c1ba4c65187 (patch)
treeb31765711f60019869092ba9977586ccbef0a8c3 /savevm.c
parent7d98eae200f294f51ada36d9b01591fc4726dd94 (diff)
downloadexternal_qemu-8f2de6dd4f99bf15ab55b07b88f61c1ba4c65187.zip
external_qemu-8f2de6dd4f99bf15ab55b07b88f61c1ba4c65187.tar.gz
external_qemu-8f2de6dd4f99bf15ab55b07b88f61c1ba4c65187.tar.bz2
Make state snapshots compatible with SD cards.
This patch introduces a check such that only drives exporting a snapshot creation function are considered for storing snapshots. SD cards are mounted with a raw file system, which does not support snapshots. Since the SD card is now skipped, the actual snapshot image can be safely mounted on hdb rather than hda. The contents of the SD card itself are included in the snapshot however, since they are accessed with the NAND driver (which saves the contents of the underlying files). Change-Id: I4816b6e54e227aca356389c15ce9f5c1282d2464
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/savevm.c b/savevm.c
index 8f0d8f1..ee90805 100644
--- a/savevm.c
+++ b/savevm.c
@@ -907,8 +907,8 @@ int qemu_savevm_state_complete(QEMUFile *f)
for(se = first_se; se != NULL; se = se->next) {
int len;
- if (se->save_state == NULL)
- continue;
+ if (se->save_state == NULL)
+ continue;
/* Section type */
qemu_put_byte(f, QEMU_VM_SECTION_FULL);
@@ -1122,22 +1122,6 @@ out:
return ret;
}
-/* device can contain snapshots */
-static int bdrv_can_snapshot(BlockDriverState *bs)
-{
- return (bs &&
- !bdrv_is_removable(bs) &&
- !bdrv_is_read_only(bs));
-}
-
-/* device must be snapshots in order to have a reliable snapshot */
-static int bdrv_has_snapshot(BlockDriverState *bs)
-{
- return (bs &&
- !bdrv_is_removable(bs) &&
- !bdrv_is_read_only(bs));
-}
-
static BlockDriverState *get_bs_snapshots(void)
{
BlockDriverState *bs;
@@ -1257,7 +1241,7 @@ void do_savevm(Monitor *mon, const char *name)
for(i = 0; i < nb_drives; i++) {
bs1 = drives_table[i].bdrv;
- if (bdrv_has_snapshot(bs1)) {
+ if (bdrv_can_snapshot(bs1)) {
if (must_delete) {
ret = bdrv_snapshot_delete(bs1, old_sn->id_str);
if (ret < 0) {
@@ -1304,7 +1288,7 @@ void do_loadvm(Monitor *mon, const char *name)
for(i = 0; i <= nb_drives; i++) {
bs1 = drives_table[i].bdrv;
- if (bdrv_has_snapshot(bs1)) {
+ if (bdrv_can_snapshot(bs1)) {
ret = bdrv_snapshot_goto(bs1, name);
if (ret < 0) {
if (bs != bs1)
@@ -1372,7 +1356,7 @@ void do_delvm(Monitor *mon, const char *name)
for(i = 0; i <= nb_drives; i++) {
bs1 = drives_table[i].bdrv;
- if (bdrv_has_snapshot(bs1)) {
+ if (bdrv_can_snapshot(bs1)) {
ret = bdrv_snapshot_delete(bs1, name);
if (ret < 0) {
if (ret == -ENOTSUP)
@@ -1402,7 +1386,7 @@ void do_info_snapshots(Monitor *mon)
monitor_printf(mon, "Snapshot devices:");
for(i = 0; i <= nb_drives; i++) {
bs1 = drives_table[i].bdrv;
- if (bdrv_has_snapshot(bs1)) {
+ if (bdrv_can_snapshot(bs1)) {
if (bs == bs1)
monitor_printf(mon, " %s", bdrv_get_device_name(bs1));
}