uncloud-mravi/uncloud/uncloud_vm/management/commands/schedulevms.py
2020-02-25 22:01:55 +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