fog-vsphere icon indicating copy to clipboard operation
fog-vsphere copied to clipboard

Datastores : Get datastore in maintenance mode

Open kairel opened this issue 8 years ago • 1 comments

Hi,

i try to check datastores that are in maintenance mode , but no field in datastore is present. I've add it in list_datastores

def datastore_attributes datastore, datacenter
          {
            :id          => managed_obj_id(datastore),
            :name        => datastore.name,
            :accessible  => datastore.summary.accessible,
            :type        => datastore.summary.type,
            :freespace   => datastore.summary.freeSpace,
            :capacity    => datastore.summary.capacity,
            :uncommitted => datastore.summary.uncommitted,
            :datacenter  => datacenter,
            :maintenance_mode => datastore.summary.maintenanceMode,
          }
end

I don't know if it's the best way for implement it ?

Michael

kairel avatar Sep 22 '17 09:09 kairel

So, I'm not sure at the "fog" level if there is standardization across provider types to present specific attributes. If there isn't and each provider can implement whatever attributes they want, then I'd vote to do something similar but maybe just call the attribute maintenance and return a boolean. This would also be handy for host models as well. This would allow for the idiomatic method of is_maintenance? to be easily implemented and make sense in context of the attribute name.

Another options is to consider a details hash that can return arbitrary data to keep the top level attributes list smaller.

derekmwright avatar Nov 01 '17 14:11 derekmwright