Adam Litke has uploaded a new change for review.

Change subject: sdm: Pass the real hostid to copy_data
......................................................................

sdm: Pass the real hostid to copy_data

We have been passing the hostid as None to copy_data but the correct
value will need to be passed in order to support volume leases.  Since
we use the same hostid for all storage domains and the that hostid is
the same as the id attribute of the connected storage pool we can add a
simple helper to supply the proper hostid to sdm verbs.  This will need
to be changed if we remove storage pools or if we opt to use different
hostid values for each domain.

Change-Id: I367576fca126be695d7617477f92110941620a3b
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/62576/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index cfa3118..e1e8b40 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3510,6 +3510,16 @@
         self.taskMng.scheduleJob("sdm", None, vars.task,
                                  job.description, job.run)
 
+    def _get_hostid(self):
+        # Currently we use the pool.id as the hostid for all storage domains.
+        # If we get rid of the storage pool then we need to add an interface
+        # to fetch the hostid from the StorageDomainManifest object.
+        try:
+            pool = self.pools.values()[0]
+        except IndexError:
+            raise se.StoragePoolNotConnected()
+        return pool.id
+
     @public
     def sdm_create_volume(self, job_id, vol_info):
         vol_info = sdm.api.create_volume.CreateVolumeInfo(vol_info)
@@ -3521,5 +3531,6 @@
 
     @public
     def sdm_copy_data(self, job_id, source, destination):
-        job = sdm.api.copy_data.Job(job_id, None, source, destination)
+        job = sdm.api.copy_data.Job(job_id, self._get_hostid(),
+                                    source, destination)
         self.sdm_schedule(job)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I367576fca126be695d7617477f92110941620a3b
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
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to