mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-05 03:21:13 +00:00
bin: Share VFIO device syntax between cloud-hypervisor and ch-remote
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
96be2dbeff
commit
477bc17f18
@ -267,10 +267,11 @@ fn main() {
|
|||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("add-device")
|
SubCommand::with_name("add-device")
|
||||||
.about("Add VFIO device")
|
.about("Add VFIO device")
|
||||||
.arg(Arg::with_name("device_config").index(1).help(
|
.arg(
|
||||||
"Direct device assignment parameters \
|
Arg::with_name("device_config")
|
||||||
\"path=<device_path>,iommu=on|off,id=<device_id>\"",
|
.index(1)
|
||||||
)),
|
.help(vmm::config::DeviceConfig::SYNTAX),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("remove-device")
|
SubCommand::with_name("remove-device")
|
||||||
|
@ -198,10 +198,7 @@ fn create_app<'a, 'b>(
|
|||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("device")
|
Arg::with_name("device")
|
||||||
.long("device")
|
.long("device")
|
||||||
.help(
|
.help(config::DeviceConfig::SYNTAX)
|
||||||
"Direct device assignment parameters \
|
|
||||||
\"path=<device_path>,iommu=on|off,id=<device_id>\"",
|
|
||||||
)
|
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.min_values(1)
|
.min_values(1)
|
||||||
.group("vm-config"),
|
.group("vm-config"),
|
||||||
|
@ -904,6 +904,8 @@ pub struct DeviceConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceConfig {
|
impl DeviceConfig {
|
||||||
|
pub const SYNTAX: &'static str =
|
||||||
|
"Direct device assignment parameters \"path=<device_path>,iommu=on|off,id=<device_id>\"";
|
||||||
pub fn parse(device: &str) -> Result<Self> {
|
pub fn parse(device: &str) -> Result<Self> {
|
||||||
// Split the parameters based on the comma delimiter
|
// Split the parameters based on the comma delimiter
|
||||||
let params_list: Vec<&str> = device.split(',').collect();
|
let params_list: Vec<&str> = device.split(',').collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user