mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-10 01:17:59 +03:00
Fixes for ovirt cleanup
This commit is contained in:
parent
c981935270
commit
f5d1e39121
@ -49,20 +49,11 @@ class OVirtHouseKeeping(jobs.Job):
|
||||
friendly_name = 'Ovirt house keeping'
|
||||
|
||||
def run(self):
|
||||
from .OVirtLinkedService import OVirtLinkedService
|
||||
from django.db.models import Q
|
||||
from datetime import datetime
|
||||
|
||||
releaseOlderThan = getSqlDatetime(True) - self.frecuency
|
||||
|
||||
for a in Service.objects.all():
|
||||
if a.isOfType(OVirtLinkedService.typeType):
|
||||
log.doLog(a, log.INFO, 'Cleaning contained macs & names older than {0}'.format(datetime.fromtimestamp(releaseOlderThan)), log.SERVICE)
|
||||
a.getEnvironment().idGenerators('mac').releaseOlderThan(releaseOlderThan)
|
||||
return
|
||||
|
||||
|
||||
class OVirtDeferredRemoval(jobs.Job):
|
||||
frecuency = 60 * 60 # Once every minute
|
||||
frecuency = 60 * 5 # Once every NN minutes
|
||||
friendly_name = 'Ovirt removal'
|
||||
counter = 0
|
||||
|
||||
@ -77,8 +68,8 @@ class OVirtDeferredRemoval(jobs.Job):
|
||||
state = providerInstance.getMachineState(vmId)
|
||||
if state in ('up', 'powering_up', 'suspended'):
|
||||
providerInstance.stopMachine(vmId)
|
||||
elif state != 'unknown': # Machine exists, remove it later
|
||||
|
||||
if state != 'unknown': # Machine exists, remove it later
|
||||
providerInstance.storage.saveData('tr' + vmId, vmId, attr1='tRm')
|
||||
|
||||
except Exception as e:
|
||||
|
@ -5,8 +5,8 @@ Created on Nov 14, 2012
|
||||
'''
|
||||
|
||||
import ovirtsdk4 as ovirt
|
||||
import oivrtsdk4.types as ovirtTypes # @UnresolvedImport @UnusedImport
|
||||
|
||||
import time
|
||||
import threading
|
||||
import logging
|
||||
import six
|
||||
|
Loading…
Reference in New Issue
Block a user