Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
563 changes: 434 additions & 129 deletions odorobo/src/actors/scheduler_actor.rs

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions odorobo/src/ch_driver/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ 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?;
async fn on_start((vmid, vm_manifest): Self::Args, actor_ref: ActorRef<Self>) -> Result<Self> {
let mut vminstance = VMInstance::spawn(&vmid.to_string(), vm_manifest.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 @@ -69,6 +70,7 @@ impl Actor for VMActor {
vmid,
vm_instance: vminstance,
migration_state: None,
manifest: vm_manifest
})
}

Expand Down Expand Up @@ -157,7 +159,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
7 changes: 2 additions & 5 deletions odorobo/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,10 @@ pub struct Config {
/// The number of VCPUs reserved for the agent. Defaults to 2.
#[serde(default = "default_reserved_vcpus")]
pub reserved_vcpus: u32,
/// this is just arbitrary data that will be shown but does no config
/// Arbitrary labels that can be used

/// Arbitrary data that the infra team can set for notes for themselves. odorobo does not directly use these, but does include them in that can be used
#[serde(default)]
pub labels: AHashMap<String, String>,
/// Arbitrary annotations that can be used
#[serde(default)]
pub annotations: AHashMap<String, String>,

#[serde(default)]
pub network: NetworkConfig,
Expand Down
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>,
}
15 changes: 6 additions & 9 deletions odorobo/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,28 +175,26 @@ pub struct VirtualMachine {
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 }
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub enum AffinityType {
VirtualMachine,
VirtualMachine(Zone),
Agent
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub enum AffinityDirection {
Normal,
Anti
}
pub type Zone = String;

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub struct AffinityRequirement {
Expand All @@ -212,7 +210,6 @@ pub enum MetadataTable {
Annotation
}

// todo: possibly replace with std::ops
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
pub enum Operator {
In,
Expand Down
174 changes: 0 additions & 174 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,5 +1,4 @@
pub mod actor_names;
pub mod actor_cache;

use aide::OperationIo;
use stable_eyre::{Result, Report};
Expand Down
Loading