vm: Rename DeviceManager field in Vm structure

It's more logical to name the field referring to the DeviceManager as
"device_manager" instead of "devices".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-03-04 14:39:15 +01:00
parent aa638ead42
commit 948f808da6

View File

@@ -215,7 +215,7 @@ impl VmState {
pub struct Vm { pub struct Vm {
kernel: File, kernel: File,
threads: Vec<thread::JoinHandle<()>>, threads: Vec<thread::JoinHandle<()>>,
devices: Arc<Mutex<DeviceManager>>, device_manager: Arc<Mutex<DeviceManager>>,
config: Arc<Mutex<VmConfig>>, config: Arc<Mutex<VmConfig>>,
on_tty: bool, on_tty: bool,
signals: Option<Signals>, signals: Option<Signals>,
@@ -376,7 +376,7 @@ impl Vm {
Ok(Vm { Ok(Vm {
kernel, kernel,
devices: device_manager, device_manager,
config, config,
on_tty, on_tty,
threads: Vec::with_capacity(1), threads: Vec::with_capacity(1),
@@ -393,7 +393,7 @@ impl Vm {
cmdline cmdline
.insert_str(self.config.lock().unwrap().cmdline.args.clone()) .insert_str(self.config.lock().unwrap().cmdline.args.clone())
.map_err(Error::CmdLineInsertStr)?; .map_err(Error::CmdLineInsertStr)?;
for entry in self.devices.lock().unwrap().cmdline_additions() { for entry in self.device_manager.lock().unwrap().cmdline_additions() {
cmdline.insert_str(entry).map_err(Error::CmdLineInsertStr)?; cmdline.insert_str(entry).map_err(Error::CmdLineInsertStr)?;
} }
@@ -435,7 +435,7 @@ impl Vm {
{ {
rsdp_addr = Some(crate::acpi::create_acpi_tables( rsdp_addr = Some(crate::acpi::create_acpi_tables(
mem.deref(), mem.deref(),
&self.devices, &self.device_manager,
&self.cpu_manager, &self.cpu_manager,
&self.memory_manager, &self.memory_manager,
)); ));
@@ -521,7 +521,7 @@ impl Vm {
.resize(desired_vcpus) .resize(desired_vcpus)
.map_err(Error::CpuManager)? .map_err(Error::CpuManager)?
{ {
self.devices self.device_manager
.lock() .lock()
.unwrap() .unwrap()
.notify_hotplug(HotPlugNotificationFlags::CPU_DEVICES_CHANGED) .notify_hotplug(HotPlugNotificationFlags::CPU_DEVICES_CHANGED)
@@ -538,7 +538,7 @@ impl Vm {
.resize(desired_memory) .resize(desired_memory)
.map_err(Error::MemoryManager)? .map_err(Error::MemoryManager)?
{ {
self.devices self.device_manager
.lock() .lock()
.unwrap() .unwrap()
.notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED) .notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED)
@@ -554,7 +554,7 @@ impl Vm {
#[cfg(feature = "pci_support")] #[cfg(feature = "pci_support")]
{ {
let device_cfg = self let device_cfg = self
.devices .device_manager
.lock() .lock()
.unwrap() .unwrap()
.add_device(_path) .add_device(_path)
@@ -571,7 +571,7 @@ impl Vm {
} }
} }
self.devices self.device_manager
.lock() .lock()
.unwrap() .unwrap()
.notify_hotplug(HotPlugNotificationFlags::PCI_DEVICES_CHANGED) .notify_hotplug(HotPlugNotificationFlags::PCI_DEVICES_CHANGED)
@@ -621,8 +621,8 @@ impl Vm {
.start_boot_vcpus(entry_addr) .start_boot_vcpus(entry_addr)
.map_err(Error::CpuManager)?; .map_err(Error::CpuManager)?;
if self.devices.lock().unwrap().console().input_enabled() { if self.device_manager.lock().unwrap().console().input_enabled() {
let console = self.devices.lock().unwrap().console().clone(); let console = self.device_manager.lock().unwrap().console().clone();
let signals = Signals::new(&[SIGWINCH, SIGINT, SIGTERM]); let signals = Signals::new(&[SIGWINCH, SIGINT, SIGTERM]);
match signals { match signals {
Ok(signals) => { Ok(signals) => {
@@ -660,8 +660,8 @@ impl Vm {
.read_raw(&mut out) .read_raw(&mut out)
.map_err(Error::Console)?; .map_err(Error::Console)?;
if self.devices.lock().unwrap().console().input_enabled() { if self.device_manager.lock().unwrap().console().input_enabled() {
self.devices self.device_manager
.lock() .lock()
.unwrap() .unwrap()
.console() .console()
@@ -699,7 +699,7 @@ impl Pausable for Vm {
.map_err(|e| MigratableError::Pause(anyhow!("Invalid transition: {:?}", e)))?; .map_err(|e| MigratableError::Pause(anyhow!("Invalid transition: {:?}", e)))?;
self.cpu_manager.lock().unwrap().pause()?; self.cpu_manager.lock().unwrap().pause()?;
self.devices.lock().unwrap().pause()?; self.device_manager.lock().unwrap().pause()?;
*state = new_state; *state = new_state;
@@ -717,7 +717,7 @@ impl Pausable for Vm {
.valid_transition(new_state) .valid_transition(new_state)
.map_err(|e| MigratableError::Pause(anyhow!("Invalid transition: {:?}", e)))?; .map_err(|e| MigratableError::Pause(anyhow!("Invalid transition: {:?}", e)))?;
self.devices.lock().unwrap().resume()?; self.device_manager.lock().unwrap().resume()?;
self.cpu_manager.lock().unwrap().resume()?; self.cpu_manager.lock().unwrap().resume()?;
// And we're back to the Running state. // And we're back to the Running state.