@@ -18,7 +18,7 @@ use dice_verifier::Attest;
1818
1919use vm_attest:: VmInstanceConf ;
2020
21- use crate :: attestation:: ATTESTATION_ADDR ;
21+ use crate :: attestation:: { boot_digest , ATTESTATION_ADDR } ;
2222
2323#[ derive( Copy , Clone ) ]
2424pub struct AttestationServerConfig {
@@ -58,49 +58,36 @@ pub struct AttestationSockInit {
5858 log : slog:: Logger ,
5959 vm_conf_send : oneshot:: Sender < VmInstanceConf > ,
6060 uuid : uuid:: Uuid ,
61- volume_ref : Option < crucible :: Volume > ,
61+ boot_backend_ref : Option < boot_digest :: Backend > ,
6262}
6363
6464impl AttestationSockInit {
6565 /// Do any any remaining work of collecting VM RoT measurements in support
6666 /// of this VM's attestation server.
6767 pub async fn run ( self ) {
68- let AttestationSockInit { log, vm_conf_send, uuid, volume_ref } = self ;
68+ let AttestationSockInit { log, vm_conf_send, uuid, boot_backend_ref } =
69+ self ;
6970
7071 let mut vm_conf = vm_attest:: VmInstanceConf { uuid, boot_digest : None } ;
7172
72- if let Some ( volume) = volume_ref {
73- // TODO: load-bearing sleep: we have a Crucible volume, but we can
74- // be here and chomping at the bit to get a digest calculation
75- // started well before the volume has been activated; in
76- // `propolis-server` we need to wait for at least a subsequent
77- // instance start. Similar to the scrub task for Crucible disks,
78- // delay some number of seconds in the hopes that activation is done
79- // promptly.
80- //
81- // This should be replaced by awaiting for some kind of actual
82- // "activated" signal.
83- //
84- // see #1078
85- tokio:: time:: sleep ( std:: time:: Duration :: from_secs ( 10 ) ) . await ;
86-
87- let boot_digest =
88- match crate :: attestation:: boot_digest:: boot_disk_digest (
89- volume, & log,
90- )
91- . await
92- {
93- Ok ( digest) => digest,
94- Err ( e) => {
95- // a panic here is unfortunate, but helps us debug for
96- // now; if the digest calculation fails it may be some
97- // retryable issue that a guest OS would survive. but
98- // panicking here means we've stopped Propolis at the
99- // actual error, rather than noticing the
100- // `vm_conf_sender` having dropped elsewhere.
101- panic ! ( "failed to compute boot disk digest: {e:?}" ) ;
102- }
103- } ;
73+ if let Some ( digest_backend) = boot_backend_ref {
74+ let boot_digest = match crate :: attestation:: boot_digest:: compute (
75+ digest_backend,
76+ & log,
77+ )
78+ . await
79+ {
80+ Ok ( digest) => digest,
81+ Err ( e) => {
82+ // a panic here is unfortunate, but helps us debug for
83+ // now; if the digest calculation fails it may be some
84+ // retryable issue that a guest OS would survive. but
85+ // panicking here means we've stopped Propolis at the
86+ // actual error, rather than noticing the
87+ // `vm_conf_sender` having dropped elsewhere.
88+ panic ! ( "failed to compute boot disk digest: {e:?}" ) ;
89+ }
90+ } ;
10491
10592 vm_conf. boot_digest = Some ( boot_digest) ;
10693 } else {
@@ -287,7 +274,7 @@ impl AttestationSock {
287274 pub fn prepare_instance_conf (
288275 & mut self ,
289276 uuid : uuid:: Uuid ,
290- volume_ref : Option < crucible :: Volume > ,
277+ boot_backend_ref : Option < boot_digest :: Backend > ,
291278 ) {
292279 let init_state = std:: mem:: replace (
293280 & mut self . init_state ,
@@ -305,7 +292,7 @@ impl AttestationSock {
305292 let init = AttestationSockInit {
306293 log : self . log . clone ( ) ,
307294 uuid,
308- volume_ref ,
295+ boot_backend_ref ,
309296 vm_conf_send,
310297 } ;
311298 let init_task = tokio:: spawn ( init. run ( ) ) ;
0 commit comments