diff --git a/src/provisioner/lnvps.rs b/src/provisioner/lnvps.rs index 56bfbdf..0fc32fe 100644 --- a/src/provisioner/lnvps.rs +++ b/src/provisioner/lnvps.rs @@ -470,13 +470,13 @@ impl Provisioner for LNVpsProvisioner { async fn delete_vm(&self, vm_id: u64) -> Result<()> { let vm = self.db.get_vm(vm_id).await?; - let host = self.db.get_host(vm.host_id).await?; + //let host = self.db.get_host(vm.host_id).await?; - let client = get_host_client(&host)?; // TODO: delete not implemented, stop only + //let client = get_host_client(&host)?; //let j_start = client.delete_vm(&host.name, vm.id + 100).await?; - let j_stop = client.stop_vm(&host.name, vm.id + 100).await?; - client.wait_for_task(&j_stop).await?; + //let j_stop = client.stop_vm(&host.name, vm.id + 100).await?; + //client.wait_for_task(&j_stop).await?; if let Some(r) = self.router.as_ref() { let ent = r.list_arp_entry().await?; diff --git a/src/worker.rs b/src/worker.rs index c2a2ff8..24a1340 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -228,7 +228,7 @@ impl Worker { } // delete vm if not paid (in new state) - if vm.expires < Utc::now().sub(Days::new(1)) && state.is_none() { + if !vm.deleted && vm.expires < Utc::now().sub(Days::new(1)) && state.is_none() { info!("Deleting unpaid VM {}", vm.id); self.provisioner.delete_vm(vm.id).await?; }