Commit 59f2221c by Guba Sándor

storage: added priority parameter to remote_queue

parent 73c6938b
...@@ -40,11 +40,12 @@ class DataStore(Model): ...@@ -40,11 +40,12 @@ class DataStore(Model):
def __unicode__(self): def __unicode__(self):
return u'%s (%s)' % (self.name, self.path) return u'%s (%s)' % (self.name, self.path)
def get_remote_queue_name(self, queue_id, check_worker=True): def get_remote_queue_name(self, queue_id, priority=None,
check_worker=True):
logger.debug("Checking for storage queue %s.%s", logger.debug("Checking for storage queue %s.%s",
self.hostname, queue_id) self.hostname, queue_id)
if not check_worker or local_tasks.check_queue(self.hostname, if not check_worker or local_tasks.check_queue(self.hostname,
queue_id): queue_id, priority):
return self.hostname + '.' + queue_id return self.hostname + '.' + queue_id
else: else:
raise WorkerNotFound() raise WorkerNotFound()
...@@ -273,11 +274,13 @@ class Disk(AclBase, TimeStampedModel): ...@@ -273,11 +274,13 @@ class Disk(AclBase, TimeStampedModel):
'type': 'snapshot' if self.base else 'normal' 'type': 'snapshot' if self.base else 'normal'
} }
def get_remote_queue_name(self, queue_id='storage', check_worker=True): def get_remote_queue_name(self, queue_id='storage', priority=None,
check_worker=True):
"""Returns the proper queue name based on the datastore. """Returns the proper queue name based on the datastore.
""" """
if self.datastore: if self.datastore:
return self.datastore.get_remote_queue_name(queue_id, check_worker) return self.datastore.get_remote_queue_name(queue_id, priority,
check_worker)
else: else:
return None return None
......
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