Add vm_type to the log info

This commit is contained in:
PCoder 2020-12-10 09:05:04 +05:30
parent 01d8cc1b9b
commit 22d3b1f83c

View file

@ -41,15 +41,17 @@ class Command(BaseCommand):
) )
if vm_id and vm_id > 0: if vm_id and vm_id > 0:
result_dict[vm_name] = "%s OK, created VM %s" % ( result_dict[vm_name] = "%s OK, created VM %s" % (
'%s %s' % (vm_template.opennebula_vm_template_id, '%s %s %s' % (vm_template.opennebula_vm_template_id,
vm_template.name), vm_template.name, vm_template.vm_type),
vm_id vm_id
) )
self.stdout.write(self.style.SUCCESS(result_dict[vm_name])) self.stdout.write(self.style.SUCCESS(result_dict[vm_name]))
manager.delete_vm(vm_id) manager.delete_vm(vm_id)
else: else:
result_dict[vm_name] = '''Error creating VM %s, template_id result_dict[vm_name] = '''Error creating VM %s, template_id
%s ''' % (vm_name, vm_template.opennebula_vm_template_id) %s %s''' % (vm_name,
vm_template.opennebula_vm_template_id,
vm_template.vm_type)
self.stdout.write(self.style.ERROR(result_dict[vm_name])) self.stdout.write(self.style.ERROR(result_dict[vm_name]))
sleep(1) sleep(1)
date_str = datetime.datetime.strftime( date_str = datetime.datetime.strftime(