The vdi id can change if we get the snapshot, so there is a problem
that vdi attributes vanish after taking snapshots.

This patch uses the first vdi id, whose snapid equals 1, for a vdi
attribute object id.

Signed-off-by: MORITA Kazutaka <[email protected]>
---
 sheep/group.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 9e039e7..7ddc4ed 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -686,6 +686,12 @@ static void vdi_op(struct vdi_op_message *msg)
                                 &vid, hdr->snapid, &nr_copies);
                if (ret != SD_RES_SUCCESS)
                        break;
+               /* the curernt vdi id can change if we take the snapshot,
+                  so we use the first vdi id for vdi attributes */
+               ret = lookup_vdi(hdr->epoch, data, SD_MAX_VDI_LEN, &vid, 1,
+                                &nr_copies);
+               if (ret != SD_RES_SUCCESS)
+                       break;
                ret = get_vdi_attr(hdr->epoch, data, hdr->data_length, vid,
                                   &attrid, hdr->flags & SD_FLAG_CMD_CREAT,
                                   hdr->flags & SD_FLAG_CMD_EXCL);
-- 
1.7.2.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to