forked from uncloud/uncloud
22 lines
578 B
Python
22 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
|