mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-02 21:00:55 +00:00
hypha: debug option for ensuring kernel logs can be seen
This commit is contained in:
parent
3a04a2fe26
commit
c17aacb6c8
@ -33,6 +33,8 @@ enum Commands {
|
|||||||
env: Option<Vec<String>>,
|
env: Option<Vec<String>>,
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
attach: bool,
|
attach: bool,
|
||||||
|
#[arg(long)]
|
||||||
|
debug: bool,
|
||||||
#[arg()]
|
#[arg()]
|
||||||
image: String,
|
image: String,
|
||||||
#[arg(allow_hyphen_values = true, trailing_var_arg = true)]
|
#[arg(allow_hyphen_values = true, trailing_var_arg = true)]
|
||||||
@ -76,6 +78,7 @@ fn main() -> Result<()> {
|
|||||||
attach,
|
attach,
|
||||||
env,
|
env,
|
||||||
run,
|
run,
|
||||||
|
debug,
|
||||||
} => {
|
} => {
|
||||||
let kernel = map_kernel_path(&store_path, kernel);
|
let kernel = map_kernel_path(&store_path, kernel);
|
||||||
let initrd = map_initrd_path(&store_path, initrd);
|
let initrd = map_initrd_path(&store_path, initrd);
|
||||||
@ -88,6 +91,7 @@ fn main() -> Result<()> {
|
|||||||
mem,
|
mem,
|
||||||
env,
|
env,
|
||||||
if run.is_empty() { None } else { Some(run) },
|
if run.is_empty() { None } else { Some(run) },
|
||||||
|
debug,
|
||||||
)?;
|
)?;
|
||||||
println!("launched container: {}", uuid);
|
println!("launched container: {}", uuid);
|
||||||
if attach {
|
if attach {
|
||||||
|
@ -71,6 +71,7 @@ impl Controller {
|
|||||||
mem: u64,
|
mem: u64,
|
||||||
env: Option<Vec<String>>,
|
env: Option<Vec<String>>,
|
||||||
run: Option<Vec<String>>,
|
run: Option<Vec<String>>,
|
||||||
|
debug: bool,
|
||||||
) -> Result<(Uuid, u32)> {
|
) -> Result<(Uuid, u32)> {
|
||||||
let uuid = Uuid::new_v4();
|
let uuid = Uuid::new_v4();
|
||||||
let name = format!("hypha-{uuid}");
|
let name = format!("hypha-{uuid}");
|
||||||
@ -97,6 +98,9 @@ impl Controller {
|
|||||||
let image_squashfs_loop = self.autoloop.loopify(image_squashfs_path)?;
|
let image_squashfs_loop = self.autoloop.loopify(image_squashfs_path)?;
|
||||||
let cfgblk_squashfs_loop = self.autoloop.loopify(cfgblk_squashfs_path)?;
|
let cfgblk_squashfs_loop = self.autoloop.loopify(cfgblk_squashfs_path)?;
|
||||||
|
|
||||||
|
let cmdline_options = [if debug { "debug" } else { "quiet" }, "elevator=noop"];
|
||||||
|
let cmdline = cmdline_options.join(" ");
|
||||||
|
|
||||||
let config = DomainConfig {
|
let config = DomainConfig {
|
||||||
backend_domid: 0,
|
backend_domid: 0,
|
||||||
name: &name,
|
name: &name,
|
||||||
@ -104,7 +108,7 @@ impl Controller {
|
|||||||
mem_mb: mem,
|
mem_mb: mem,
|
||||||
kernel_path,
|
kernel_path,
|
||||||
initrd_path,
|
initrd_path,
|
||||||
cmdline: "quiet elevator=noop",
|
cmdline: &cmdline,
|
||||||
disks: vec![
|
disks: vec![
|
||||||
DomainDisk {
|
DomainDisk {
|
||||||
vdev: "xvda",
|
vdev: "xvda",
|
||||||
|
@ -6,7 +6,7 @@ cd "$(dirname "${0}")/.."
|
|||||||
HYPHA_DIR="${PWD}"
|
HYPHA_DIR="${PWD}"
|
||||||
cargo build --bin hyphactr --release --target x86_64-unknown-linux-gnu
|
cargo build --bin hyphactr --release --target x86_64-unknown-linux-gnu
|
||||||
INITRD_DIR="$(mktemp -d /tmp/hypha-initrd.XXXXXXXXXXXXX)"
|
INITRD_DIR="$(mktemp -d /tmp/hypha-initrd.XXXXXXXXXXXXX)"
|
||||||
cp target/x86_64-unknown-linux-gnu/release/hyphactr "${INITRD_DIR}/init"
|
cp "target/x86_64-unknown-linux-gnu/release/hyphactr" "${INITRD_DIR}/init"
|
||||||
chmod +x "${INITRD_DIR}/init"
|
chmod +x "${INITRD_DIR}/init"
|
||||||
cd "${INITRD_DIR}"
|
cd "${INITRD_DIR}"
|
||||||
mkdir -p "${HYPHA_DIR}/target/initrd"
|
mkdir -p "${HYPHA_DIR}/target/initrd"
|
||||||
|
6
scripts/fix.sh
Executable file
6
scripts/fix.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "${0}")/.."
|
||||||
|
cargo fmt --all
|
||||||
|
cargo clippy --target x86_64-unknown-linux-gnu --fix --allow-dirty --allow-staged
|
Loading…
Reference in New Issue
Block a user