fog-vsphere
fog-vsphere copied to clipboard
Datastores : Get datastore in maintenance mode
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
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.