Commit cf58482a by Szeberényi Imre

Merge branch 'python3.6' into 'master'

Python3.6

See merge request !1
parents 4380caf8 412d6fc5
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_RESULT_EXPIRES = 300
CELERY_TIMEZONE = 'UTC'
CELERY_ENABLE_UTC = True
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
...@@ -69,7 +69,7 @@ class Disk(object): ...@@ -69,7 +69,7 @@ class Disk(object):
def deserialize(cls, desc): def deserialize(cls, desc):
"""Create cls object from JSON.""" """Create cls object from JSON."""
logging.info(desc) logging.info(desc)
if isinstance(desc, basestring): if isinstance(desc, str):
desc = json.loads(desc) desc = json.loads(desc)
return cls(**desc) return cls(**desc)
...@@ -93,8 +93,8 @@ class Disk(object): ...@@ -93,8 +93,8 @@ class Disk(object):
"""Get absolute path for disk's base image.""" """Get absolute path for disk's base image."""
return os.path.realpath(self.dir + '/' + self.base_name) return os.path.realpath(self.dir + '/' + self.base_name)
def __unicode__(self): def __str__(self):
return u'%s %s %s %s' % (self.get_path(), self.format, return '%s %s %s %s' % (self.get_path(), self.format,
self.size, self.get_base()) self.size, self.get_base())
@classmethod @classmethod
...@@ -178,7 +178,8 @@ class Disk(object): ...@@ -178,7 +178,8 @@ class Disk(object):
format_map = [ format_map = [
("qcow", "qcow2-norm"), ("qcow", "qcow2-norm"),
("iso", "iso"), ("iso", "iso"),
("x86 boot sector", "iso") ("x86 boot sector", "iso"),
("dos/mbr", "iso")
] ]
with magic.Magic() as m: with magic.Magic() as m:
ftype = m.id_filename(self.get_path()) ftype = m.id_filename(self.get_path())
......
...@@ -45,7 +45,7 @@ project:: ...@@ -45,7 +45,7 @@ project::
Set up default Storage configuration and activate the virtual environment:: Set up default Storage configuration and activate the virtual environment::
$ cat >>/home/cloud/.virtualenvs/storage/bin/postactivate <<END $ cat >>/home/cloud/.virtualenvs/storage/bin/postactivate <<END
export AMQP_URI='amqp://cloud:password@host:5672/circle' export AMQP_URI='amqp://cloud:cloud123@localhost:5672/circle'
END END
$ workon storage $ workon storage
$ cd ~/storagedriver $ cd ~/storagedriver
......
...@@ -8,8 +8,8 @@ setgid cloud ...@@ -8,8 +8,8 @@ setgid cloud
instance $NAME instance $NAME
script script
cd /home/cloud/storagedriver/ cd /home/kohlkriszto/Documents/storagedriver
. /home/cloud/.virtualenvs/storagedriver/local/bin/activate . /home/kohlkriszto/Documents/storagedriver_venv/bin/activate
. /home/cloud/.virtualenvs/storagedriver/local/bin/postactivate . /home/kohlkriszto/Documents/storagedriver_venv/bin/postactivate
exec celery -A storagecelery worker --loglevel=info -n $NAME exec celery -A storagecelery worker --loglevel=info -n $NAME
end script end script
...@@ -12,4 +12,4 @@ Restart=always ...@@ -12,4 +12,4 @@ Restart=always
WorkingDirectory=/home/cloud/storagedriver WorkingDirectory=/home/cloud/storagedriver
ExecStart=/bin/bash -c "source /etc/profile; workon storagedriver; exec celery -A storagecelery worker --loglevel=info -n $(/bin/hostname -s).%I" ExecStart=/bin/bash -c "source /home/cloud/.virtualenvs/storage/bin/activate; source /home/cloud/.virtualenvs/storage/bin/postactivate; exec celery -A storagecelery worker --loglevel=info -n $(/bin/hostname -s).%I"
celery==3.1.17 amqp==1.4.9
requests==2.5.3 anyjson==0.3.3
billiard==3.3.0.23
celery==3.1.18
filemagic==1.6 filemagic==1.6
kombu==3.0.30
pytz==2021.3
requests==2.26.0
...@@ -21,11 +21,13 @@ celery = Celery('storagedriver', ...@@ -21,11 +21,13 @@ celery = Celery('storagedriver',
broker=AMQP_URI, broker=AMQP_URI,
include=['storagedriver']) include=['storagedriver'])
celery.config_from_object('celeryconfig')
celery.conf.update( celery.conf.update(
CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=( CELERY_QUEUES=(
Queue(HOSTNAME, Exchange( Queue(HOSTNAME, Exchange(
'storagedriver', type='direct'), routing_key='storagedriver'), 'storagedriver', type='direct'), routing_key='storagedriver'),
) )
) )
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