From 1cf9a07288cfad33fcf0ecabacdf537dfe75f67b Mon Sep 17 00:00:00 2001 From: Derek Noble Date: Fri, 15 Mar 2024 16:59:36 -0500 Subject: [PATCH 1/5] DOC: Openstack Server Docs --- docs/openstack-servers.md | 148 ++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 149 insertions(+) create mode 100644 docs/openstack-servers.md diff --git a/docs/openstack-servers.md b/docs/openstack-servers.md new file mode 100644 index 00000000..6875d8f7 --- /dev/null +++ b/docs/openstack-servers.md @@ -0,0 +1,148 @@ +# Openstack Servers + +To read more about Openstack Servers using the [upstream docs](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/server.html). + +#### List and view servers + +``` shell +$ openstack server list + [--quote {all,minimal,none,nonnumeric}] + [--reservation-id ] + [--ip ] + [--ip6 ] + [--name ] + [--instance-name ] + [--status ] + [--flavor ] + [--image ] + [--host ] + [--all-projects] + [--project ] + [--project-domain ] + [--user ] + [--user-domain ] + [--long] + [-n] + [--marker ] + [--limit ] + [--deleted] + [--changes-since ] +``` + +#### Create a new server + +``` shell +$ openstack server create + (--image | --volume ) + --flavor + [--security-group ] + [--key-name ] + [--property ] + [--file ] + [--user-data ] + [--availability-zone ] + [--block-device-mapping ] + [--nic ] + [--network ] + [--port ] + [--hint ] + [--config-drive |True] + [--min ] + [--max ] + [--wait] + +``` + +#### Delete a server + +``` shell +$ openstack server delete [--wait] [ ...] +``` + +# Launch a server from a snapshot + +#### Create a snapshot of the instance + +!!! note + + If necessary, list the instances to view the instance name with the list server command above. + +1. Shut down the source VM before you take the snapshot to ensure that all data is flushed to disk. Use the openstack server stop command to shut down the instance: + + ``` shell + $ openstack server stop myInstance + ``` +2. Use the openstack server list command to confirm that the instance shows a SHUTOFF status. + +3. Use the openstack server image create command to take a snapshot: + + ``` shell + $ openstack server image create myInstance --name myInstanceSnapshot + ``` + The above command creates the image myInstance by taking a snapshot of a running server. +4. Use the openstack image list command to check the status until the status is active: + + ``` shell + $ openstack image list + ``` +#### Download the snapshot + +!!! note + + Get the image id from the image list command (seen above). + +Download the snapshot by using the image ID: + +``` shell +$ openstack image save --file snapshot.raw {Image ID} +``` + +Make the image available to the new environment, either through HTTP or direct upload to a machine (scp). + +#### Import the snapshot to the new env + +In the new project or cloud environment, import the snapshot: + +``` shell +$ openstack image create NEW_IMAGE_NAME \ + --container-format bare --disk-format qcow2 --file IMAGE_URL +``` + +#### Boot a new sever from the snapshot + +In the new project or cloud environment, use the snapshot to create the new instance: + +``` shell +$ openstack server create --flavor m1.tiny --image myInstanceSnapshot myNewInstance +``` + +# Launch a server from a volume + +#### Boot instance from volume + +You can create a bootable volume from an existing image, volume, or snapshot. This procedure shows you how to create a volume from an image and use the volume to boot an instance. + +1. List available images, noting the ID of the image that you wish to use. + ``` shell + $ openstack image list + ``` +2. Create a bootable volume from the chosen image. + ``` shell + $ openstack volume create \ + --image {Image ID} --size 10 \ + test-volume + ``` +3. Create a server, specifying the volume as the boot device. + ``` shell + $ openstack server create \ + --flavor $FLAVOR --network $NETWORK \ + --volume {Volume ID}\ + --wait test-server + ``` +4. List volumes once again to ensure the status has changed to in-use and the volume is correctly reporting the attachment. + ``` shell + $ openstack volume list + ``` + ``` shell + $ openstack server volume list test-server + ``` diff --git a/mkdocs.yml b/mkdocs.yml index 0c30a84a..58ff1f0b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -209,3 +209,4 @@ nav: - Cloud Onboarding: - Openstack Security Groups: openstack-security-groups.md - Openstack Floating Ips: openstack-floating-ips.md + - Openstack Servers: openstack-servers.md From fcf27b6bd2beefdcaa02988691feec5d4fba5bf5 Mon Sep 17 00:00:00 2001 From: Derek Noble Date: Fri, 15 Mar 2024 17:03:45 -0500 Subject: [PATCH 2/5] Fixing spacing issues --- docs/openstack-servers.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/openstack-servers.md b/docs/openstack-servers.md index 6875d8f7..8822251d 100644 --- a/docs/openstack-servers.md +++ b/docs/openstack-servers.md @@ -79,12 +79,14 @@ $ openstack server delete [--wait] [ ...] ``` shell $ openstack server image create myInstance --name myInstanceSnapshot ``` + The above command creates the image myInstance by taking a snapshot of a running server. 4. Use the openstack image list command to check the status until the status is active: ``` shell $ openstack image list - ``` + ``` + #### Download the snapshot !!! note @@ -131,7 +133,8 @@ You can create a bootable volume from an existing image, volume, or snapshot. Th $ openstack volume create \ --image {Image ID} --size 10 \ test-volume - ``` + ``` + 3. Create a server, specifying the volume as the boot device. ``` shell $ openstack server create \ From 4eaf6731382deceb1d609f48ba3fbbe847137d6a Mon Sep 17 00:00:00 2001 From: Derek Noble Date: Sun, 17 Mar 2024 15:23:57 -0500 Subject: [PATCH 3/5] trailing white space --- docs/openstack-servers.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/openstack-servers.md b/docs/openstack-servers.md index 8822251d..4fc74d8c 100644 --- a/docs/openstack-servers.md +++ b/docs/openstack-servers.md @@ -79,14 +79,14 @@ $ openstack server delete [--wait] [ ...] ``` shell $ openstack server image create myInstance --name myInstanceSnapshot ``` - - The above command creates the image myInstance by taking a snapshot of a running server. + The above command creates the image myInstance by taking a snapshot of a running server. + 4. Use the openstack image list command to check the status until the status is active: ``` shell $ openstack image list ``` - + #### Download the snapshot !!! note @@ -134,7 +134,6 @@ You can create a bootable volume from an existing image, volume, or snapshot. Th --image {Image ID} --size 10 \ test-volume ``` - 3. Create a server, specifying the volume as the boot device. ``` shell $ openstack server create \ From 447b00b6149cb450eda2378a7beecb968e4b5a0c Mon Sep 17 00:00:00 2001 From: Derek Noble Date: Mon, 18 Mar 2024 12:27:29 -0500 Subject: [PATCH 4/5] updated links to latests docs --- docs/openstack-floating-ips.md | 2 +- docs/openstack-servers.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/openstack-floating-ips.md b/docs/openstack-floating-ips.md index d8cc37e9..015567a6 100644 --- a/docs/openstack-floating-ips.md +++ b/docs/openstack-floating-ips.md @@ -1,6 +1,6 @@ # Openstack Floating Ips -To read more about Openstack Floating Ips using the [upstream docs](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/floating-ip.html). +To read more about Openstack Floating Ips using the [upstream docs](https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/floating-ip.html). #### List and view floating ips diff --git a/docs/openstack-servers.md b/docs/openstack-servers.md index 4fc74d8c..7a62144a 100644 --- a/docs/openstack-servers.md +++ b/docs/openstack-servers.md @@ -1,6 +1,6 @@ # Openstack Servers -To read more about Openstack Servers using the [upstream docs](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/server.html). +To read more about Openstack Servers using the [upstream docs](https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/server.html). #### List and view servers From cc32cb1fdea4a31d6bd342934a56159ddeaec094 Mon Sep 17 00:00:00 2001 From: Derek Noble Date: Tue, 19 Mar 2024 10:18:29 -0500 Subject: [PATCH 5/5] Resolved requested changes --- docs/openstack-servers.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/openstack-servers.md b/docs/openstack-servers.md index 7a62144a..83f81501 100644 --- a/docs/openstack-servers.md +++ b/docs/openstack-servers.md @@ -5,7 +5,7 @@ To read more about Openstack Servers using the [upstream docs](https://docs.open #### List and view servers ``` shell -$ openstack server list +openstack server list [--quote {all,minimal,none,nonnumeric}] [--reservation-id ] [--ip ] @@ -32,7 +32,7 @@ $ openstack server list #### Create a new server ``` shell -$ openstack server create +openstack server create (--image | --volume ) --flavor [--security-group ] @@ -56,7 +56,7 @@ $ openstack server create #### Delete a server ``` shell -$ openstack server delete [--wait] [ ...] +openstack server delete [--wait] [ ...] ``` # Launch a server from a snapshot @@ -70,21 +70,22 @@ $ openstack server delete [--wait] [ ...] 1. Shut down the source VM before you take the snapshot to ensure that all data is flushed to disk. Use the openstack server stop command to shut down the instance: ``` shell - $ openstack server stop myInstance + openstack server stop myInstance ``` + 2. Use the openstack server list command to confirm that the instance shows a SHUTOFF status. 3. Use the openstack server image create command to take a snapshot: ``` shell - $ openstack server image create myInstance --name myInstanceSnapshot + openstack server image create myInstance --name myInstanceSnapshot ``` The above command creates the image myInstance by taking a snapshot of a running server. 4. Use the openstack image list command to check the status until the status is active: ``` shell - $ openstack image list + openstack image list ``` #### Download the snapshot @@ -96,7 +97,7 @@ $ openstack server delete [--wait] [ ...] Download the snapshot by using the image ID: ``` shell -$ openstack image save --file snapshot.raw {Image ID} +openstack image save --file snapshot.raw {Image ID} ``` Make the image available to the new environment, either through HTTP or direct upload to a machine (scp). @@ -106,7 +107,7 @@ Make the image available to the new environment, either through HTTP or direct u In the new project or cloud environment, import the snapshot: ``` shell -$ openstack image create NEW_IMAGE_NAME \ +openstack image create NEW_IMAGE_NAME \ --container-format bare --disk-format qcow2 --file IMAGE_URL ``` @@ -115,9 +116,10 @@ $ openstack image create NEW_IMAGE_NAME \ In the new project or cloud environment, use the snapshot to create the new instance: ``` shell -$ openstack server create --flavor m1.tiny --image myInstanceSnapshot myNewInstance +openstack server create --flavor m1.tiny --image myInstanceSnapshot myNewInstance ``` + # Launch a server from a volume #### Boot instance from volume @@ -126,11 +128,11 @@ You can create a bootable volume from an existing image, volume, or snapshot. Th 1. List available images, noting the ID of the image that you wish to use. ``` shell - $ openstack image list + openstack image list ``` 2. Create a bootable volume from the chosen image. ``` shell - $ openstack volume create \ + openstack volume create \ --image {Image ID} --size 10 \ test-volume ``` @@ -143,8 +145,8 @@ You can create a bootable volume from an existing image, volume, or snapshot. Th ``` 4. List volumes once again to ensure the status has changed to in-use and the volume is correctly reporting the attachment. ``` shell - $ openstack volume list + openstack volume list ``` ``` shell - $ openstack server volume list test-server + openstack server volume list test-server ```