5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2024-12-22 13:34:16 +03:00

config: remove unnecessary pub in various methods in NetworkConfig

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Stefan Lendl 2024-04-04 12:00:33 +02:00 committed by Thomas Lamprecht
parent b276acf7ba
commit 405ad7c825
2 changed files with 7 additions and 7 deletions

View File

@ -251,7 +251,7 @@ impl NetworkConfig {
} }
/// Check if ports are used only once /// Check if ports are used only once
pub fn check_port_usage(&self) -> Result<(), Error> { fn check_port_usage(&self) -> Result<(), Error> {
let mut used_ports = HashMap::new(); let mut used_ports = HashMap::new();
let mut check_port_usage = |iface, ports: &Vec<String>| { let mut check_port_usage = |iface, ports: &Vec<String>| {
for port in ports.iter() { for port in ports.iter() {
@ -280,7 +280,7 @@ impl NetworkConfig {
} }
/// Check if child mtu is less or equal than parent mtu /// Check if child mtu is less or equal than parent mtu
pub fn check_mtu(&self, parent_name: &str, child_name: &str) -> Result<(), Error> { fn check_mtu(&self, parent_name: &str, child_name: &str) -> Result<(), Error> {
let parent = self let parent = self
.interfaces .interfaces
.get(parent_name) .get(parent_name)
@ -320,7 +320,7 @@ impl NetworkConfig {
} }
/// Check if bond slaves exists /// Check if bond slaves exists
pub fn check_bond_slaves(&self) -> Result<(), Error> { fn check_bond_slaves(&self) -> Result<(), Error> {
for (iface, interface) in self.interfaces.iter() { for (iface, interface) in self.interfaces.iter() {
if let Some(slaves) = &interface.slaves { if let Some(slaves) = &interface.slaves {
for slave in slaves.iter() { for slave in slaves.iter() {
@ -348,7 +348,7 @@ impl NetworkConfig {
} }
/// Check if bridge ports exists /// Check if bridge ports exists
pub fn check_bridge_ports(&self) -> Result<(), Error> { fn check_bridge_ports(&self) -> Result<(), Error> {
lazy_static! { lazy_static! {
static ref VLAN_INTERFACE_REGEX: Regex = Regex::new(r"^(\S+)\.(\d+)$").unwrap(); static ref VLAN_INTERFACE_REGEX: Regex = Regex::new(r"^(\S+)\.(\d+)$").unwrap();
} }
@ -372,7 +372,7 @@ impl NetworkConfig {
Ok(()) Ok(())
} }
pub fn write_config(&self, w: &mut dyn Write) -> Result<(), Error> { fn write_config(&self, w: &mut dyn Write) -> Result<(), Error> {
self.check_port_usage()?; self.check_port_usage()?;
self.check_bond_slaves()?; self.check_bond_slaves()?;
self.check_bridge_ports()?; self.check_bridge_ports()?;

View File

@ -487,11 +487,11 @@ impl<R: BufRead> NetworkParser<R> {
&mut self, &mut self,
existing_interfaces: Option<&HashMap<String, bool>>, existing_interfaces: Option<&HashMap<String, bool>>,
) -> Result<NetworkConfig, Error> { ) -> Result<NetworkConfig, Error> {
self._parse_interfaces(existing_interfaces) self.do_parse_interfaces(existing_interfaces)
.map_err(|err| format_err!("line {}: {}", self.line_nr, err)) .map_err(|err| format_err!("line {}: {}", self.line_nr, err))
} }
pub fn _parse_interfaces( fn do_parse_interfaces(
&mut self, &mut self,
existing_interfaces: Option<&HashMap<String, bool>>, existing_interfaces: Option<&HashMap<String, bool>>,
) -> Result<NetworkConfig, Error> { ) -> Result<NetworkConfig, Error> {