Commit 0a40aa8a by Kálmán Viktor

vm: don't notify if the VM is already suspended

parent dad93220
...@@ -710,7 +710,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -710,7 +710,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
def _is_suspend_expiring(self, threshold=0.1): def _is_suspend_expiring(self, threshold=0.1):
interval = self.lease.suspend_interval interval = self.lease.suspend_interval
if self.time_of_suspend is not None and interval is not None: if (self.status != "SUSPENDED" and
self.time_of_suspend is not None and interval is not None):
limit = timezone.now() + timedelta(seconds=( limit = timezone.now() + timedelta(seconds=(
threshold * self.lease.suspend_interval.total_seconds())) threshold * self.lease.suspend_interval.total_seconds()))
return limit > self.time_of_suspend return limit > self.time_of_suspend
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment