예제 #1
0
    def _check_volume_type_for_lun(self, volume, lun, existing_ref,
                                   extra_specs):
        """Check if LUN satisfies volume type."""
        def scan_ssc_data():
            volumes = ssc_cmode.get_volumes_for_specs(self.ssc_vols,
                                                      extra_specs)
            for vol in volumes:
                if lun.get_metadata_property('Volume') == vol.id['name']:
                    return True
            return False

        match_read = scan_ssc_data()
        if not match_read:
            ssc_cmode.get_cluster_latest_ssc(self,
                                             self.zapi_client.get_connection(),
                                             self.vserver)
            match_read = scan_ssc_data()

        if not match_read:
            raise exception.ManageExistingVolumeTypeMismatch(
                reason=(_("LUN with given ref %(ref)s does not satisfy volume"
                          " type. Ensure LUN volume with ssc features is"
                          " present on vserver %(vs)s.") % {
                              'ref': existing_ref,
                              'vs': self.vserver
                          }))
예제 #2
0
파일: block_cmode.py 프로젝트: dims/cinder
    def _check_volume_type_for_lun(self, volume, lun, existing_ref, extra_specs):
        """Check if LUN satisfies volume type."""

        def scan_ssc_data():
            volumes = ssc_cmode.get_volumes_for_specs(self.ssc_vols, extra_specs)
            for vol in volumes:
                if lun.get_metadata_property("Volume") == vol.id["name"]:
                    return True
            return False

        match_read = scan_ssc_data()
        if not match_read:
            ssc_cmode.get_cluster_latest_ssc(self, self.zapi_client.get_connection(), self.vserver)
            match_read = scan_ssc_data()

        if not match_read:
            raise exception.ManageExistingVolumeTypeMismatch(
                reason=(
                    _(
                        "LUN with given ref %(ref)s does not satisfy volume"
                        " type. Ensure LUN volume with ssc features is"
                        " present on vserver %(vs)s."
                    )
                    % {"ref": existing_ref, "vs": self.vserver}
                )
            )
예제 #3
0
    def _check_volume_type_for_lun(self, volume, lun, existing_ref):
        """Check if LUN satisfies volume type."""
        extra_specs = na_utils.get_volume_extra_specs(volume)
        match_write = False

        def scan_ssc_data():
            volumes = ssc_cmode.get_volumes_for_specs(self.ssc_vols,
                                                      extra_specs)
            for vol in volumes:
                if lun.get_metadata_property('Volume') == vol.id['name']:
                    return True
            return False

        match_read = scan_ssc_data()
        if not match_read:
            ssc_cmode.get_cluster_latest_ssc(self,
                                             self.zapi_client.get_connection(),
                                             self.vserver)
            match_read = scan_ssc_data()

        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None
        if qos_policy_group:
            if match_read:
                try:
                    path = lun.get_metadata_property('Path')
                    self.zapi_client.set_lun_qos_policy_group(
                        path, qos_policy_group)
                    match_write = True
                except netapp_api.NaApiError as nae:
                    LOG.error(_LE("Failure setting QoS policy group. %s"), nae)
        else:
            match_write = True
        if not (match_read and match_write):
            raise exception.ManageExistingVolumeTypeMismatch(
                reason=(_("LUN with given ref %(ref)s does not satisfy volume"
                          " type. Ensure LUN volume with ssc features is"
                          " present on vserver %(vs)s.") % {
                              'ref': existing_ref,
                              'vs': self.vserver
                          }))
예제 #4
0
    def _check_volume_type_for_lun(self, volume, lun, existing_ref):
        """Check if LUN satisfies volume type."""
        extra_specs = na_utils.get_volume_extra_specs(volume)
        match_write = False

        def scan_ssc_data():
            volumes = ssc_cmode.get_volumes_for_specs(self.ssc_vols,
                                                      extra_specs)
            for vol in volumes:
                if lun.get_metadata_property('Volume') == vol.id['name']:
                    return True
            return False

        match_read = scan_ssc_data()
        if not match_read:
            ssc_cmode.get_cluster_latest_ssc(
                self, self.zapi_client.get_connection(), self.vserver)
            match_read = scan_ssc_data()

        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None
        if qos_policy_group:
            if match_read:
                try:
                    path = lun.get_metadata_property('Path')
                    self.zapi_client.set_lun_qos_policy_group(path,
                                                              qos_policy_group)
                    match_write = True
                except netapp_api.NaApiError as nae:
                    LOG.error(_LE("Failure setting QoS policy group. %s"), nae)
        else:
            match_write = True
        if not (match_read and match_write):
            raise exception.ManageExistingVolumeTypeMismatch(
                reason=(_("LUN with given ref %(ref)s does not satisfy volume"
                          " type. Ensure LUN volume with ssc features is"
                          " present on vserver %(vs)s.")
                        % {'ref': existing_ref, 'vs': self.vserver}))