Skip to content

Commit

Permalink
[GH-40] Add missing keep_for parameter for snap
Browse files Browse the repository at this point in the history
Add keep_for parameter in lun.create_snap and snap.create interfaces
  • Loading branch information
peter-wangxu committed Nov 16, 2016
1 parent 4b21f5b commit 8e93e2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions storops/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ class VNXLunHasSnapMountPointError(VNXDeleteLunError):
error_code = 0x716d801a


@cli_exception
class VNXLunHasSnapError(VNXDeleteLunError):
error_message = ("The LUN cannot be destroyed because it still"
" has snapshots")


@cli_exception
class VNXLunUsedByFeatureError(VNXDeleteLunError):
error_message = ("Cannot unbind LUN because it's being used by a"
Expand Down
5 changes: 3 additions & 2 deletions storops/vnx/resource/lun.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ def get(cli, lun_id=None, name=None, lun_type=None, lun_ids=None,
ret.poll = poll
return ret

def create_snap(self, name, allow_rw=None, auto_delete=None):
def create_snap(self, name, allow_rw=None, auto_delete=None,
keep_for=None):
return VNXSnap.create(self._cli, self.get_id(self), name, allow_rw,
auto_delete)
auto_delete, keep_for)

def attach_snap(self, snap):
snap_name = VNXSnap.get_name(snap)
Expand Down
5 changes: 3 additions & 2 deletions storops/vnx/resource/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def __init__(self, name=None, cli=None):
self._name = name

@classmethod
def create(cls, cli, res, name, allow_rw=None, auto_delete=None):
out = cli.create_snap(res, name, allow_rw, auto_delete)
def create(cls, cli, res, name, allow_rw=None, auto_delete=None,
keep_for=None):
out = cli.create_snap(res, name, allow_rw, auto_delete, keep_for)
msg = 'failed to create snap "{}" for {}'.format(name, res)
ex.raise_if_err(out, msg, default=ex.VNXCreateSnapError)
return VNXSnap(name, cli=cli)
Expand Down

0 comments on commit 8e93e2f

Please sign in to comment.