def add_event(api): event_params = params.Event( description='ovirt-system-tests description', custom_id=int('01234567890'), severity='NORMAL', origin='ovirt-system-tests', cluster=params.Cluster(name=TEST_CLUSTER, ), ) nt.assert_true(api.events.add(event_params))
def log_event(self, vm, msg, severity): # Funcion para manejo de LOG try: vm_obj = self.api.vms.get(vm) self.api.events.add( params.Event(vm=vm_obj, origin='vm-backup', description=msg, severity=severity, custom_id=int(time.time()))) except: pass
def add_event(ret_code, time_taken): if ret_code == 0: desc = _EVT_BACKUP_SUCCEEDED_MSG.format(args.mastervol, time_taken) sev = "NORMAL" else: desc = _EVT_BACKUP_FAILED_MSG.format(args.mastervol) sev = "ALERT" t = datetime.datetime.now() eventId = int(t.strftime("%s")) event_params = params.Event(description=desc, custom_id=eventId, severity=sev, origin=_EVT_ORIGIN, cluster=api.clusters.get("Default")) api.events.add(event_params)