refactor: move spawn_vm out of worker into provisioner

feat: spawn vm params to settings
This commit is contained in:
2024-11-27 14:38:23 +00:00
parent 088f22cea4
commit d28ca286fb
15 changed files with 491 additions and 202 deletions

View File

@ -6,6 +6,9 @@ pub mod lnvps;
#[async_trait]
pub trait Provisioner: Send + Sync {
/// Do any necessary initialization
async fn init(&self) -> Result<()>;
/// Provision a new VM for a user on the database
///
/// Note:
@ -24,4 +27,7 @@ pub trait Provisioner: Send + Sync {
/// Allocate ips for a VM
async fn allocate_ips(&self, vm_id: u64) -> Result<Vec<VmIpAssignment>>;
/// Spawn a VM on the host
async fn spawn_vm(&self, vm_id: u64) -> Result<()>;
}