diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-17 13:14:13 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-17 13:14:13 -0500 |
commit | 128dc2d1e4cb98ddbe9c0df2e0c914dc00925dac (patch) | |
tree | adc3f6aae78c1f1387ebaf0f8ac4f20c99d576ec /block/sheepdog.c | |
parent | 5d71bbc5fb076e6d8a37bb3e320d61432b3c2ce0 (diff) | |
parent | 0bed087df24c7b3fae366f239b9d150de3309416 (diff) |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Liu Yuan (2) and others
# Via Kevin Wolf
* kwolf/for-anthony:
vmdk: Allow reading variable size descriptor files
NVMe: Initial commit for new storage interface
curl: Don't set curl options on the handle just before it's going to be deleted.
vmdk: byteswap VMDK4Header.desc_offset field
block/curl.c: Refuse to open the handle for writes.
sheepdog: support 'qemu-img snapshot -a'
sheepdog: fix snapshot tag initialization
Message-id: 1371486710-17793-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index 21a4edf15b..1b7c3f19b0 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2063,7 +2063,7 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) if (snapid) { tag[0] = 0; } else { - pstrcpy(tag, sizeof(tag), s->name); + pstrcpy(tag, sizeof(tag), snapshot_id); } ret = reload_inode(s, snapid, tag); @@ -2071,14 +2071,11 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) goto out; } - if (!s->inode.vm_state_size) { - error_report("Invalid snapshot"); - ret = -ENOENT; + ret = sd_create_branch(s); + if (ret) { goto out; } - s->is_snapshot = true; - g_free(old_s); return 0; @@ -2196,8 +2193,9 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, int fd, ret = 0, remaining = size; unsigned int data_len; uint64_t vmstate_oid; - uint32_t vdi_index; uint64_t offset; + uint32_t vdi_index; + uint32_t vdi_id = load ? s->inode.parent_vdi_id : s->inode.vdi_id; fd = connect_to_sdog(s); if (fd < 0) { @@ -2210,7 +2208,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, data_len = MIN(remaining, SD_DATA_OBJ_SIZE - offset); - vmstate_oid = vid_to_vmstate_oid(s->inode.vdi_id, vdi_index); + vmstate_oid = vid_to_vmstate_oid(vdi_id, vdi_index); create = (offset == 0); if (load) { |