Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ac0ee47
remove generic actor cache.
TheHeroBrine422 May 1, 2026
09c41f0
improve scheduling algorithm to use estimated future values.
TheHeroBrine422 May 1, 2026
d0dd375
committing before lunch so i dont have code just sitting on my machine
TheHeroBrine422 May 1, 2026
4449502
continue to work on scheduler actor caches and placement groups
TheHeroBrine422 May 1, 2026
7a63518
continue to work on scheduler actor (still not finished)
TheHeroBrine422 May 5, 2026
11186cd
more work on scheduler affinity stuff. still not finished.
TheHeroBrine422 May 5, 2026
2202c17
theoretically write scheduler affinity scoring. need to test this.
TheHeroBrine422 May 14, 2026
fedb58b
remove ipam actor
TheHeroBrine422 Jul 6, 2026
e26b7d7
Merge branch 'main' into caleb/fix-scheduler-actor-cache
TheHeroBrine422 Jul 6, 2026
29c2a84
fix bug with getting all agent and vm actors in actor finders
TheHeroBrine422 Jul 6, 2026
99e313f
Merge branch 'main' into caleb/fix-scheduler-actor-cache
TheHeroBrine422 Jul 8, 2026
2fde501
commiting stuff before cypress rebase. was in the middle of testing
TheHeroBrine422 Jul 8, 2026
da311a3
Merge branch 'caleb/fix-scheduler-actor-cache' of github.com:FyraStac…
TheHeroBrine422 Jul 8, 2026
5274b03
Merge branch 'main' into caleb/fix-scheduler-actor-cache
TheHeroBrine422 Jul 10, 2026
674c5a9
cargo fmt
TheHeroBrine422 Jul 10, 2026
06c7885
fix bugs created by merge commit
TheHeroBrine422 Jul 10, 2026
2f1ad4e
cargo fmt
TheHeroBrine422 Jul 10, 2026
1561884
random debugging stuff
TheHeroBrine422 Jul 11, 2026
a575032
Merge branch 'main' into caleb/fix-scheduler-actor-cache
TheHeroBrine422 Jul 13, 2026
188a2b9
fix: remove unused AffinityDirection enum
TheHeroBrine422 Jul 16, 2026
43b6f56
feat: remove VMs from actors if unreachacble by updaters.
TheHeroBrine422 Jul 16, 2026
a784bab
chore: cargo fmt
TheHeroBrine422 Jul 16, 2026
e42ee50
Merge remote-tracking branch 'origin/main' into caleb/fix-scheduler-a…
TheHeroBrine422 Jul 16, 2026
81d5b9c
fix: better extended_vm_set removal and setup
TheHeroBrine422 Jul 16, 2026
ecbc2e9
chore: clippy and fmt
TheHeroBrine422 Jul 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .zed/debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"label": "Run manager agent",
"build": {
"command": "cargo",
"args": ["build"]
},
"sourceLanguages": ["rust"],
"program": "$ZED_WORKTREE_ROOT/target/debug/odorobo",
"args": ["--manager-enabled"],
"request": "launch",
"adapter": "CodeLLDB"
}
]
1 change: 1 addition & 0 deletions odorobo/src/actors/agent_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl Message<GetAgentStatus> for AgentActor {
vms: self.vms.keys().copied().collect(),
used_vcpus: vcpus_used_by_vms + self.config.get_reserved_vcpus(),
used_ram: ByteSize::b(ram_used_by_vms),
metadata: self.metadata.clone(),
}
}
}
18 changes: 0 additions & 18 deletions odorobo/src/actors/ip_management_actor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use kameo::prelude::*;
use stable_eyre::{Report, Result};

// idk if we ever agreed upon an OUI for fyra, but im reserving `FYR` for this
// -cappy
pub const FYRA_OUI: [u8; 3] = [0x46, 0x59, 0x52];
Expand All @@ -21,18 +18,3 @@ fn test_calculate_mac_address() {
let mac = calculate_mac_address(ip);
assert_eq!(mac, [0x46, 0x59, 0x52, 168, 0x01, 0x01]);
}

/// HTTP REST API service
#[derive(RemoteActor)]
pub struct IPManagementActor;

impl Actor for IPManagementActor {
type Args = ();
type Error = Report;

async fn on_start(_state: Self::Args, _actor_ref: ActorRef<Self>) -> Result<Self, Self::Error> {
// if we need to like prep the router stuff

Ok(Self)
}
}
691 changes: 550 additions & 141 deletions odorobo/src/actors/scheduler_actor.rs

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions odorobo/src/ch_driver/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ pub struct VMActor {
/// path to the Cloud Hypervisor socket, in /run/odorobo/vms/<VMID>/ch.sock
pub vm_instance: VMInstance,
pub migration_state: Option<MigrationState>,
pub manifest: Option<VirtualMachine>,
}

impl Actor for VMActor {
// tuple of VM ID and optional config
// tuple of VM ID and manifest
type Args = (ulid::Ulid, Option<VirtualMachine>);
type Error = Report;

#[tracing::instrument(skip_all)]
async fn on_start((vmid, vm_config): Self::Args, actor_ref: ActorRef<Self>) -> Result<Self> {
let mut vminstance =
VMInstance::spawn(&vmid.to_string(), vm_config.map(VmConfig::from), None).await?;
let mut vminstance = VMInstance::spawn(
&vmid.to_string(),
vm_config.clone().map(VmConfig::from),
None,
)
.await?;

// Take the child process out so we can watch for unexpected death.
// destroy() handles a missing child_process gracefully.
Expand Down Expand Up @@ -72,6 +77,7 @@ impl Actor for VMActor {
vmid,
vm_instance: vminstance,
migration_state: None,
manifest: vm_config,
})
}

Expand Down Expand Up @@ -159,7 +165,7 @@ impl Message<GetVMInfo> for VMActor {
) -> Self::Reply {
GetVMInfoReply {
vmid: self.vmid,
config: self.vm_instance.vm_config.clone(),
config: self.manifest.clone(), // we likely dont want to send the entire manifest on every update, but some of this data is required and this is easier for now.
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions odorobo/src/messages/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use kameo::Reply;
use serde::{Deserialize, Serialize};
use ulid::Ulid;

use crate::types::ObjectMetadata;

#[derive(Serialize, Deserialize)]
pub struct GetAgentStatus;

Expand All @@ -16,4 +18,5 @@ pub struct AgentStatus {
pub used_vcpus: u32,
pub used_ram: ByteSize,
pub vms: Vec<Ulid>,
pub metadata: ObjectMetadata,
}
2 changes: 1 addition & 1 deletion odorobo/src/messages/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ pub struct GetVMInfo {
#[derive(Serialize, Deserialize, Reply, Debug, Clone)]
pub struct GetVMInfoReply {
pub vmid: Ulid,
pub config: Option<VmConfig>,
pub config: Option<VirtualMachine>,
}
20 changes: 9 additions & 11 deletions odorobo/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,23 @@ pub struct VirtualMachine {
/// Metadata
pub metadata: Option<ObjectMetadata>,

/// List of Affinity rules for scheduling. These are ANDed / summed together depending on the strictness.
/// List of Affinity rules for scheduling.
/// Affinity rules are ANDed or summed based on strictness
pub affinity: Option<Vec<AffinityRule>>,
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub struct AffinityRule {
pub strictness: AffinityStrictness,
pub affinity_type: AffinityType,
pub direction: AffinityDirection,
/// if true, the outcome of the requirements is inverted
#[serde(default)]
pub inverse: bool,
/// ORed together
pub requirements: Vec<AffinityRequirement>,
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone, Copy)]
pub enum AffinityStrictness {
Required,
Preferred { weight: i64 },
Expand All @@ -190,12 +193,8 @@ pub enum AffinityType {
Agent,
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub enum AffinityDirection {
Normal,
Anti,
}

/// if there are several metadata tables, their results will be ANDed together
/// EX: if a requirement is checked against several VMs, it must pass all VMs for the requirement to be fulfilled.
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub struct AffinityRequirement {
pub key: String,
Expand All @@ -210,8 +209,7 @@ pub enum MetadataTable {
Annotation,
}

// todo: possibly replace with std::ops
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone, PartialEq)]
pub enum Operator {
In,
NotIn,
Expand Down
181 changes: 0 additions & 181 deletions odorobo/src/utils/actor_cache.rs

This file was deleted.

1 change: 0 additions & 1 deletion odorobo/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod actor_cache;
pub mod actor_names;

use aide::OperationIo;
Expand Down
27 changes: 25 additions & 2 deletions odoroboctl/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use std::collections::BTreeMap;

use bytesize::ByteSize;
use clap::{Parser, Subcommand};
use odorobo::types::{CreateVMRequest, VMData, VirtualMachine};
use odorobo::types::{
AffinityRequirement, AffinityRule, AffinityStrictness, AffinityType, CreateVMRequest,
MetadataTable, ObjectMetadata, Operator, VMData, VirtualMachine,
};
use reqwest::{Client, Response};
use serde::Deserialize;
use stable_eyre::Result;
Expand Down Expand Up @@ -105,9 +110,27 @@ pub async fn run_command(cli: Cli) -> Result<()> {
vcpus: 4,
max_vcpus: None,
memory: ByteSize::gib(4),
image: "/var/lib/odorobo/f43.raw".to_string(),
image: "/var/lib/odorobo/f43-1.raw".to_string(),
..Default::default()
},
metadata: Some(ObjectMetadata {
labels: BTreeMap::new(),
annotations: BTreeMap::from([(
String::from("distribution"),
String::from("different"),
)]),
}),
affinity: Some(vec![AffinityRule {
strictness: AffinityStrictness::Required,
affinity_type: AffinityType::VirtualMachine,
inverse: false,
requirements: vec![AffinityRequirement {
key: String::from("distribution"),
table: MetadataTable::Annotation,
operator: Operator::NotIn,
values: vec![String::from("different")],
}],
}]),
..Default::default()
};

Expand Down
Loading