Adam Litke has uploaded a new change for review.

Change subject: storage: Report generation id in volume.getInfo
......................................................................

storage: Report generation id in volume.getInfo

Change-Id: I62a6bb44c5f789acf3c63953f4b87c72585becc1
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M lib/api/vdsm-api.yml
M tests/storage_volume_test.py
M vdsm/storage/volume.py
3 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/64485/1

diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index c7ab7f5..5e95d56 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -6962,6 +6962,10 @@
         -   description: The status of the Volume lease
             name: lease
             type: *VolumeLeaseStatus
+
+        -   description: A monotonically increasing generation id
+            name: generation
+            type: uint
         type: object
 
     VolumeSizeInfo: &VolumeSizeInfo
diff --git a/tests/storage_volume_test.py b/tests/storage_volume_test.py
index 6a0611a..f7c9c50 100644
--- a/tests/storage_volume_test.py
+++ b/tests/storage_volume_test.py
@@ -128,6 +128,18 @@
                     raise ValueError()
             self.assertEqual(sc.ILLEGAL_VOL, vol.getLegality())
 
+    def test_get_info_generation_id(self):
+        img_id = str(uuid.uuid4())
+        vol_id = str(uuid.uuid4())
+        generation = 100
+
+        with fake_env('file') as env:
+            env.make_volume(MB, img_id, vol_id)
+            vol = env.sd_manifest.produceVolume(img_id, vol_id)
+            vol.getLeaseStatus = lambda: 'unused'
+            vol.setMetaParam(sc.GENERATION, generation)
+            self.assertEqual(generation, vol.getInfo()['generation'])
+
 
 class CountedInstanceMethod(object):
     def __init__(self, method):
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 601391b..6057e18 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -206,6 +206,7 @@
             "ctime": meta.get(sc.CTIME, ""),
             "mtime": "0",
             "legality": meta.get(sc.LEGALITY, ""),
+            "generation": meta.get(sc.GENERATION, 0)
             }
 
     def getInfo(self):


-- 
To view, visit https://gerrit.ovirt.org/64485
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62a6bb44c5f789acf3c63953f4b87c72585becc1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to