ucloud-host can not be started by using hostname

This commit is contained in:
ahmadbilalkhalid 2019-11-12 11:50:41 +05:00
parent da5a600ccb
commit e37222c1c7
4 changed files with 40 additions and 18 deletions

View File

@ -12,6 +12,7 @@ Welcome to ucloud's documentation!
introduction/introduction
introduction/installation
introduction/usage
Indices and tables
==================

View File

@ -184,17 +184,3 @@ profile e.g *~/.profile*
alias uotp='cd /root/uotp/ && pipenv run python app.py'
and run :code:`source ~/.profile`
Running ucloud
~~~~~~~~~~~~~~
.. code-block:: sh
ucloud api
We need to create a host by executing the following command
.. code-block:: sh

View File

@ -0,0 +1,35 @@
Usage
=====
Start API
----------
.. code-block:: sh
ucloud api
Host Creation
-------------
Currently, we don't have any host (that runs virtual machines).
So, we need to create it by executing the following command
.. code-block:: sh
ucloud-cli host create --hostname ungleich.ch --cpu 32 --ram '32GB' --os-ssd '32GB'
You should see something like the following
.. code-block:: json
{
"message": "Host Created"
}
Start Scheduler
---------------
.. code-block:: sh
ucloud scheduler

View File

@ -19,8 +19,8 @@ import etcd3
def update_heartbeat(host):
client = Etcd3Wrapper(*etcd_wrapper_args, **etcd_wrapper_kwargs)
host_pool = HostPool(client, HOST_PREFIX)
this_host = host_pool.get(host)
this_host = next(filter(lambda h: h.hostname == host, host_pool.hosts), None)
while True:
this_host.update_heartbeat()
host_pool.put(this_host)
@ -78,8 +78,8 @@ def main():
heartbeat_updating_process = mp.Process(target=update_heartbeat, args=(args.hostname,))
host_pool = HostPool(etcd_client, HOST_PREFIX)
host = host_pool.get(args.hostname)
assert host, "No such host"
host = next(filter(lambda h: h.hostname == args.hostname, host_pool.hosts), None)
assert host is not None, "No such host"
try:
heartbeat_updating_process.start()