-
Notifications
You must be signed in to change notification settings - Fork 4
Rework fw_cfg and add bootorder entry
#170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gardenlinux
Are you sure you want to change the base?
Changes from 3 commits
fa3cd55
8e253d9
f7ba097
03ab3c1
7a2a2c1
ed98bd1
9ac85eb
6c823a4
c4ba2b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1370,6 +1370,7 @@ impl PciDeviceCommonConfig { | |
| } | ||
|
|
||
| impl DiskConfig { | ||
| #[cfg(not(feature = "fw_cfg"))] | ||
| pub const SYNTAX: &'static str = "Disk parameters \ | ||
| \"path=<disk_image_path>,readonly=on|off,direct=on|off,iommu=on|off,\ | ||
| num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,\ | ||
|
|
@@ -1382,6 +1383,20 @@ impl DiskConfig { | |
| serial=<serial_number>,backing_files=on|off,sparse=on|off,\ | ||
| image_type=<raw,qcow2,vhd,vhdx>,lock_granularity=byte-range|full"; | ||
|
|
||
| #[cfg(feature = "fw_cfg")] | ||
| pub const SYNTAX: &'static str = "Disk parameters \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer a concatenation to the existing
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly, we depend on the pub const. Being a pub const, we do not have a nice way to modify it on runtime without at least implementing some adapter that makes code that consumes the As this is only a workaround until we make |
||
| \"path=<disk_image_path>,readonly=on|off,direct=on|off,iommu=on|off,\ | ||
| num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,\ | ||
| vhost_user=on|off,socket=<vhost_user_socket_path>,\ | ||
| bw_size=<bytes>,bw_one_time_burst=<bytes>,bw_refill_time=<ms>,\ | ||
| ops_size=<io_ops>,ops_one_time_burst=<io_ops>,ops_refill_time=<ms>,\ | ||
| id=<device_id>,pci_segment=<segment_id>,pci_device_id=<pci_slot>,\ | ||
| rate_limit_group=<group_id>,\ | ||
| queue_affinity=<list_of_queue_indices_with_their_associated_cpuset>,\ | ||
| serial=<serial_number>,backing_files=on|off,sparse=on|off,\ | ||
| image_type=<raw,qcow2,vhd,vhdx>,lock_granularity=byte-range|full,\ | ||
| bootindex=<index>"; | ||
|
|
||
| pub fn parse(disk: &str) -> Result<Self> { | ||
| let mut parser = OptionParser::new(); | ||
| parser | ||
|
|
@@ -1409,6 +1424,9 @@ impl DiskConfig { | |
| .add("lock_granularity") | ||
| .add_all(PciDeviceCommonConfig::OPTIONS_IOMMU); | ||
|
|
||
| #[cfg(feature = "fw_cfg")] | ||
| parser.add("bootindex"); | ||
|
|
||
| parser.parse(disk).map_err(Error::ParseDisk)?; | ||
|
|
||
| let path = parser.get("path").map(PathBuf::from); | ||
|
|
@@ -1538,6 +1556,11 @@ impl DiskConfig { | |
|
|
||
| let pci_common = PciDeviceCommonConfig::parse(disk)?; | ||
|
|
||
| #[cfg(feature = "fw_cfg")] | ||
| let bootindex = parser | ||
| .convert::<u16>("bootindex") | ||
| .map_err(Error::ParseDisk)?; | ||
|
|
||
| Ok(DiskConfig { | ||
| pci_common, | ||
| path, | ||
|
|
@@ -1557,6 +1580,8 @@ impl DiskConfig { | |
| sparse, | ||
| image_type, | ||
| lock_granularity, | ||
| #[cfg(feature = "fw_cfg")] | ||
| bootindex, | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -4125,6 +4150,8 @@ mod unit_tests { | |
| sparse: true, | ||
| image_type: ImageType::Unknown, | ||
| lock_granularity: LockGranularityChoice::default(), | ||
| #[cfg(feature = "fw_cfg")] | ||
| bootindex: Default::default(), | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are all these TODO's? Do we need those?