Adam Litke has uploaded a new change for review.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
storage: export volume lease state in getVolumeInfo
In order to support an entity-based polling methodology (ie. in the new SDM verbs) we must know whether a volume is currently locked by a long running operation. Extend the getVolumeInfo API to report whether the lease is free or held.
Change-Id: I55f062a4be15593fdc98518fd0a113976cbe0ae7 Signed-off-by: Adam Litke alitke@redhat.com --- M vdsm/rpc/vdsmapi-schema.json M vdsm/storage/volume.py 2 files changed, 31 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/38623/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json index 988ce64..cba1008 100644 --- a/vdsm/rpc/vdsmapi-schema.json +++ b/vdsm/rpc/vdsmapi-schema.json @@ -7897,6 +7897,19 @@ {'enum': 'VolumeStatus', 'data': ['OK', 'INVALID', 'ILLEGAL']}
## +# @VolumeLeaseState: +# +# An enumeration of Volume lease states. +# +# @FREE: The lease is free +# +# @HELD: The lease is held +# +# Since: 4.10.0 +## +{'enum': 'VolumeLeaseState', 'data': ['FREE', 'HELD']} + +## # @VolumeInfo: # # Information about a Volume. @@ -7937,6 +7950,8 @@ # # @children: A list of decendent Volumes that depend on this Volume # +# @leaseState: #optional The state of the volume lease +# # Since: 4.10.0 ## {'type': 'VolumeInfo', @@ -7946,7 +7961,8 @@ 'description': 'str', 'pool': 'UUID', 'domain': 'UUID', 'image': 'UUID', 'ctime': 'int', '*mtime': 'uint', 'legality': 'VolumeLegality', 'apparentsize': 'uint', - 'truesize': 'uint', 'status': 'VolumeStatus', 'children': ['UUID']}} + 'truesize': 'uint', 'status': 'VolumeStatus', 'children': ['UUID'], + '*leaseState': 'VolumeLeaseState'}}
## # @Volume.getInfo: diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py index 980b6e3..2e16efc 100644 --- a/vdsm/storage/volume.py +++ b/vdsm/storage/volume.py @@ -33,6 +33,7 @@ import fileUtils import task from threadLocal import vars +from clusterlock import InquireNotSupportedError import resourceFactories import resourceManager as rm rmanager = rm.ResourceManager.getInstance() @@ -85,6 +86,10 @@ ILLEGAL_VOL = "ILLEGAL" LEGAL_VOL = "LEGAL" FAKE_VOL = "FAKE" + +# Volume lease states +LEASE_FREE = "FREE" +LEASE_HELD = "HELD"
log = logging.getLogger('Storage.Volume')
@@ -839,6 +844,11 @@ cls.createMetadata(metaId, meta) return meta
+ def getLeaseState(self): + ver, owners = sdCache.produce(self.sdUUID).inquireVolumeLease( + self.imgUUID, self.volUUID) + return LEASE_HELD if owners else LEASE_FREE + def getInfo(self): """ Get volume info @@ -857,6 +867,10 @@ info['apparentsize'] = str(vsize) info['truesize'] = str(avsize) info['status'] = "OK" + try: + info['leaseState'] = self.getLeaseState() + except InquireNotSupportedError: + pass except se.StorageException as e: self.log.debug("exception: %s:%s" % (str(e.message), str(e.value))) info['apparentsize'] = "0"
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16557/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/16728/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_el_gerrit/15758/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16561/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/16732/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_el_gerrit/15762/ : SUCCESS
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16726/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/16898/ : SUCCESS
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16814/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/16986/ : FAILURE
Liron Aravot has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 4:
(1 comment)
https://gerrit.ovirt.org/#/c/38623/4/vdsm/storage/volume.py File vdsm/storage/volume.py:
Line 845: return meta Line 846: Line 847: def getLeaseState(self): Line 848: ver, owners = sdCache.produce(self.sdUUID).inquireVolumeLease( Line 849: self.imgUUID, self.volUUID) why don't we want to return the owners if we already got that info? perhaps it could be used by the engine Line 850: return LEASE_HELD if owners else LEASE_FREE Line 851: Line 852: def getInfo(self): Line 853: """
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 5:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16847/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17019/ : SUCCESS
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 6:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 6:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16971/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 6:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17144/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 6:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/16971/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17144/ : FAILURE
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 7:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 7:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17051/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 7:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17225/
Adam Litke has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 7: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 7:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17051/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17225/ : FAILURE
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 8:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 8:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17558/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 8:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17732/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 8:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17558/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17732/ : SUCCESS
Freddy Rolland has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 8: Code-Review+1
(2 comments)
Minor comments in schema
https://gerrit.ovirt.org/#/c/38623/8/vdsm/rpc/vdsmapi-schema.json File vdsm/rpc/vdsmapi-schema.json:
Line 7945: 4.10.0 Should it be 4.17.0 ?
Line 7990: lease Add : (new in version 4.17)
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 9:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 9:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17905/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 9:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17734/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 9:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17905/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17734/ : SUCCESS
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 10:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 10:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/18305/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 10:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/1535/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 10: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/18305/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/1535/ : ABORTED
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 11:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 12:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Jenkins CI RO has abandoned this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
gerrit-hooks has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 12:
* Update tracker: IGNORE, no Bug-Url found
Adam Litke has restored this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Restored
Nir Soffer has abandoned this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Abandoned
Replaced by https://gerrit.ovirt.org/#/c/61995
gerrit-hooks has posted comments on this change.
Change subject: storage: export volume lease state in getVolumeInfo ......................................................................
Patch Set 12:
* Update tracker: IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org