module Fog
  module Volume
    class OpenStack
      module Real
        def update_metadata(volume_id, metadata = {})
          data = {
            'metadata' => metadata
          }

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200],
            :method  => 'POST',
            :path    => "volumes/#{volume_id}/metadata"
          )
        end
      end
    end
  end
end

module Fog
  module Volume
    class OpenStack
      module Real
        def update_metadata(volume_id, metadata = {})
          data = {
            'metadata' => metadata
          }

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200,202],
            :method  => 'POST',
            :path    => "volumes/#{volume_id}/metadata"
          )
        end
      end
    end
  end
end

Update metadata update expected return code
Update metadata update expected return code

Huawei FusionSphere OpenStack return a 202 HTTP code when updating volume metadata