Merge branch 'master' of code.ungleich.ch:ucloud/ucloud
This commit is contained in:
commit
adddba518c
1 changed files with 5 additions and 5 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
from ucloud.common.request import RequestEntry, RequestType
|
from ucloud.common.request import RequestEntry, RequestType
|
||||||
from ucloud.config import etcd_client
|
from ucloud.config import etcd_client
|
||||||
from ucloud.config import host_pool, request_pool, vm_pool, env_vars
|
from ucloud.config import host_pool, request_pool, vm_pool, config
|
||||||
from .helper import (get_suitable_host, dead_host_mitigation, dead_host_detection,
|
from .helper import (get_suitable_host, dead_host_mitigation, dead_host_detection,
|
||||||
assign_host, NoSuitableHostFound)
|
assign_host, NoSuitableHostFound)
|
||||||
from . import logger
|
from . import logger
|
||||||
|
@ -18,8 +18,8 @@ def main():
|
||||||
pending_vms = []
|
pending_vms = []
|
||||||
|
|
||||||
for request_iterator in [
|
for request_iterator in [
|
||||||
etcd_client.get_prefix(env_vars.get('REQUEST_PREFIX'), value_in_json=True),
|
etcd_client.get_prefix(config['etcd']['REQUEST_PREFIX'], value_in_json=True),
|
||||||
etcd_client.watch_prefix(env_vars.get('REQUEST_PREFIX'), timeout=5, value_in_json=True),
|
etcd_client.watch_prefix(config['etcd']['REQUEST_PREFIX'], timeout=5, value_in_json=True),
|
||||||
]:
|
]:
|
||||||
for request_event in request_iterator:
|
for request_event in request_iterator:
|
||||||
request_entry = RequestEntry(request_event)
|
request_entry = RequestEntry(request_event)
|
||||||
|
@ -46,7 +46,7 @@ def main():
|
||||||
r = RequestEntry.from_scratch(type="ScheduleVM",
|
r = RequestEntry.from_scratch(type="ScheduleVM",
|
||||||
uuid=pending_vm_entry.uuid,
|
uuid=pending_vm_entry.uuid,
|
||||||
hostname=pending_vm_entry.hostname,
|
hostname=pending_vm_entry.hostname,
|
||||||
request_prefix=env_vars.get("REQUEST_PREFIX"))
|
request_prefix=config['etcd']["REQUEST_PREFIX"])
|
||||||
request_pool.put(r)
|
request_pool.put(r)
|
||||||
|
|
||||||
elif request_entry.type == RequestType.ScheduleVM:
|
elif request_entry.type == RequestType.ScheduleVM:
|
||||||
|
@ -72,7 +72,7 @@ def main():
|
||||||
r = RequestEntry.from_scratch(type=RequestType.InitVMMigration,
|
r = RequestEntry.from_scratch(type=RequestType.InitVMMigration,
|
||||||
uuid=request_entry.uuid,
|
uuid=request_entry.uuid,
|
||||||
destination=request_entry.destination,
|
destination=request_entry.destination,
|
||||||
request_prefix=env_vars.get("REQUEST_PREFIX"))
|
request_prefix=config['etcd']["REQUEST_PREFIX"])
|
||||||
request_pool.put(r)
|
request_pool.put(r)
|
||||||
|
|
||||||
# If the Request is about a VM that just want to get started/created
|
# If the Request is about a VM that just want to get started/created
|
||||||
|
|
Loading…
Reference in a new issue