| 
									
										
										
										
											2019-12-07 12:01:59 +01:00
										 |  |  | .. _admin-guide:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-15 21:11:45 +05:00
										 |  |  | Usage Guide For Administrators
 | 
					
						
							|  |  |  | ==============================
 | 
					
						
							| 
									
										
										
										
											2019-11-12 11:50:41 +05:00
										 |  |  | 
 | 
					
						
							|  |  |  | Start API
 | 
					
						
							|  |  |  | ----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud api
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Host Creation
 | 
					
						
							|  |  |  | -------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-07 12:01:59 +01:00
										 |  |  | Currently, we don't have any host (that runs virtual machines).
 | 
					
						
							| 
									
										
										
										
											2019-11-12 11:50:41 +05:00
										 |  |  | So, we need to create it by executing the following command
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							| 
									
										
										
										
											2019-12-07 12:01:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 11:50:41 +05:00
										 |  |  |     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
 | 
					
						
							|  |  |  | ---------------
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | Scheduler is responsible for scheduling VMs on appropriate host.
 | 
					
						
							| 
									
										
										
										
											2019-11-12 11:50:41 +05:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud scheduler
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | Start Host
 | 
					
						
							|  |  |  | ----------
 | 
					
						
							|  |  |  | Host is responsible for handling the following actions
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * Start VM.
 | 
					
						
							|  |  |  | * Stop VM.
 | 
					
						
							|  |  |  | * Create VM.
 | 
					
						
							|  |  |  | * Delete VM.
 | 
					
						
							|  |  |  | * Migrate VM.
 | 
					
						
							|  |  |  | * Manage Network Resources needed by VMs.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | It uses a hypervisor such as QEMU to perform these actions.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To start host we created earlier, execute the following command
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud host ungleich.ch
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-26 12:04:37 +01:00
										 |  |  | File & image scanners
 | 
					
						
							|  |  |  | --------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-26 12:04:37 +01:00
										 |  |  | Let's assume we have uploaded an *alpine-uploaded.qcow2* disk images to our
 | 
					
						
							|  |  |  | uncloud server. Currently, our *alpine-untouched.qcow2* is not tracked by
 | 
					
						
							|  |  |  | ucloud. We can only make images from tracked files. So, we need to track the
 | 
					
						
							|  |  |  | file by running File Scanner
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud filescanner
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | File Scanner would run, scan your uploaded image and track it. You can check whether your image
 | 
					
						
							|  |  |  | is successfully tracked by executing the :code:`ucloud-cli user files`, It will return something like the following
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. _list-user-files:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: json
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     {
 | 
					
						
							|  |  |  |         "message": [
 | 
					
						
							|  |  |  |             {
 | 
					
						
							|  |  |  |                 "filename": "alpine-untouched.qcow2",
 | 
					
						
							|  |  |  |                 "uuid": "3f75bd20-45d6-4013-89c4-7fceaedc8dda"
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |         ]
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Our file is now being tracked by ucloud. Lets create an OS image using the uploaded file.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | An image belongs to an image store. There are two types of store
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * Public Image Store
 | 
					
						
							|  |  |  | * Private Image Store (Not Implemented Yet)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. note::
 | 
					
						
							| 
									
										
										
										
											2019-11-15 21:11:45 +05:00
										 |  |  |     **Quick Quiz** Have we created an image store yet?
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-15 21:11:45 +05:00
										 |  |  | The answer is **No, we haven't**. Creating a sample image store is very easy.
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | Just execute the following command
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-15 21:11:45 +05:00
										 |  |  |     (cd ~/ucloud && pipenv run python api/create_image_store.py)
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | 
 | 
					
						
							|  |  |  | An image store (with name = "images") would be created. Now, we are fully ready for creating our
 | 
					
						
							|  |  |  | very own image. Executing the following command to create image using the file uploaded earlier
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud-cli image create-from-file --name alpine --uuid 3f75bd20-45d6-4013-89c4-7fceaedc8dda --image-store-name images
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Please note that your **uuid** would be different. See :ref:`List of user files <list-user-files>`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Now, ucloud have received our request to create an image from file. We have to run Image Scanner to make the image.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ucloud imagescanner
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-07 12:01:59 +01:00
										 |  |  | To make sure, that our image is create run :code:`ucloud-cli image list --public`. You would get
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  | output something like the following
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: json
 | 
					
						
							| 
									
										
										
										
											2019-12-07 12:01:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:26:10 +05:00
										 |  |  |     {
 | 
					
						
							|  |  |  |         "images": [
 | 
					
						
							|  |  |  |             {
 | 
					
						
							|  |  |  |                 "name": "images:alpine",
 | 
					
						
							|  |  |  |                 "status": "CREATED"
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |         ]
 | 
					
						
							|  |  |  |     }
 |