MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / create_tables

Method create_tables

dstack-mr/src/acpi.rs:25–195  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

23
24impl Machine<'_> {
25 fn create_tables(&self) -> Result<Vec<u8>> {
26 if self.cpu_count == 0 {
27 bail!("cpuCount must be greater than 0");
28 }
29 let mem_size_mb = self.memory_size / (1024 * 1024);
30
31 // Dummy disk and shared directory. Use as placeholders for the qemu arguments.
32 let dummy_disk = "/bin/sh";
33 let shared_dir = "/bin";
34
35 // Prepare the command arguments
36 let mut cmd = std::process::Command::new("dstack-acpi-tables");
37 cmd.args([
38 "-cpu",
39 "qemu64",
40 "-smp",
41 &self.cpu_count.to_string(),
42 "-m",
43 &format!("{mem_size_mb}M"),
44 "-nographic",
45 "-nodefaults",
46 "-serial",
47 "stdio",
48 "-bios",
49 self.firmware,
50 "-kernel",
51 self.kernel,
52 "-initrd",
53 dummy_disk,
54 "-drive",
55 &format!("file={dummy_disk},if=none,id=hd1,format=raw,readonly=on"),
56 "-device",
57 "virtio-blk-pci,drive=hd1",
58 "-netdev",
59 "user,id=net0",
60 "-device",
61 "virtio-net-pci,netdev=net0",
62 "-object",
63 "tdx-guest,id=tdx",
64 "-device",
65 "vhost-vsock-pci,guest-cid=3",
66 ]);
67
68 // Configure shared files delivery: either via disk or 9p
69 match self.host_share_mode.as_str() {
70 "" | "9p" => {
71 // Use 9p virtfs (default)
72 cmd.args([
73 "-virtfs",
74 &format!(
75 "local,path={shared_dir},mount_tag=host-shared,readonly=on,security_model=none,id=virtfs0",
76 ),
77 ]);
78 }
79 "vvfat" | "vhd" => {
80 // Use a second virtual disk (hd2) to share files
81 cmd.args([
82 "-drive",

Callers 1

build_tablesMethod · 0.80

Calls 2

versioned_optionsMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected