Skip to content

Commit 776edcf

Browse files
committed
Only start network plugin if report_nics is enabled
Signed-off-by: Teddy Astie <[email protected]>
1 parent 6f28b67 commit 776edcf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

xen-guest-agent/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ pub(crate) async fn run_async(config: &GuestAgentConfig) -> anyhow::Result<JoinS
5959

6060
set.spawn(publisher.run(rx));
6161

62-
// Remove old entries from previous agent to avoid having unknown
63-
// interfaces. We will repopulate existing ones immediatly.
64-
tx.send(GuestMetric::CleanupIfaces).await?;
62+
if config.report_nics {
63+
// Remove old entries from previous agent to avoid having unknown
64+
// interfaces. We will repopulate existing ones immediatly.
65+
tx.send(GuestMetric::CleanupIfaces).await?;
66+
set.spawn(NetworkPlugin::new(config.network)?.run(tx.clone()));
67+
}
6568

6669
set.spawn(provider_os::OsInfoPlugin.run(tx.clone()));
6770
set.spawn(provider_memory::MemoryPlugin.run(tx.clone()));
68-
set.spawn(NetworkPlugin::new(config.network)?.run(tx.clone()));
6971

7072
Ok(set)
7173
}

0 commit comments

Comments
 (0)