uncloud-mravi/uncloud/uncloud_vm/management/commands/schedulevms.py
Ahmed Bilal 0c7ca1147a fix migrations the ugly way
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
2020-02-26 11:31:17 +01:00

21 lines
578 B
Python

import json
import uncloud.secrets as secrets
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from uncloud_vm.models import VMProduct, VMHost
class Command(BaseCommand):
help = 'Select VM Host for VMs'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
pending_vms = VMProduct.objects.filter(vmhost__isnull=True)
vmhosts = VMHost.objects.filter(status='active')
for vm in pending_vms:
print(vm)
# FIXME: implement smart placement