Commit acdf8145 by Őry Máté

django: remove update_state calls (temp. fix??)

parent b9e6d1b4
...@@ -236,7 +236,7 @@ class Host(models.Model): ...@@ -236,7 +236,7 @@ class Host(models.Model):
res = self.record_set.filter(type='A') res = self.record_set.filter(type='A')
return unicode(res[0].get_data()['name']) return unicode(res[0].get_data()['name'])
except: except:
raise # raise
if self.shared_ip: if self.shared_ip:
return self.pub_ipv4 return self.pub_ipv4
else: else:
......
...@@ -66,19 +66,16 @@ submit_vm.short_description = _('Submit VM') ...@@ -66,19 +66,16 @@ submit_vm.short_description = _('Submit VM')
def delete_vm(modeladmin, request, queryset): def delete_vm(modeladmin, request, queryset):
for i in queryset.exclude(state='DONE').all(): for i in queryset.exclude(state='DONE').all():
i.one_delete() i.one_delete()
i.update_state()
delete_vm.short_description = _('Delete VM') delete_vm.short_description = _('Delete VM')
def suspend_vm(modeladmin, request, queryset): def suspend_vm(modeladmin, request, queryset):
for i in queryset.filter(state='ACTIVE').all(): for i in queryset.filter(state='ACTIVE').all():
i.stop() i.stop()
i.update_state()
suspend_vm.short_description = _('Suspend VM') suspend_vm.short_description = _('Suspend VM')
def resume_vm(modeladmin, request, queryset): def resume_vm(modeladmin, request, queryset):
for i in queryset.filter(state__in=('STOPPED', 'SUSPENDED')).all(): for i in queryset.filter(state__in=('STOPPED', 'SUSPENDED')).all():
i.resume() i.resume()
i.update_state()
resume_vm.short_description = _('Resume VM') resume_vm.short_description = _('Resume VM')
......
...@@ -7,6 +7,6 @@ class Job(HourlyJob): ...@@ -7,6 +7,6 @@ class Job(HourlyJob):
def execute(self): def execute(self):
Disk.update() Disk.update()
Network.update() Network.update()
for i in Instance.objects.filter(state__in=['ACTIVE', 'STOPPED'], time_of_delete__isnull=False): # for i in Instance.objects.filter(state__in=['ACTIVE', 'STOPPED'], time_of_delete__isnull=False):
i.update_state() # i.update_state()
pass pass
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