예제 #1
0
 def _add_qos_to_volume(self, volume, vol_name):
     try:
         opts = fs_utils.get_volume_params(volume, self.client)
         if opts.get("qos"):
             self.fs_qos.add(opts["qos"], vol_name)
     except Exception:
         self.client.delete_volume(vol_name=vol_name)
         raise
예제 #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