Skip to content

Commit 3e4b533

Browse files
committed
feat(vmm): expose event_log_version in vmm-cli and Web UI
- vmm-cli.py compose: add --event-log-version {1,2} flag. Omitting the flag keeps the field out of app-compose.json, so existing compose hashes are unchanged when the flag isn't used. - Web UI CreateVmDialog: add a dropdown under Networking with V1 (legacy binary) / V2 (JCS canonical JSON); v2 is only written into the generated app-compose when explicitly selected. - useVmManager: thread event_log_version through VmFormState and the clone-config path so re-creating a VM preserves the selection.
1 parent 55ce10f commit 3e4b533

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

vmm/src/vmm-cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ def create_app_compose(self, args) -> None:
818818
app_compose["swap_size"] = swap_bytes
819819
else:
820820
app_compose.pop("swap_size", None)
821+
if args.event_log_version is not None:
822+
app_compose["event_log_version"] = args.event_log_version
821823

822824
compose_file = json.dumps(app_compose, indent=4, ensure_ascii=False).encode(
823825
"utf-8"
@@ -1684,6 +1686,13 @@ def _patched_format_help():
16841686
default=None,
16851687
help="Swap size (e.g. 4G). Set to 0 to disable",
16861688
)
1689+
compose_parser.add_argument(
1690+
"--event-log-version",
1691+
type=int,
1692+
choices=[1, 2],
1693+
default=None,
1694+
help="RTMR3 runtime event-log digest format (1: legacy binary, 2: JCS canonical JSON). Omit to use the guest default (1).",
1695+
)
16871696
compose_parser.add_argument(
16881697
"--output", required=True, help="Path to output app-compose.json file"
16891698
)

vmm/ui/src/components/CreateVmDialog.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ const CreateVmDialogComponent = {
156156
</select>
157157
</div>
158158
159+
<div class="form-group">
160+
<label for="eventLogVersion">Event log format
161+
<span class="help-icon" title="V2 (JCS canonical JSON) enables per-event policy evaluation. V1 is the legacy binary format. Requires guest image with v2 support.">?</span>
162+
</label>
163+
<select id="eventLogVersion" v-model.number="form.event_log_version">
164+
<option :value="1">V1 (legacy binary)</option>
165+
<option :value="2">V2 (JCS canonical JSON)</option>
166+
</select>
167+
</div>
168+
159169
<div class="form-group full-width">
160170
<label>Features</label>
161171
<div class="feature-checkboxes">

vmm/ui/src/composables/useVmManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type AppCompose = {
3131
launch_token_hash?: string;
3232
pre_launch_script?: string;
3333
init_script?: string;
34+
event_log_version?: number;
3435
};
3536

3637
type KeyProviderKind = 'none' | 'kms' | 'local' | 'tpm';
@@ -111,6 +112,7 @@ type VmFormState = {
111112
kms_urls: string[];
112113
gateway_urls: string[];
113114
stopped: boolean;
115+
event_log_version: number;
114116
};
115117

116118
type UpdateDialogState = {
@@ -194,6 +196,7 @@ function createVmFormState(preLaunchScript: string): VmFormState {
194196
kms_urls: [],
195197
gateway_urls: [],
196198
stopped: false,
199+
event_log_version: 1,
197200
};
198201
}
199202

@@ -754,6 +757,10 @@ type CreateVmPayloadSource = {
754757
appCompose.swap_size = swapBytes;
755758
}
756759

760+
if (vmForm.value.event_log_version && vmForm.value.event_log_version !== 1) {
761+
appCompose.event_log_version = vmForm.value.event_log_version;
762+
}
763+
757764
const launchToken = vmForm.value.encryptedEnvs.find((env) => env.key === 'APP_LAUNCH_TOKEN');
758765
if (launchToken) {
759766
appCompose.launch_token_hash = await calcComposeHash(launchToken.value);
@@ -1134,6 +1141,7 @@ type CreateVmPayloadSource = {
11341141
net_mode: config.networking?.mode || '',
11351142
user_config: config.user_config || '',
11361143
stopped: !!config.stopped,
1144+
event_log_version: theVm.appCompose?.event_log_version || 1,
11371145
};
11381146

11391147
// Show Create VM dialog instead of Clone Config dialog

0 commit comments

Comments
 (0)