Refactoring, VMM added, uncloud-host mostly new, migration is better now
This commit is contained in:
		
					parent
					
						
							
								cd9d4cb78c
							
						
					
				
			
			
				commit
				
					
						ba515f0b48
					
				
			
		
					 12 changed files with 423 additions and 364 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
import json
 | 
			
		||||
import pynetbox
 | 
			
		||||
import logging
 | 
			
		||||
import urllib3
 | 
			
		||||
 | 
			
		||||
from uuid import uuid4
 | 
			
		||||
from os.path import join as join_path
 | 
			
		||||
| 
						 | 
				
			
			@ -78,6 +77,7 @@ class CreateVM(Resource):
 | 
			
		|||
                "vnc_socket": "",
 | 
			
		||||
                "network": list(zip(data["network"], macs, tap_ids)),
 | 
			
		||||
                "metadata": {"ssh-keys": []},
 | 
			
		||||
                "in_migration": False
 | 
			
		||||
            }
 | 
			
		||||
            shared.etcd_client.put(vm_key, vm_entry, value_in_json=True)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -216,16 +216,13 @@ class VMMigration(Resource):
 | 
			
		|||
 | 
			
		||||
        if validator.is_valid():
 | 
			
		||||
            vm = shared.vm_pool.get(data["uuid"])
 | 
			
		||||
            r = RequestEntry.from_scratch(type=RequestType.InitVMMigration,
 | 
			
		||||
                                          uuid=vm.uuid,
 | 
			
		||||
                                          hostname=join_path(
 | 
			
		||||
                                              settings['etcd']['host_prefix'], validator.destination.value
 | 
			
		||||
                                          ),
 | 
			
		||||
                                          request_prefix=settings['etcd']['request_prefix'])
 | 
			
		||||
 | 
			
		||||
            r = RequestEntry.from_scratch(
 | 
			
		||||
                type=RequestType.ScheduleVM,
 | 
			
		||||
                uuid=vm.uuid,
 | 
			
		||||
                destination=join_path(
 | 
			
		||||
                    settings['etcd']['host_prefix'], validator.destination.value
 | 
			
		||||
                ),
 | 
			
		||||
                migration=True,
 | 
			
		||||
                request_prefix=settings['etcd']['request_prefix']
 | 
			
		||||
            )
 | 
			
		||||
            shared.request_pool.put(r)
 | 
			
		||||
            return {"message": "VM Migration Initialization Queued"}, 200
 | 
			
		||||
        else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue