def _backup(task, backup_type): task_uuid = task.uuid params = db.task_parameter_get_all_by_task_uuid(task_uuid) rotation = params.get('rotation', '0') try: rotation = int(rotation) except ValueError: logger.error("Invalid rotation '%(rotation)s' for task" " '%(task_uuid)s'" % locals()) rotation = 0 backup_name = backup_type common_utils.execute( 'nova', 'backup', task.instance_uuid, backup_name, backup_type, str(rotation))
def snapshot(task): snapshot_name = 'snapshot' common_utils.execute( 'nova', 'image-create', task.instance_uuid, snapshot_name)
def update(): """Updates the crontab based on the state of the DB.""" try: common_utils.execute('crontab', '-', process_input=crontab()) except common_exception.ProcessExecutionError as e: logger.exception(e)