Example #1
0
    def _check_need_changes_for_retype(self, volume, new_type, host, vol_name):
        before_change = {}
        after_change = {}
        if volume.host != host["host"]:
            msg = (_("Do not support retype between different host. Volume's "
                     "host: %(vol_host)s, host's host: %(host)s")
                   % {"vol_host": volume.host, "host": host['host']})
            LOG.error(msg)
            raise exception.InvalidInput(msg)

        old_opts = fs_utils.get_volume_specs(self.client, vol_name)
        new_opts = fs_utils.get_volume_type_params(new_type, self.client)
        if old_opts.get('qos') != new_opts.get('qos'):
            before_change["qos"] = old_opts.get("qos")
            after_change["qos"] = new_opts.get("qos")

        change_opts = {"old_opts": before_change,
                       "new_opts": after_change}
        return change_opts
Example #2
0
    def _check_need_changes_for_manage(self, volume, vol_name):
        old_qos = {}
        new_qos = {}
        new_opts = fs_utils.get_volume_params(volume, self.client)
        old_opts = fs_utils.get_volume_specs(self.client, vol_name)

        # Not support from existence to absence or change
        if old_opts.get("qos"):
            if old_opts.get("qos") != new_opts.get("qos"):
                msg = (_("The current volume qos is: %(old_qos)s, the manage "
                         "volume qos is: %(new_qos)s")
                       % {"old_qos": old_opts.get("qos"),
                          "new_qos": new_opts.get("qos")})
                self._raise_exception(msg)
        elif new_opts.get("qos"):
            new_qos["qos"] = new_opts.get("qos")
            old_qos["qos"] = {}

        change_opts = {"old_opts": old_qos,
                       "new_opts": new_qos}

        return change_opts