rename opennebula commands

This commit is contained in:
Nico Schottelius 2020-03-17 14:49:49 +01:00
parent 8356404fe4
commit ac7ea86668
3 changed files with 6 additions and 6 deletions

View file

@ -57,17 +57,17 @@ class Command(BaseCommand):
usable_ram_in_kb = int(host_share.get('TOTAL_MEM', 0)) usable_ram_in_kb = int(host_share.get('TOTAL_MEM', 0))
usable_ram_in_gb = int(usable_ram_in_kb / 2 ** 20) usable_ram_in_gb = int(usable_ram_in_kb / 2 ** 20)
vms = host.get('VMS', {}) or {} # vms cannot be created like this -- Nico, 2020-03-17
vms = vms.get('ID', []) or [] # vms = host.get('VMS', {}) or {}
vms = ','.join(vms) # vms = vms.get('ID', []) or []
# vms = ','.join(vms)
VMHost.objects.update_or_create( VMHost.objects.update_or_create(
hostname=host_name, hostname=host_name,
defaults={ defaults={
'usable_cores': usable_cores, 'usable_cores': usable_cores,
'usable_ram_in_gb': usable_ram_in_gb, 'usable_ram_in_gb': usable_ram_in_gb,
'status': status, 'status': status
'vms': vms
} }
) )
else: else:

View file

@ -83,7 +83,7 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
for one_vm in VMModel.objects.all(): for one_vm in VMModel.objects.all():
# Host on which the VM is currently residing # Host on which the VM is currently residing
host = VMHost.objects.filter(vms__icontains=one_vm.vmid).first() #host = VMHost.objects.filter(vms__icontains=one_vm.vmid).first()
# VCPU, RAM, Owner, Status # VCPU, RAM, Owner, Status
# TODO: Set actual status instead of hard coded 'active' # TODO: Set actual status instead of hard coded 'active'