Skip to content

Commit

Permalink
runtime-rs: Fix constructing the RTC struct
Browse files Browse the repository at this point in the history
RTC was being built in a wrong fashion on commit #2bc5e3c6e2ab0145fa9e8be95df0d5086c07a517

RTC was being constructed inside the QemuCmdLine struct,
but it should've been built inside the devices vector.

Signed-off-by: Emanuel Lima <emlima@redhat.com>
  • Loading branch information
emanuellima1 committed May 9, 2024
1 parent 1dd06cf commit 59c1567
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/runtime-rs/crates/hypervisor/src/qemu/cmdline_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,6 @@ pub struct QemuCmdLine<'a> {
smp: Smp,
machine: Machine,
cpu: Cpu,
rtc: Rtc,

knobs: Knobs,

Expand All @@ -1229,7 +1228,6 @@ impl<'a> QemuCmdLine<'a> {
smp: Smp::new(config),
machine: Machine::new(config),
cpu: Cpu::new(config),
rtc: Rtc::new(),
knobs: Knobs::new(config),
devices: Vec::new(),
};
Expand All @@ -1238,9 +1236,16 @@ impl<'a> QemuCmdLine<'a> {
qemu_cmd_line.add_iommu();
}

qemu_cmd_line.add_rtc();

Ok(qemu_cmd_line)
}

fn add_rtc(&mut self) {
let rtc = Rtc::new();
self.devices.push(Box::new(rtc));
}

fn bus_type(&self) -> VirtioBusType {
if self.config.machine_info.machine_type.contains("-ccw-") {
VirtioBusType::Ccw
Expand Down Expand Up @@ -1432,7 +1437,6 @@ impl<'a> QemuCmdLine<'a> {
result.append(&mut self.machine.qemu_params().await?);
result.append(&mut self.cpu.qemu_params().await?);
result.append(&mut self.memory.qemu_params().await?);
result.append(&mut self.rtc.qemu_params().await?);

for device in &self.devices {
result.append(&mut device.qemu_params().await?);
Expand Down

0 comments on commit 59c1567

Please sign in to comment.