示例#1
0
文件: mixins.py 项目: IBM/pyds8k
    def get_cs_flashcopies(self, fcid=None):
        """
        Get Copy Service Flash Copies for the Caller Object.

        Args:
            fcid (str): id of the flash copy. Get all if None.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.cs.flashcopies.FlashCopy`.

        """
        if not self.id:
            raise IDMissingError()
        if fcid:
            return self.one('{}.{}'.format(
                types.DS8K_COPY_SERVICE_PREFIX,
                types.DS8K_CS_FLASHCOPY), fcid).get()
        flashcopies = self.all('{}.{}'.format(
            types.DS8K_COPY_SERVICE_PREFIX,
            types.DS8K_CS_FLASHCOPY)).list()
        self._start_updating()
        setattr(self, types.DS8K_CS_FLASHCOPY, flashcopies)
        self._stop_updating()
        return flashcopies
示例#2
0
 def get_eserep(self):
     if not self.id:
         raise IDMissingError()
     eserep = self.all(DS8K_ESEREP).list()
     self._start_updating()
     setattr(self, DS8K_ESEREP, eserep)
     self._stop_updating()
     return eserep
示例#3
0
 def create_mappings(self, volumes=[], mappings=[]):
     if not self.id:
         raise IDMissingError()
     if volumes:
         _, res = self.all(types.DS8K_VOLMAP).posta({'volumes': volumes})
     else:
         _, res = self.all(types.DS8K_VOLMAP).posta({'mappings': mappings})
     return res
示例#4
0
文件: ds8k.py 项目: IBM/pyds8k
 def get_resource_id_from_url(self, url, resource_type):
     if url.endswith('/'):
         url = url[:-1]
     url_frag = url.split('/')
     if len(url_frag) > 1 and url_frag[-2] == resource_type:
         return url_frag[-1]
     logger.debug("Failed to get resource id from url {}".format(url))
     raise IDMissingError()
示例#5
0
 def get_host_ports(self, port_id=None):
     if port_id:
         return self.get_host_port(port_id)
     if not self.id:
         raise IDMissingError()
     host_ports = self.all(types.DS8K_HOST_PORT).list()
     self._start_updating()
     setattr(self, types.DS8K_HOST_PORT, host_ports)
     self._stop_updating()
     return host_ports
示例#6
0
 def get_flashcopy(self, fcid=None):
     if not self.id:
         raise IDMissingError()
     if fcid:
         return self.one(types.DS8K_FLASHCOPY, fcid).get()
     flashcopies = self.all(types.DS8K_FLASHCOPY).list()
     self._start_updating()
     setattr(self, types.DS8K_FLASHCOPY, flashcopies)
     self._stop_updating()
     return flashcopies
示例#7
0
 def get_pprc(self, pprc_id=None):
     if not self.id:
         raise IDMissingError()
     if pprc_id:
         return self.one(types.DS8K_PPRC, pprc_id).get()
     pprc = self.all(types.DS8K_PPRC).list()
     self._start_updating()
     setattr(self, types.DS8K_PPRC, pprc)
     self._stop_updating()
     return pprc
示例#8
0
 def get_mappings(self, lunid=None):
     if lunid:
         return self.get_mapping(lunid)
     if not self.id:
         raise IDMissingError()
     mappings = self.all(types.DS8K_VOLMAP).list()
     self._start_updating()
     setattr(self, types.DS8K_VOLMAP, mappings)
     self._stop_updating()
     return mappings
示例#9
0
 def get_volumes(self, volume_id=None):
     if volume_id:
         return self.get_volume(volume_id)
     if not self.id:
         raise IDMissingError()
     volumes = self.all(types.DS8K_VOLUME).list()
     self._start_updating()
     setattr(self, types.DS8K_VOLUME, volumes)
     self._stop_updating()
     return volumes
示例#10
0
文件: mixins.py 项目: IBM/pyds8k
    def get_mapping(self, lunid):
        """
        Get the Mapping of the Volume by Volume id for the Caller Object.

        Args:
            lunid (str): Require. id of the volume.

        Returns:
            object: :py:class:`pyds8k.resources.ds8k.v1.mappings.Volmap`.

        """
        if not self.id:
            raise IDMissingError()
        return self.one(types.DS8K_VOLMAP, lunid).get()
示例#11
0
文件: mixins.py 项目: IBM/pyds8k
    def get_host_port(self, port_id):
        """
        Get An Host Ports for the Caller Object.

        Args:
            port_id (str): id of the Host Port. Get all if None.

        Returns:
            object: :py:class:`pyds8k.resources.ds8k.v1.host_ports.HostPort`.

        """
        if not self.id:
            raise IDMissingError()
        return self.one(types.DS8K_HOST_PORT, port_id).get()
示例#12
0
文件: mixins.py 项目: IBM/pyds8k
    def get_ioport(self, port_id):
        """
        Get An IO Port for the Caller Object.

        Args:
            port_id (str): Required. id of the IO Port.

        Returns:
            object: :py:class:`pyds8k.resources.ds8k.v1.ioports.IOPort`.

        """
        if not self.id:
            raise IDMissingError()
        return self.one(types.DS8K_IOPORT, port_id).get()
示例#13
0
文件: mixins.py 项目: IBM/pyds8k
    def delete_mapping(self, lunid):
        """
        Delete the Mapping of the Volume by Volume id for the Caller Object.

        Args:
            lunid (str): Require. id of the volume.

        Returns:
            tuple: tuple of DS8000 RESTAPI Server Response.

        """
        if not self.id:
            raise IDMissingError()
        _, res = self.one(types.DS8K_VOLMAP, lunid).delete()
        return res
示例#14
0
文件: mixins.py 项目: IBM/pyds8k
    def get_volume(self, volume_id):
        """
        Get A Volume for the Caller Object.

        Args:
            volume_id (str): Required. id of the volume.

        Returns:
            object: list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.volumes.Volume`.

        """
        if not self.id:
            raise IDMissingError()
        return self.one(types.DS8K_VOLUME, volume_id).get()
示例#15
0
文件: mixins.py 项目: IBM/pyds8k
    def get_pprc(self, pprc_id=None):
        """
        Get PPRC for the Caller Object.

        Args:
            pprc_id (str): id of the PPRC. Get all if None.

        Returns:
            list: A list of :py:class:`pyds8k.resources.ds8k.v1.pprc.PPRC`.

        """
        if not self.id:
            raise IDMissingError()
        if pprc_id:
            return self.one(types.DS8K_PPRC, pprc_id).get()
        pprc = self.all(types.DS8K_PPRC).list()
        self._start_updating()
        setattr(self, types.DS8K_PPRC, pprc)
        self._stop_updating()
        return pprc
示例#16
0
文件: mixins.py 项目: IBM/pyds8k
    def create_mappings(self, volumes=[], mappings=[]):
        """
        Create the Mapping of the Volume by Volume id for the Caller Object.

        Args:
            volumes (list): Require. volume ids.
            mappings (list): Required. mappings.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.mappings.Volmap`.

        """
        if not self.id:
            raise IDMissingError()
        if volumes:
            _, res = self.all(types.DS8K_VOLMAP).posta({'volumes': volumes})
        else:
            _, res = self.all(types.DS8K_VOLMAP).posta({'mappings': mappings})
        return res
示例#17
0
文件: mixins.py 项目: IBM/pyds8k
    def get_flashcopies(self, fcid=None):
        """
        Get Flash Copies for the Caller Object.

        Args:
            fcid (str): id of the flash copy. Get all if None.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.flashcopy.FlashCopy`.

        """
        if not self.id:
            raise IDMissingError()
        if fcid:
            return self.one(types.DS8K_FLASHCOPY, fcid).get()
        flashcopies = self.all(types.DS8K_FLASHCOPY).list()
        self._start_updating()
        setattr(self, types.DS8K_FLASHCOPY, flashcopies)
        self._stop_updating()
        return flashcopies
示例#18
0
文件: mixins.py 项目: IBM/pyds8k
    def get_mappings(self, lunid=None):
        """
        Get Mappings of the Volume by Volume id for the Caller Object.

        Args:
            lunid (str): id of the volume. Get all if None.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.mappings.Volmap`.

        """
        if lunid:
            return self.get_mapping(lunid)
        if not self.id:
            raise IDMissingError()
        mappings = self.all(types.DS8K_VOLMAP).list()
        self._start_updating()
        setattr(self, types.DS8K_VOLMAP, mappings)
        self._stop_updating()
        return mappings
示例#19
0
文件: mixins.py 项目: IBM/pyds8k
    def get_host_ports(self, port_id=None):
        """
        Get Host Ports for the Caller Object.

        Args:
            port_id (str): id of the Host Port. Get all if None.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.host_ports.HostPort`.

        """
        if port_id:
            return self.get_host_port(port_id)
        if not self.id:
            raise IDMissingError()
        host_ports = self.all(types.DS8K_HOST_PORT).list()
        self._start_updating()
        setattr(self, types.DS8K_HOST_PORT, host_ports)
        self._stop_updating()
        return host_ports
示例#20
0
文件: mixins.py 项目: IBM/pyds8k
    def get_volumes(self, volume_id=None):
        """
        Get Volumes for the Caller Object.

        Args:
            volume_id (str): id of the volume. Get all if None.

        Returns:
            list: A list of
            :py:class:`pyds8k.resources.ds8k.v1.volumes.Volume`.

        """
        if volume_id:
            return self.get_volume(volume_id)
        if not self.id:
            raise IDMissingError()
        volumes = self.all(types.DS8K_VOLUME).list()
        self._start_updating()
        setattr(self, types.DS8K_VOLUME, volumes)
        self._stop_updating()
        return volumes
示例#21
0
 def update_eserep_cap(self, cap, captype=''):
     if not self.id:
         raise IDMissingError()
     return self.all(DS8K_ESEREP).update({'cap': cap, 'captype': captype})
示例#22
0
 def delete_mapping(self, lunid):
     if not self.id:
         raise IDMissingError()
     _, res = self.one(types.DS8K_VOLMAP, lunid).delete()
     return res
示例#23
0
 def get_mapping(self, lunid):
     if not self.id:
         raise IDMissingError()
     return self.one(types.DS8K_VOLMAP, lunid).get()
示例#24
0
 def get_host_port(self, port_id):
     if not self.id:
         raise IDMissingError()
     return self.one(types.DS8K_HOST_PORT, port_id).get()
示例#25
0
 def get_volume(self, volume_id):
     if not self.id:
         raise IDMissingError()
     return self.one(types.DS8K_VOLUME, volume_id).get()
示例#26
0
 def update_tserep_threshold(self, threshold):
     if not self.id:
         raise IDMissingError()
     return self.all(DS8K_TSEREP).update({'threshold': threshold})
示例#27
0
 def delete_eserep(self):
     if not self.id:
         raise IDMissingError()
     return self.all(DS8K_ESEREP).delete()