Commit 6d2a86a7 by Szeberényi Imre

agentupdate

parent 744c1885
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>. # with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from inspect import getargspec from inspect import getargspec
from logging import getLogger #from logging import getLogger
from celery.utils.log import get_task_logger
from django.core.exceptions import PermissionDenied, ImproperlyConfigured from django.core.exceptions import PermissionDenied, ImproperlyConfigured
from django.utils.translation import ugettext_noop from django.utils.translation import ugettext_noop
...@@ -24,7 +25,8 @@ from django.utils.translation import ugettext_noop ...@@ -24,7 +25,8 @@ from django.utils.translation import ugettext_noop
from .models import (activity_context, has_suffix, humanize_exception, from .models import (activity_context, has_suffix, humanize_exception,
HumanReadableObject) HumanReadableObject)
logger = getLogger(__name__) logger = get_task_logger(__name__)
#logger = getLogger(__name__)
class SubOperationMixin(object): class SubOperationMixin(object):
...@@ -305,7 +307,9 @@ class Operation(object): ...@@ -305,7 +307,9 @@ class Operation(object):
kwargs) kwargs)
activity, allargs, auxargs = self.__prelude(kwargs) activity, allargs, auxargs = self.__prelude(kwargs)
allargs['activity'] = activity allargs['activity'] = activity
return self._exec_op(allargs, auxargs) sync_ret = self._exec_op(allargs, auxargs)
logger.info("sync_ret %r", sync_ret)
return sync_ret
def check_precond(self): def check_precond(self):
pass pass
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>. # with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
import logging
import sys
from celery import Celery from celery import Celery
import common.serializers import common.serializers
from celery.signals import worker_ready from celery.signals import worker_ready
...@@ -30,7 +32,6 @@ HOSTNAME = "localhost" ...@@ -30,7 +32,6 @@ HOSTNAME = "localhost"
QUEUE_NAME = HOSTNAME + '.man' QUEUE_NAME = HOSTNAME + '.man'
AUTO_MIGRATION_CRONTAB = getenv('AUTO_MIGRATION_CRONTAB', '0 0 * * *') AUTO_MIGRATION_CRONTAB = getenv('AUTO_MIGRATION_CRONTAB', '0 0 * * *')
def crontab_parser(crontab): def crontab_parser(crontab):
fields = crontab.split(' ') fields = crontab.split(' ')
return dict( return dict(
......
...@@ -33,6 +33,7 @@ def garbage_collector(timeout=15): ...@@ -33,6 +33,7 @@ def garbage_collector(timeout=15):
:param timeout: Seconds before TimeOut exception :param timeout: Seconds before TimeOut exception
:type timeout: int :type timeout: int
""" """
logger.error("Garbage collector started")
for ds in DataStore.objects.all(): for ds in DataStore.objects.all():
queue_name = ds.get_remote_queue_name('storage', priority='fast') queue_name = ds.get_remote_queue_name('storage', priority='fast')
files = set(storage_tasks.list_files.apply_async( files = set(storage_tasks.list_files.apply_async(
......
...@@ -356,14 +356,15 @@ ...@@ -356,14 +356,15 @@
<li> <li>
<p> <p>
{% trans "Extend LVM:" %} {% trans "Extend LVM:" %}
<code>lvextend -L</code>+<strong>2.6G</strong> <code>lvextend -l +100%FREE</code>
<code>/dev/mapper/cloud--x--vg-root</code> <code>/dev/mapper/cloud--x--vg-root</code>
# or size: lvextend -L +<strong>2.6G</strong>
/dev/mapper/cloud--x--vg-root
</p> </p>
<pre> <pre>
Rounding size to boundary between physical extents: 2.60 GiB ...
Extending logical volume root to 41.36 GiB Logical volume cloud-x-vg/root successfully resized.</pre>
Logical volume root successfully resized</pre>
</li> </li>
<li> <li>
......
...@@ -29,6 +29,7 @@ import os ...@@ -29,6 +29,7 @@ import os
import time import time
from celery.contrib.abortable import AbortableAsyncResult from celery.contrib.abortable import AbortableAsyncResult
from celery.exceptions import TimeLimitExceeded, TimeoutError from celery.exceptions import TimeLimitExceeded, TimeoutError
from celery.utils.log import get_task_logger
from django.conf import settings from django.conf import settings
from django.core.exceptions import PermissionDenied, SuspiciousOperation from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -59,7 +60,7 @@ from .tasks.local_tasks import ( ...@@ -59,7 +60,7 @@ from .tasks.local_tasks import (
from common.safe_celery_get import safe_celery_get from common.safe_celery_get import safe_celery_get
logger = getLogger(__name__) logger = get_task_logger(__name__)
class RemoteOperationMixin(object): class RemoteOperationMixin(object):
...@@ -788,6 +789,7 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -788,6 +789,7 @@ class SaveAsTemplateOperation(InstanceOperation):
try: try:
self.instance._cleanup(parent_activity=activity, user=user) self.instance._cleanup(parent_activity=activity, user=user)
except: except:
logger.error("Cleanup error")
pass pass
if with_shutdown: if with_shutdown:
...@@ -1593,6 +1595,7 @@ class AgentStartedOperation(InstanceOperation): ...@@ -1593,6 +1595,7 @@ class AgentStartedOperation(InstanceOperation):
self.instance._set_time(parent_activity=activity) self.instance._set_time(parent_activity=activity)
self.instance._set_hostname(parent_activity=activity) self.instance._set_hostname(parent_activity=activity)
logger.info("Agent_Started in instance: %s sys: %s ver: %s", self.instance, agent_system, old_version);
new_version = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system)[0] new_version = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system)[0]
# if agent_system and new_version and (old_version is None or ("NOAGENTUPDATE" not in old_version and new_version != old_version)) : # if agent_system and new_version and (old_version is None or ("NOAGENTUPDATE" not in old_version and new_version != old_version)) :
if agent_system and new_version and old_version and "NOAGENTUPDATE" not in old_version and new_version != old_version : if agent_system and new_version and old_version and "NOAGENTUPDATE" not in old_version and new_version != old_version :
...@@ -1712,19 +1715,12 @@ class UpdateAgentOperation(RemoteAgentOperation): ...@@ -1712,19 +1715,12 @@ class UpdateAgentOperation(RemoteAgentOperation):
_vers, _dir = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system) _vers, _dir = settings.GET_AGENT_VERSION_BY_SYSTEM(agent_system)
queue = self._get_remote_queue() queue = self._get_remote_queue()
instance = self.instance instance = self.instance
if agent_system == "Windows": if agent_system != "Linux":
executable = sorted(os.listdir(_dir))[0] executable = sorted(os.listdir(_dir))[0]
data = self.create_windows_tar(agent_system) data = self.create_windows_tar(agent_system)
elif agent_system == "Linux":
executable = ""
data = self.create_linux_tar(agent_system)
else: else:
# Legacy update method
executable = "" executable = ""
return agent_tasks.update_legacy.apply_async( data = self.create_linux_tar(agent_system)
queue=queue,
args=(instance.vm_name, self.create_linux_tar())
).get(timeout=60)
checksum = md5(data).hexdigest() checksum = md5(data).hexdigest()
chunk_size = 1024 * 1024 chunk_size = 1024 * 1024
......
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