fix: remove stop command on delete
This commit is contained in:
parent
de55d34086
commit
06f7beb26f
@ -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?;
|
||||
|
@ -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?;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user