mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-26 23:19:29 +02:00
Enable KVM only if available
This commit is contained in:
parent
4e12052f5a
commit
34020614e1
50
src/main.rs
50
src/main.rs
@ -421,30 +421,32 @@ fn chroot(command: ChrootCommand) -> Result<(), Error> {
|
|||||||
fn qemu(command: QemuCommand) -> Result<(), Error> {
|
fn qemu(command: QemuCommand) -> Result<(), Error> {
|
||||||
let qemu = Tool::find("qemu-system-x86_64")?;
|
let qemu = Tool::find("qemu-system-x86_64")?;
|
||||||
|
|
||||||
let err = qemu
|
let mut run = qemu.execute();
|
||||||
.execute()
|
run.args(&[
|
||||||
.args(&[
|
"-m",
|
||||||
"-enable-kvm",
|
"4G",
|
||||||
"-cpu",
|
"-netdev",
|
||||||
"host",
|
"user,id=user.0",
|
||||||
"-m",
|
"-device",
|
||||||
"4G",
|
"virtio-net-pci,netdev=user.0",
|
||||||
"-netdev",
|
"-device",
|
||||||
"user,id=user.0",
|
"qemu-xhci,id=xhci",
|
||||||
"-device",
|
"-device",
|
||||||
"virtio-net-pci,netdev=user.0",
|
"usb-tablet,bus=xhci.0",
|
||||||
"-device",
|
"-drive",
|
||||||
"qemu-xhci,id=xhci",
|
])
|
||||||
"-device",
|
.arg(format!(
|
||||||
"usb-tablet,bus=xhci.0",
|
"file={},if=virtio,format=raw",
|
||||||
"-drive",
|
command.block_device.display()
|
||||||
])
|
))
|
||||||
.arg(format!(
|
.args(command.args);
|
||||||
"file={},if=virtio,format=raw",
|
|
||||||
command.block_device.display()
|
if PathBuf::from("/dev/kvm").exists() {
|
||||||
))
|
debug!("KVM is enabled");
|
||||||
.args(command.args)
|
run.args(&["-enable-kvm", "-cpu", "host"]);
|
||||||
.exec();
|
}
|
||||||
|
|
||||||
|
let err = run.exec();
|
||||||
|
|
||||||
Err(err).context(ErrorKind::Qemu)?
|
Err(err).context(ErrorKind::Qemu)?
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user