-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/csi 1451 create flashcopy (#7)
* add first attempt for create flashcopy method add flashcopy creation options to types.py * flashcopy -> flashcopies * add cs to url * return all post command * return all post command * adding log for url * adding log for url * delete log * try to debug * try to debug * try to debug * try going against the wiki * try going against the wiki * try going against the wiki add posta to flashcopy * try going against the wiki * testing * testing without rebuild * testing with rebuild * testing cs/flashcopy * testing v1/flashcopeis * testing v1/flashcopy * testing v1/flashcopy * testing global url * testing global url * testing global url * testing global url * testing global url * testing global url * testing global url * testing set_base_url method * remove posta from volumes.py * add flashcopies.py * edit flashcopies.py * disable pprcs.py * disable volumemixin * disable pprcs.py * able pprcs.py * flashcopies.py to flashcopy * flashcopies.py to flashcopy * flashcopies.py to flashcopy * testing manager * pdb * create_flashcopy to sc_client.py * edit flashcopies.py * edit init * add posta to flashcopies.py * remove pdb and global params * add delete and unit test for create * testing * add __init__.py * write in __init__.py files * delete content in __init__.py files and add __init__.py * add __init__.py * add __init__.py * remove __init__.py * try change import relations * changed create_flashcopy input add unit tests - pass * trying options * testing * flashcopy to flashcopies * // * get and list for flashcopies.py * pdb add * test change response from flashcopies get * add if to _add_details * test get_flashcopies_by_volume * revert get_flashcopies_by_volume method * test options * options - list and singular * options - list and singular fix * options - list and singular * no singular option is allowed * options - list and singular * cleanup fo PR * check tests * check tests * check tests fix route * // * added flashcopies.py ALL ONE * get rid of bug * flake8 fixes * flake8 fixes * flake8 fixes * get rid of unnecessary code * PR fixes * fix * get rid of unnecessary imports * all flashcopy stay as it was, only cs_flashcopies change (added) * change if statement, PR * related_resource change * fix lines * get rid of unnecessary code Co-authored-by: ArbelNathan <[email protected]>
- Loading branch information
1 parent
1992d71
commit 99e6e28
Showing
15 changed files
with
506 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
############################################################################## | ||
# Copyright 2019 IBM Corp. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
############################################################################## | ||
|
||
""" | ||
advanced FlashCopies interface. | ||
""" | ||
from pyds8k.base import ManagerMeta, ResourceMeta | ||
from ..common.base import Base, BaseManager | ||
from ..common.types import DS8K_CS_FLASHCOPY, DS8K_FLASHCOPY | ||
from ..volumes import Volume, VolumeManager | ||
|
||
|
||
class FlashCopy(Base, metaclass=ResourceMeta): | ||
resource_type = DS8K_CS_FLASHCOPY | ||
_template = {'id': None, | ||
'persistent': None, | ||
'recording': None, | ||
'backgroundcopy': None, | ||
'state': None, | ||
'options': [], | ||
'volume_pairs': [] | ||
} | ||
|
||
related_resource = {'_volume_pairs': [{ | ||
'source_volume': (Volume, VolumeManager), | ||
'target_volume': (Volume, VolumeManager) | ||
}] | ||
} | ||
|
||
def __repr__(self): | ||
return "<FlashCopy: {0}>".format(self._get_id()) | ||
|
||
def _add_details(self, info, force=False): | ||
super(FlashCopy, self)._add_details(info, force=force) | ||
if DS8K_FLASHCOPY in info: | ||
self._id = info[DS8K_FLASHCOPY][0]['id'] | ||
|
||
|
||
class FlashCopyManager(BaseManager, metaclass=ManagerMeta): | ||
""" | ||
Manage advanced FlashCopies resources. | ||
""" | ||
resource_class = FlashCopy | ||
resource_type = DS8K_CS_FLASHCOPY | ||
|
||
def get(self, resource_id='', url='', obj_class=None, **kwargs): | ||
return self._get(resource_id=resource_id, url=url, | ||
obj_class=obj_class, **kwargs) | ||
|
||
def list(self, url='', obj_class=None, body=None, **kwargs): | ||
return self._list(url=url, obj_class=obj_class, body=body, **kwargs) | ||
|
||
def posta(self, url='', body=None): | ||
return self._posta(url=url, body=body) | ||
|
||
def delete(self, url=''): | ||
return self._delete(url=url) |
Empty file.
Oops, something went wrong.