cinder_qos: Remove stale associations

Ensure associations which are no longer included by the given list, to
avoid leaving stale ones.

Change-Id: I957254b34a29d6a9824a15fb5703ed393a5b85bf
This commit is contained in:
Takashi Kajinami 2024-10-07 17:03:18 +09:00
parent 8744e3daa2
commit 727d0c182d

@ -54,11 +54,15 @@ Puppet::Type.type(:cinder_qos).provide(
end
def associations=(value)
properties = value - @property_hash[:associations]
properties.each do |item|
added = value - @property_hash[:associations]
removed = @property_hash[:associations] - value
added.each do |item|
self.class.request('volume qos', 'associate', [name, item])
@property_hash[:associations] = value
end
removed.each do |item|
self.class.request('volume qos', 'disassociate', [name, item])
end
@property_hash[:associations] = value
end
def self.instances