From 2331d30e3eaa3e4ef15439821b95f52d534bfb82 Mon Sep 17 00:00:00 2001 From: Christoph Handel Date: Mon, 29 Apr 2019 16:43:45 +0200 Subject: [PATCH 1/2] CH: implement updatevv --- hpe3parclient/client.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hpe3parclient/client.py b/hpe3parclient/client.py index 84a74c04..1f02fc0e 100644 --- a/hpe3parclient/client.py +++ b/hpe3parclient/client.py @@ -88,6 +88,7 @@ class HPE3ParClient(object): GROW_VOLUME = 3 PROMOTE_VIRTUAL_COPY = 4 VIRTUAL_COPY = 3 + UPDATE_VIRTUAL_COPY = 7 TARGET_TYPE_VVSET = 1 TARGET_TYPE_SYS = 2 @@ -798,6 +799,29 @@ def promoteVirtualCopy(self, snapshot, optional=None): response, body = self.http.put('/volumes/%s' % snapshot, body=info) return body + def updateVirtualCopy(self, snapshots, readOnly=False): + """Update a virtual volume snapshot + + :param snapshots: the list of snapshot names + + :param readOnly: Specifies that if the virtual copy is read-write, the command + updates the read-only parent volume also + + :raises: :class:`~hpe3parclient.exceptions.HTTPForbidden` + - UNLICENSED_FEATURE: This system is not licensed with promote + """ + if isinstance(snapshots, str): + snapshots = [snapshots, ] + info = { + 'action': self.UPDATE_VIRTUAL_COPY, + 'parameters': { + 'volumeSnapshotList': snapshots, + 'readOnly': readOnly + } + } + response, body = self.http.post('/volumes/', body=info) + return body + def copyVolume(self, src_name, dest_name, dest_cpg, optional=None): """Copy/Clone a volume. From f4b060b84850add09b5369cd86416c558b8b8d4f Mon Sep 17 00:00:00 2001 From: Christoph Handel Date: Tue, 30 Apr 2019 14:12:35 +0200 Subject: [PATCH 2/2] CH: make pep8 happy --- hpe3parclient/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hpe3parclient/client.py b/hpe3parclient/client.py index 1f02fc0e..1490ab09 100644 --- a/hpe3parclient/client.py +++ b/hpe3parclient/client.py @@ -804,8 +804,8 @@ def updateVirtualCopy(self, snapshots, readOnly=False): :param snapshots: the list of snapshot names - :param readOnly: Specifies that if the virtual copy is read-write, the command - updates the read-only parent volume also + :param readOnly: Specifies that if the virtual copy is read-write, the + command updates the read-only parent volume also :raises: :class:`~hpe3parclient.exceptions.HTTPForbidden` - UNLICENSED_FEATURE: This system is not licensed with promote