Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Store workspace volumes in Gevulot data directory (#50)
Browse files Browse the repository at this point in the history
When running Gevulot node in container, the workspace volume creation
fails if Ops hasn't been tricked to write the data into right place.

It doesn't allow direct configuration of images directory, but by
adjusting $HOME, it can be tricked to save images in
`/var/lib/gevulot/.ops/images`, which is fine for ephemeral workspace
volumes.
  • Loading branch information
tuommaki authored Jan 23, 2024
1 parent 10efd79 commit df6c5e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions crates/node/src/nanos/volume.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::{path::PathBuf, process::Command};
use std::{
path::{Path, PathBuf},
process::Command,
};

use eyre::Result;
use thiserror::Error;
Expand All @@ -13,8 +16,9 @@ pub enum NanosVolumeError {
ParseError(String),
}

pub fn create(label: &str, size: &str) -> Result<PathBuf> {
pub fn create(data_dir: &Path, label: &str, size: &str) -> Result<PathBuf> {
let output = Command::new("ops")
.env("HOME", data_dir)
.arg("volume")
.arg("create")
.arg(label)
Expand Down
6 changes: 5 additions & 1 deletion crates/node/src/vmm/qemu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ impl Provider for Qemu {
.to_lowercase();

// XXX: This isn't async and will call out to `ops` for now.
let workspace_file = nanos::volume::create(&workspace_volume_label, "2g")?.into_os_string();
tracing::debug!("creating workspace volume for the VM");
let workspace_file =
nanos::volume::create(&self.config.data_directory, &workspace_volume_label, "2g")?
.into_os_string();
let workspace_file = workspace_file.to_str().expect("workspace volume path");
tracing::debug!("workspace volume created");

let cpus = req.cpus;
let mem_req = req.mem;
Expand Down

0 comments on commit df6c5e2

Please sign in to comment.