Skip to content

Commit

Permalink
use the same naming as linux
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jan 11, 2024
1 parent 7e9b248 commit 68d5518
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/propolis-server/src/lib/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<'a> MachineInitializer<'a> {
uuid: uuid::Uuid,
) -> Result<(), anyhow::Error> {
if let Some(ref spec) = self.spec.devices.qemu_pvpanic {
if spec.enable_isa {
if spec.enable_mmio {
let pvpanic = QemuPvpanic::create(
self.log.new(slog::o!("dev" => "qemu-pvpanic")),
);
Expand Down
1 change: 1 addition & 0 deletions bin/propolis-server/src/lib/stats/pvpanic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl Producer for PvpanicProducer {

self.host_handled_panics.datum_mut().set(host_handled as i64);
self.guest_handled_panics.datum_mut().set(guest_handled as i64);

let data = vec![
Sample::new(&self.stat_name, &self.guest_handled_panics)?,
Sample::new(&self.stat_name, &self.host_handled_panics)?,
Expand Down
6 changes: 3 additions & 3 deletions bin/propolis-standalone/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,12 @@ fn setup_instance(
chipset.pci_attach(bdf, nvme);
}
qemu::pvpanic::DEVICE_NAME => {
let enable_isa = dev
let enable_mmio = dev
.options
.get("enable_isa")
.get("enable_mmio")
.and_then(|opt| opt.as_bool())
.unwrap_or(false);
if enable_isa {
if enable_mmio {
let pvpanic = QemuPvpanic::create(
log.new(slog::o!("dev" => "pvpanic")),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub enum MigrationCompatibilityError {
#[serde(deny_unknown_fields)]
pub struct QemuPvpanic {
/// Enable the QEMU PVPANIC ISA bus device (I/O port 0x505).
pub enable_isa: bool,
pub enable_mmio: bool,
// TODO(eliza): add support for the PCI PVPANIC device...
}

Expand Down Expand Up @@ -428,20 +428,20 @@ mod test {

#[test]
fn incompatible_qemu_pvpanic() {
let d1 = Some(QemuPvpanic { enable_isa: true });
let d2 = Some(QemuPvpanic { enable_isa: false });
let d1 = Some(QemuPvpanic { enable_mmio: true });
let d2 = Some(QemuPvpanic { enable_mmio: false });
assert!(d1.can_migrate_from_element(&d2).is_err());
assert!(d1.can_migrate_from_element(&None).is_err());
}

#[test]
fn compatible_qemu_pvpanic() {
let d1 = Some(QemuPvpanic { enable_isa: true });
let d2 = Some(QemuPvpanic { enable_isa: true });
let d1 = Some(QemuPvpanic { enable_mmio: true });
let d2 = Some(QemuPvpanic { enable_mmio: true });
assert!(d1.can_migrate_from_element(&d2).is_ok());

let d1 = Some(QemuPvpanic { enable_isa: false });
let d2 = Some(QemuPvpanic { enable_isa: false });
let d1 = Some(QemuPvpanic { enable_mmio: false });
let d2 = Some(QemuPvpanic { enable_mmio: false });
assert!(d1.can_migrate_from_element(&d2).is_ok());
}
}
4 changes: 2 additions & 2 deletions openapi/propolis-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -1351,13 +1351,13 @@
"QemuPvpanic": {
"type": "object",
"properties": {
"enable_isa": {
"enable_mmio": {
"description": "Enable the QEMU PVPANIC ISA bus device (I/O port 0x505).",
"type": "boolean"
}
},
"required": [
"enable_isa"
"enable_mmio"
],
"additionalProperties": false
},
Expand Down

0 comments on commit 68d5518

Please sign in to comment.