Commit fa34f7cb by Kálmán Viktor

vm: measure boot time

parent f06fe9b9
......@@ -24,7 +24,9 @@ from base64 import encodestring
from StringIO import StringIO
from tarfile import TarFile, TarInfo
from django.conf import settings
from django.utils import timezone
from celery.result import TimeoutError
from monitor.client import Client
def send_init_commands(instance, act, vm):
......@@ -86,12 +88,33 @@ def agent_started(vm, version=None):
if not initialized:
send_init_commands(instance, act, vm)
with act.sub_activity('start_access_server'):
start_access_server.apply_async(queue=queue, args=(vm, ))
def measure_boot_time(instance):
if not instance.template:
from vm.models import InstanceActivity
deploy_time = InstanceActivity.objects.filter(
instance=instance, activity_code="vm.Instance.deploy"
total_boot_time = ( - deploy_time).total_seconds()
"template.%(pk)d.boot_time %(val)f %(time)s" % {
'val': total_boot_time,
'time': time.time(),
def agent_stopped(vm):
from vm.models import Instance, InstanceActivity
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