isothrum_machine/providers.rs
1//! The Vagrant providers (hypervisors) this computer can drive, and detecting which are usable.
2//! Vagrant abstracts the hypervisor; this detects what is installed here, what is still missing
3//! for Vagrant to drive it ([`Need`]), and when it can't run VMs yet, why ([`Unavailable`], a code
4//! a UI translates), and right before a start whether it is ready now ([`ready`]: UTM open and
5//! answering, QEMU's emulator for a foreign CPU).
6//!
7//! Each provider is one row ([`ProviderRow::of`]): where it runs, how its hypervisor is found, the
8//! versions it is held to. Every tool runs through the [`Context`]'s runner, within its probe time
9//! limit; the files read instead (KVM's device, the kernel's modules, UTM's bundle, Hyper-V's
10//! service) are the [`Host`]'s [`Devices`](crate::Devices). Whether this account may manage
11//! Hyper-V is the runner's own check ([`isothrum_runner::may_manage_hyperv`], `whoami /groups`),
12//! the one it decides an elevated session by.
13
14use serde::{Deserialize, Serialize};
15
16use crate::context::Context;
17use crate::exec;
18use crate::host::{Arch, Host, HostOs};
19
20/// A Vagrant provider (the value given to `vagrant up --provider`).
21pub use isothrum_runner::Provider;
22
23mod found;
24pub(crate) mod helper;
25mod hyperv;
26pub(crate) mod kvm;
27mod needs;
28pub mod ready;
29mod reasons;
30mod unavailable;
31mod vbox;
32pub(crate) mod virtiofsd;
33#[cfg(test)]
34use reasons::hypervisor_too_old;
35use reasons::{plugin_too_old, unavailable_reason};
36
37use found::{Found, hypervisor_found, hypervisor_version};
38pub use helper::{Helper, helpers};
39pub use kvm::{groups_pending, kvm_group, login_groups, uses_kvm};
40pub use needs::{Need, UtilityState, needs, vmware_utility};
41pub use unavailable::Unavailable;
42pub use virtiofsd::{needs_virtiofsd, virtiofsd};
43
44/// How this computer tells a provider's hypervisor is installed.
45#[derive(Debug, Clone, Copy, PartialEq, Eq)]
46enum Check {
47 /// A tool that proves it: installed as long as it starts.
48 Tool(&'static str, &'static [&'static str]),
49 /// QEMU's system emulator for this machine's CPU ([`qemu_system`](crate::host::qemu_system)).
50 Qemu,
51 /// UTM's app bundle ([`crate::Devices::utm_app`]), which also says its version.
52 UtmApp,
53 /// The Hyper-V Windows feature ([`crate::Devices::hyperv_service`]).
54 HypervFeature,
55 /// Nothing local to check: a remote hypervisor.
56 Remote,
57}
58
59/// A provider's row of the hypervisor table ([`ProviderRow::of`]): where it runs, where its VMs
60/// share a folder of this computer, where its vendor offers it, the versions it is held to, and
61/// how its hypervisor is found.
62#[derive(Debug, Clone, Copy, PartialEq, Eq)]
63#[non_exhaustive]
64pub struct ProviderRow {
65 /// The OSes it exists on.
66 pub oses: &'static [HostOs],
67 /// Whether it is built for Windows on Arm.
68 pub windows_on_arm: bool,
69 /// The Mac CPU it is made for, when it is made for one: offered on the other only once
70 /// installed ([`offered`]).
71 pub mac_cpu: Option<Arch>,
72 /// The Linux CPU its vendor ships it for, when it ships for one only: offered on the other
73 /// only once installed ([`offered`]), as a setup can't install it there.
74 pub linux_cpu: Option<Arch>,
75 /// Where its vendor offers it, when a setup doesn't install it (behind a login, a licence, or
76 /// a Windows feature the user turns on by hand).
77 pub vendor: Option<crate::install::VendorPage>,
78 /// The OSes where its VMs share a folder of this computer two-way.
79 pub shares_folders: &'static [HostOs],
80 /// The oldest version of its plugin that works: `vagrant_utm` before 0.2.0 reads a VM's
81 /// forwarded ports through a script UTM refuses (`-600`, `-1743`) and has no `started` state.
82 pub plugin_minimum: Option<&'static str>,
83 /// Its hypervisor's name and the oldest version its plugin drives: `vagrant_utm` refuses a UTM
84 /// before 4.6.5 (no import of a box, no registry for its shared folders).
85 pub hypervisor_minimum: Option<(&'static str, &'static str)>,
86 /// How its hypervisor is found.
87 check: Check,
88}
89
90/// Microsoft's guide to turning Hyper-V on by hand (a setup turns it on itself).
91const HYPERV_PAGE: crate::install::VendorPage = crate::install::VendorPage {
92 name: "Microsoft",
93 url: "https://learn.microsoft.com/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v",
94};
95
96/// Parallels Desktop's page, which sells and downloads it.
97const PARALLELS_PAGE: crate::install::VendorPage = crate::install::VendorPage {
98 name: "Parallels",
99 url: "https://www.parallels.com/products/desktop/",
100};
101
102impl ProviderRow {
103 /// `provider`'s row: a provider added to the type is a compile error here until its row says
104 /// where it runs.
105 #[must_use]
106 pub fn of(provider: Provider) -> ProviderRow {
107 // A hypervisor built for every OS and CPU, its VMs sharing a folder two-way, held to no
108 // version; each row says how it differs.
109 const EVERYWHERE: ProviderRow = ProviderRow {
110 oses: &crate::host::ALL_OSES,
111 windows_on_arm: true,
112 mac_cpu: None,
113 linux_cpu: None,
114 vendor: None,
115 shares_folders: &crate::host::ALL_OSES,
116 plugin_minimum: None,
117 hypervisor_minimum: None,
118 check: Check::Remote,
119 };
120 const fn found_by(check: Check) -> ProviderRow {
121 ProviderRow { check, ..EVERYWHERE }
122 }
123 match provider {
124 // Neither ships for Windows on Arm (no installer, no Arm VMs there). VirtualBox runs a
125 // Mac's VMs on Intel only, and Oracle's Linux packages (its apt and rpm repositories)
126 // are for x86-64 only.
127 Provider::Virtualbox => ProviderRow {
128 windows_on_arm: false,
129 mac_cpu: Some(Arch::Amd64),
130 linux_cpu: Some(Arch::Amd64),
131 ..found_by(Check::Tool("VBoxManage", &["--version"]))
132 },
133 // VMware Workstation for Linux is built for x86-64 only.
134 Provider::VmwareDesktop => ProviderRow {
135 windows_on_arm: false,
136 linux_cpu: Some(Arch::Amd64),
137 vendor: Some(crate::install::BROADCOM_DOWNLOADS),
138 ..found_by(Check::Tool("vmrun", &[]))
139 },
140 // Hyper-V's SMB folders ask for a password at every start.
141 Provider::Hyperv => ProviderRow {
142 oses: &[HostOs::Windows],
143 vendor: Some(HYPERV_PAGE),
144 shares_folders: &[],
145 ..found_by(Check::HypervFeature)
146 },
147 Provider::Parallels => ProviderRow {
148 oses: &[HostOs::Macos],
149 vendor: Some(PARALLELS_PAGE),
150 ..found_by(Check::Tool("prlctl", &["--version"]))
151 },
152 // UTM is the hypervisor made for Apple silicon.
153 Provider::Utm => ProviderRow {
154 oses: &[HostOs::Macos],
155 mac_cpu: Some(Arch::Arm64),
156 plugin_minimum: Some("0.2.0"),
157 hypervisor_minimum: Some(("UTM", "4.6.5")),
158 ..found_by(Check::UtmApp)
159 },
160 Provider::Libvirt => ProviderRow {
161 oses: &[HostOs::Linux],
162 ..found_by(Check::Tool("virsh", &["--version"]))
163 },
164 // vagrant-qemu builds a networked VM's cloud-init seed with `oscdimg` on Windows (the
165 // Windows ADK's, which no setup brings), so it is offered on Linux and macOS only; it
166 // shares a folder two-way through virtiofsd ([`helpers`]), on Linux only.
167 Provider::Qemu => ProviderRow {
168 oses: &[HostOs::Macos, HostOs::Linux],
169 shares_folders: &[HostOs::Linux],
170 ..found_by(Check::Qemu)
171 },
172 // A server: reached from any computer, sharing none of its folders.
173 Provider::VmwareEsxi => ProviderRow {
174 shares_folders: &[],
175 ..EVERYWHERE
176 },
177 }
178 }
179
180 /// Whether it runs VMs on another computer: nothing of it is installed here.
181 #[must_use]
182 pub fn remote(&self) -> bool {
183 self.check == Check::Remote
184 }
185}
186
187/// Where `provider`'s user downloads it themselves on `os`, when a setup doesn't install it: its
188/// row's vendor page, VMware's own product's on each OS (Fusion Pro on macOS, Workstation Pro
189/// elsewhere).
190#[must_use]
191pub fn download_page(provider: Provider, os: HostOs) -> Option<crate::install::VendorPage> {
192 match (provider, os) {
193 (Provider::VmwareDesktop, HostOs::Macos) => Some(crate::install::VMWARE_FUSION_PAGE),
194 (Provider::VmwareDesktop, _) => Some(crate::install::VMWARE_WORKSTATION_PAGE),
195 _ => ProviderRow::of(provider).vendor,
196 }
197}
198
199/// Whether `provider` can run on `host` at all: on its OS, and on Windows on Arm, built for it.
200/// Remote ones apply anywhere.
201#[must_use]
202pub fn applicable(provider: Provider, host: &Host) -> bool {
203 let row = ProviderRow::of(provider);
204 row.oses.contains(&host.os) && (row.windows_on_arm || !host.is_windows_on_arm())
205}
206
207/// Whether `provider` is offered on `host` for VMs: applicable there, and built for its CPU: on a
208/// Mac, the hypervisor made for its CPU (UTM on Apple silicon, VirtualBox on an Intel Mac); on
209/// Linux, one its vendor ships for that CPU (VirtualBox and VMware Workstation on x86-64 only). One already `installed` is
210/// offered wherever it applies: the user chose it.
211#[must_use]
212pub fn offered(provider: Provider, host: &Host, installed: bool) -> bool {
213 let row = ProviderRow::of(provider);
214 let cpu = match host.os {
215 HostOs::Macos => row.mac_cpu,
216 HostOs::Linux => row.linux_cpu,
217 HostOs::Windows => None,
218 };
219 applicable(provider, host) && (installed || cpu.is_none_or(|cpu| cpu == host.arch))
220}
221
222/// Whether Vagrant drives `provider` through HashiCorp's Vagrant VMware Utility, a system service
223/// of its own (installed apart from the plugin, by an administrator) that the
224/// `vagrant-vmware-desktop` plugin asks to run VMware: without it every `vagrant up` fails.
225#[must_use]
226pub fn needs_vmware_utility(provider: Provider) -> bool {
227 provider == Provider::VmwareDesktop
228}
229
230/// The local tool that proves `provider`'s hypervisor is installed on a CPU `arch`, if one does:
231/// for a setup's install of it too ([`crate::install::present`]), so both read it alike.
232#[must_use]
233pub fn hypervisor_probe(provider: Provider, arch: Arch) -> Option<(&'static str, &'static [&'static str])> {
234 match ProviderRow::of(provider).check {
235 Check::Tool(program, args) => Some((program, args)),
236 Check::Qemu => Some((crate::host::qemu_system(arch), &["--version"])),
237 Check::UtmApp | Check::HypervFeature | Check::Remote => None,
238 }
239}
240
241/// What the account lacks to use a provider installed here.
242#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
243#[cfg_attr(any(test, feature = "ts-rs"), derive(ts_rs::TS))]
244#[serde(rename_all = "camelCase")]
245#[non_exhaustive]
246pub enum AccountLacks {
247 /// The right to manage Hyper-V (Hyper-V only).
248 HypervAdmin,
249 /// A new login: it joined libvirt's groups, or `/dev/kvm`'s (QEMU on Linux), since logging
250 /// in.
251 NewLogin,
252}
253
254/// One provider's readiness on this machine: whether VMs can run on it here, and what is still
255/// missing.
256#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
257#[cfg_attr(any(test, feature = "ts-rs"), derive(ts_rs::TS))]
258#[serde(rename_all = "camelCase")]
259#[non_exhaustive]
260pub struct ProviderStatus {
261 /// The provider.
262 pub provider: Provider,
263 /// A server, run elsewhere: nothing of it is installed here.
264 pub remote: bool,
265 /// Whether VMs can run on it now (`reason` says why not).
266 pub available: bool,
267 /// Whether the hypervisor itself is installed (for Hyper-V, whether the Windows feature is
268 /// on; for libvirt and QEMU on Linux, with the programs their VMs need beside them,
269 /// [`helpers`]: `mkisofs`, virtiofsd).
270 /// `None` where nothing local is checked: a server.
271 pub hypervisor: Option<bool>,
272 /// The Vagrant plugin it needs, if it is not built in.
273 pub plugin: Option<String>,
274 /// Whether that plugin is installed at a version that works (true when the provider is built
275 /// in): an older one reads as not installed, so a setup installs it again, which updates it.
276 pub plugin_installed: bool,
277 /// Where HashiCorp's Vagrant VMware Utility stands; `None` when the provider doesn't use it.
278 pub utility: Option<UtilityState>,
279 /// What is still to install for Vagrant to drive it here ([`needs()`]): empty when nothing is.
280 pub needs: Vec<Need>,
281 /// Why it can't run VMs yet, `None` when it can.
282 pub reason: Option<Unavailable>,
283 /// What this account lacks to use it although it is installed (the right to manage Hyper-V,
284 /// a new login after joining libvirt's groups), whatever else is missing.
285 #[cfg_attr(any(test, feature = "ts-rs"), ts(optional = nullable))]
286 pub account_lacks: Option<AccountLacks>,
287}
288
289/// The readiness of every provider offered on the context's host ([`offered`]), usable or not, in
290/// the provider type's order. Without Vagrant (`vagrant_installed`, the caller's to know) the
291/// hypervisors are still probed, and each status says Vagrant is needed.
292pub async fn detect(cx: &Context, vagrant_installed: bool) -> Vec<ProviderStatus> {
293 let mut asked = Asked::of(cx, vagrant_installed).await;
294 let mut statuses = Vec::new();
295 for provider in Provider::ALL {
296 statuses.extend(detect_one(cx, provider, &mut asked).await);
297 }
298 statuses
299}
300
301/// `provider`'s status as [`detect`] gives it, checked alone, Vagrant asked whether it is
302/// installed (`vagrant --version`): `None` when it isn't offered on the context's host.
303pub async fn status(cx: &Context, provider: Provider) -> Option<ProviderStatus> {
304 let vagrant_installed = cx.read_ok("vagrant", &["--version"]).await.is_ok();
305 let mut asked = Asked::of(cx, vagrant_installed).await;
306 detect_one(cx, provider, &mut asked).await
307}
308
309/// What detection asks of the machine once for every provider.
310struct Asked {
311 /// Whether Vagrant is installed.
312 vagrant_installed: bool,
313 /// The Vagrant plugins installed, each with its version when it says one; why they can't be
314 /// listed when `vagrant plugin list` fails (not "none": a plugin that is there would read as
315 /// missing). None listed without Vagrant.
316 plugins: Result<Vec<(String, Option<String>)>, String>,
317 /// The groups this account joined since logging in, once a provider asked.
318 pending_groups: Option<Vec<String>>,
319 /// Whether VMware's Vagrant plugin is installed without the VMware Utility, once a provider
320 /// asked ([`Asked::vmware_plugin_without_utility`]).
321 vmware_plugin_alone: Option<bool>,
322}
323
324impl Asked {
325 /// The plugins asked of Vagrant when it is installed.
326 async fn of(cx: &Context, vagrant_installed: bool) -> Asked {
327 let plugins = if vagrant_installed {
328 cx.read_ok("vagrant", &["plugin", "list", "--machine-readable"])
329 .await
330 .map(|out| isothrum_runner::vagrant_plugins(&out))
331 } else {
332 Ok(Vec::new())
333 };
334 Asked {
335 vagrant_installed,
336 plugins,
337 pending_groups: None,
338 vmware_plugin_alone: None,
339 }
340 }
341
342 /// Whether VMware's Vagrant plugin is installed without the Vagrant VMware Utility installed
343 /// (one installed but stopped still has its key file, which is all Vagrant loads of it): then
344 /// every Vagrant command fails, whatever its provider. Asked the first time.
345 async fn vmware_plugin_without_utility(&mut self, cx: &Context) -> bool {
346 if !self.vagrant_installed {
347 return false;
348 }
349 if self.vmware_plugin_alone.is_none() {
350 let plugin = Provider::VmwareDesktop.plugin().and_then(|p| self.plugin(p)).is_some();
351 self.vmware_plugin_alone = Some(plugin && vmware_utility(&cx.host).await == UtilityState::Missing);
352 }
353 self.vmware_plugin_alone == Some(true)
354 }
355
356 /// The groups this account joined since logging in, asked the first time.
357 async fn pending_groups(&mut self, cx: &Context) -> &[String] {
358 if self.pending_groups.is_none() {
359 self.pending_groups = Some(kvm::groups_pending(cx).await);
360 }
361 self.pending_groups.as_deref().unwrap_or_default()
362 }
363
364 /// `plugin`'s entry (its name and version, when it says one), when it is listed.
365 fn plugin(&self, plugin: &str) -> Option<&(String, Option<String>)> {
366 let listed = self.plugins.as_deref().unwrap_or_default();
367 listed.iter().find(|(name, _)| name == plugin)
368 }
369}
370
371/// One provider's status: `None` when it isn't offered on the context's host.
372async fn detect_one(cx: &Context, provider: Provider, asked: &mut Asked) -> Option<ProviderStatus> {
373 if !applicable(provider, &cx.host) {
374 return None;
375 }
376 let found = hypervisor_found(cx, provider).await;
377 if !offered(provider, &cx.host, found.installed == Some(true)) {
378 return None;
379 }
380 let findings = findings(cx, provider, found, asked).await;
381 Some(status_from(provider, asked.vagrant_installed, &findings))
382}
383
384/// What the account lacks, as detection found it.
385#[derive(Debug, Clone, PartialEq, Eq)]
386enum Account {
387 /// The right to manage Hyper-V.
388 HypervAdmin,
389 /// A new login, for the group it joined.
390 NewLogin(String),
391}
392
393/// What detection found out about one provider beyond its hypervisor: the facts
394/// [`unavailable_reason`] reads to name the first layer missing. Every probe is [`findings`]',
395/// so the reason is decided without one.
396#[derive(Debug, Clone, Default)]
397struct Findings {
398 /// KVM holds the CPU's virtualization (VirtualBox only): said before anything else.
399 held: Option<Unavailable>,
400 /// Whether the hypervisor's background service is wedged (a probe call timed out).
401 unresponsive: bool,
402 /// Whether the hypervisor is installed; `None` when there is nothing local to probe.
403 hypervisor: Option<bool>,
404 /// A program the hypervisor's VMs need beside it ([`helpers`]), which it is there without,
405 /// so `hypervisor` reads false.
406 helper_missing: Option<Helper>,
407 /// The program whose absence says the hypervisor isn't installed, when one does.
408 program: Option<&'static str>,
409 /// The hypervisor's version, when it is installed and held to one (UTM).
410 hypervisor_version: Option<String>,
411 /// The Vagrant plugin it needs, if it is not built in.
412 plugin: Option<&'static str>,
413 /// That plugin's installed version, when it is listed with one.
414 plugin_version: Option<String>,
415 /// Whether that plugin is installed, at a version that works.
416 plugin_installed: bool,
417 /// Why the plugins couldn't be listed, when `vagrant plugin list` failed.
418 plugins_unknown: Option<String>,
419 /// Where the Vagrant VMware Utility stands; `None` when the provider doesn't use it.
420 utility: Option<UtilityState>,
421 /// What this account lacks to use it, if anything.
422 account: Option<Account>,
423 /// VMware's Vagrant plugin is installed without the VMware Utility, which breaks Vagrant for
424 /// every provider ([`Unavailable::VmwarePluginWithoutUtility`]).
425 vmware_plugin_alone: bool,
426 /// What keeps the installed hypervisor from starting a VM on this machine: KVM's device for
427 /// libvirt and QEMU on Linux, Windows' hypervisor for Hyper-V.
428 platform: Option<Unavailable>,
429 /// VirtualBox's kernel driver not loaded: said last, once nothing else is missing.
430 driver: Option<Unavailable>,
431}
432
433/// Everything detection asks of the machine about `provider`, whose hypervisor probe `found`.
434async fn findings(cx: &Context, provider: Provider, found: Found, asked: &mut Asked) -> Findings {
435 let host = &cx.host;
436 let helper_missing = if found.installed == Some(true) {
437 helper::missing(cx, provider).await
438 } else {
439 None
440 };
441 let hypervisor = if helper_missing.is_some() { Some(false) } else { found.installed };
442 let ready = hypervisor == Some(true);
443 let virtualbox = provider == Provider::Virtualbox;
444 let plugin = provider.plugin();
445 let listed = plugin.and_then(|p| asked.plugin(p));
446 let plugin_version = listed.and_then(|(_, version)| version.clone());
447 Findings {
448 held: (virtualbox && kvm::holds_virtualization(host)).then(|| {
449 if kvm::shares_from_next_load(host) {
450 Unavailable::KvmSharesAfterRestart
451 } else {
452 Unavailable::KvmHoldsVirtualization
453 }
454 }),
455 unresponsive: asked.vagrant_installed && virtualbox && ready && vbox::wedged(cx).await,
456 hypervisor,
457 helper_missing,
458 program: hypervisor_probe(provider, host.arch).map(|(program, _)| program),
459 hypervisor_version: if ready { hypervisor_version(cx, provider).await } else { None },
460 plugin,
461 plugin_installed: plugin.is_none() || (asked.vagrant_installed && listed.is_some() && plugin_too_old(provider, plugin_version.as_deref()).is_none()),
462 plugin_version,
463 plugins_unknown: asked.plugins.as_ref().err().cloned(),
464 utility: utility_of(provider, host).await,
465 account: if ready { account_lacks(cx, provider, asked).await } else { None },
466 vmware_plugin_alone: asked.vmware_plugin_without_utility(cx).await,
467 platform: if ready { platform_problem(cx, provider).await } else { None },
468 driver: if virtualbox && ready {
469 vbox::driver_problem(cx, &found.said).await
470 } else {
471 None
472 },
473 }
474}
475
476/// Where the Vagrant VMware Utility stands for `provider` on `host`; `None` when it doesn't use it.
477async fn utility_of(provider: Provider, host: &Host) -> Option<UtilityState> {
478 if needs_vmware_utility(provider) {
479 Some(vmware_utility(host).await)
480 } else {
481 None
482 }
483}
484
485/// What this account lacks to use `provider`, installed: the right to manage Hyper-V (when the
486/// runner's check says it may not; no answer adds nothing), or a new login after joining the
487/// groups it is used through.
488async fn account_lacks(cx: &Context, provider: Provider, asked: &mut Asked) -> Option<Account> {
489 if provider == Provider::Hyperv && hyperv::needs_admin(cx).await {
490 return Some(Account::HypervAdmin);
491 }
492 let joined = login_groups(provider, &cx.host);
493 if joined.is_empty() {
494 return None;
495 }
496 let pending = asked.pending_groups(cx).await;
497 joined
498 .iter()
499 .any(|g| pending.contains(g))
500 .then(|| Account::NewLogin(kvm::new_login_group(provider, &cx.host)))
501}
502
503/// What keeps `provider`'s installed hypervisor from starting a VM on the context's host: KVM's
504/// device (libvirt, QEMU on Linux), Windows' hypervisor (Hyper-V). `None` when nothing does.
505async fn platform_problem(cx: &Context, provider: Provider) -> Option<Unavailable> {
506 if uses_kvm(provider, cx.host.os) {
507 kvm::kvm_problem(&cx.host)
508 } else if provider == Provider::Hyperv {
509 hyperv::hypervisor_stopped(cx).await
510 } else {
511 None
512 }
513}
514
515/// The status `provider` gets from what was found of it, given whether Vagrant is installed.
516fn status_from(provider: Provider, vagrant_installed: bool, findings: &Findings) -> ProviderStatus {
517 let needs = needs(vagrant_installed, findings.plugin_installed, findings.utility);
518 let reason = unavailable_reason(provider, &needs, findings);
519 ProviderStatus {
520 provider,
521 remote: ProviderRow::of(provider).remote(),
522 available: reason.is_none(),
523 hypervisor: findings.hypervisor,
524 plugin: findings.plugin.map(str::to_owned),
525 plugin_installed: findings.plugin_installed,
526 utility: findings.utility,
527 needs,
528 reason,
529 account_lacks: findings.account.as_ref().map(|account| match account {
530 Account::HypervAdmin => AccountLacks::HypervAdmin,
531 Account::NewLogin(_) => AccountLacks::NewLogin,
532 }),
533 }
534}
535
536#[cfg(test)]
537mod tests;