From b4cb4aaaa895246c03e2078ea31965dffadd7c71 Mon Sep 17 00:00:00 2001 From: Debayan Ray Date: Fri, 5 Jan 2018 04:48:04 -0500 Subject: [PATCH] Update documentation related to 'refresh()' Update the documentation with the relevant changes pertaining to the new behaviour of ResourceBase.refresh() [0] method. Also, removed CPU and memory information from 'Missing Features' portion as those are available now. [0] Commit patch 2b39751e193c56995bbb95741afcdabc8bccdb05 Change-Id: Ifb81e0c58d70097eda1f65c9dbec13803056111c --- doc/source/reference/index.rst | 2 +- doc/source/reference/usage.rst | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index a0259edf..d07e4f91 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -22,7 +22,7 @@ Missing Features These are some features that sushy is presently missing. * Collect sensor data (Health state, temperature, fans etc...) -* System inspection (Number of CPUs, memory and disk size) +* System disk size * Serial console Sushy Python API Reference diff --git a/doc/source/reference/usage.rst b/doc/source/reference/usage.rst index 827ce9da..eccc27d9 100644 --- a/doc/source/reference/usage.rst +++ b/doc/source/reference/usage.rst @@ -47,6 +47,14 @@ Creating and using a sushy system object sys_inst = sys_col.get_member(sys_col.members_identities[0]) # Refresh the system collection object + # + # In order to reload a resource post its initialization it has to be marked + # as stale (i.e. invoking 'invalidate()') first and then 'refresh()' has to + # be called. This will only reload the resource w/o reloading/refreshing its + # sub-resources (lazy-refresh of sub-resources). + # Note that calling 'refresh()' only, i.e. w/o calling 'invalidate()' first, + # will be a no-op wrt resource reload in this case. + sys_col.invalidate() sys_col.refresh() @@ -59,8 +67,15 @@ Creating and using a sushy system object # Get a list of allowed reset values print(sys_inst.get_allowed_reset_system_values()) - # Refresh the system object - sys_inst.refresh() + # Refresh the system object (with all its sub-resources) + # + # Alternatively, this is the other way of reloading a resource object: + # The resource can be reloaded w/o the need of marking it stale + # (i.e. not invoking 'invalidate()'). It is achieved when the "force" + # argument of 'refresh()' method is set to True. Do note that the + # sub-resources of the resource being reloaded will also get reloaded + # (greedy-refresh of sub-resources) when this mode is adopted. + sys_inst.refresh(force=True) # Get the current power state print(sys_inst.power_state) @@ -126,6 +141,7 @@ Creating and using a sushy manager object mgr_inst = mgr_col.get_member(mgr_col.members_identities[0]) # Refresh the manager collection object + mgr_col.invalidate() mgr_col.refresh() @@ -147,8 +163,8 @@ Creating and using a sushy manager object # Reset the manager mgr_inst.reset_manager(sushy.RESET_MANAGER_FORCE_RESTART) - # Refresh the manager object - mgr_inst.refresh() + # Refresh the manager object (with all its sub-resources) + mgr_inst.refresh(force=True) If you do not have any real baremetal machine that supports the Redfish