Remove pending vm handling mechanism from scheduler + fixed issue that update VM's hostname even on migration failure

This commit is contained in:
ahmadbilalkhalid 2019-12-30 20:05:12 +05:00
commit d13a4bcc37
5 changed files with 40 additions and 94 deletions

View file

@ -17,8 +17,6 @@ from . import logger
def main():
pending_vms = []
for request_iterator in [
shared.etcd_client.get_prefix(
settings["etcd"]["request_prefix"], value_in_json=True
@ -44,24 +42,8 @@ def main():
logger.debug("Dead hosts: %s", dead_hosts)
dead_host_mitigation(dead_hosts)
# If there are VMs that weren't assigned a host
# because there wasn't a host available which
# meets requirement of that VM then we would
# create a new ScheduleVM request for that VM
# on our behalf.
while pending_vms:
pending_vm_entry = pending_vms.pop()
r = RequestEntry.from_scratch(
type="ScheduleVM",
uuid=pending_vm_entry.uuid,
hostname=pending_vm_entry.hostname,
request_prefix=settings["etcd"][
"request_prefix"
],
)
shared.request_pool.put(r)
elif request_entry.type == RequestType.ScheduleVM:
print(request_event.value)
logger.debug(
"%s, %s", request_entry.key, request_entry.value
)
@ -86,7 +68,6 @@ def main():
)
shared.vm_pool.put(vm_entry)
pending_vms.append(vm_entry)
logger.info("No Resource Left. Emailing admin....")