summaryrefslogtreecommitdiffstats
path: root/src/sandbox/agent.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sandbox/agent.rs')
-rw-r--r--src/sandbox/agent.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sandbox/agent.rs b/src/sandbox/agent.rs
index 3964d2c..09a6f93 100644
--- a/src/sandbox/agent.rs
+++ b/src/sandbox/agent.rs
@@ -33,11 +33,18 @@ pub struct AgentOptions {
pub token: String,
pub profile: String,
pub ttl: Duration,
+ /// The identity the hub knows this sandbox by. A provisioner (Kata CR,
+ /// containerd run, a test) passes the nonce it registered with the hub;
+ /// the hello frame carries it back so the rendezvous can be matched.
+ pub agent_id: Option<String>,
}
pub fn serve(opts: &AgentOptions) -> Result<()> {
let stream = connect_with_retry(&opts.hub, Duration::from_secs(15))?;
- let agent_id = format!("sandbox-{}", std::process::id());
+ let agent_id = opts
+ .agent_id
+ .clone()
+ .unwrap_or_else(|| format!("sandbox-{}", std::process::id()));
wire::write_frame(
&mut stream.try_clone()?,
&Frame::Hello {