Skip to content

Commit

Permalink
vmsdk: fetch real time data in the API
Browse files Browse the repository at this point in the history
* Re-do the processing each time calling the API
* fix minor typo

Signed-off-by: Ruoyu Ying <[email protected]>
  • Loading branch information
Ruoyu-y committed Jan 25, 2024
1 parent a6d946e commit 6263343
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion vmsdk/python/cctrusted_vm/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_measurement_count(self) -> int:
for DRTM).
Beyond the real mesurement register, some SDK may extend virtual measurement
reigster for addtional trust chain like container, namespace, cluster in
reigster for additional trust chain like container, namespace, cluster in
cloud native paradiagm.
Returns:
Expand Down Expand Up @@ -87,6 +87,9 @@ def get_measurement(self, imr_select:[int, int]) -> TcgIMR:
if algo_id is None or algo_id is TcgAlgorithmRegistry.TPM_ALG_ERROR:
algo_id = self._cvm.default_algo_id

# Re-do the processing to fetch the latest measurements
self._cvm.process_cc_report()

return self._cvm.imrs[imr_index]

def get_quote(
Expand Down Expand Up @@ -124,8 +127,12 @@ def get_eventlog(self, start:int = None, count:int = None) -> EventLogs:
Returns:
``Eventlogs`` object containing all event logs following TCG PCClient Spec.
"""
# Re-do the processing to fetch the latest event logs
self._cvm.process_eventlog()

event_logs = EventLogs(self._cvm.boot_time_event_log, self._cvm.runtime_event_log,
TcgEventLog.TCG_PCCLIENT_FORMAT)

event_logs.select(start, count)

return event_logs

0 comments on commit 6263343

Please sign in to comment.