-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Start blog article on diskless flavors. * Added a few links. Filled Why SSD flavors section. * Rename to 2023-08-21 to reflect planned publication date. * Picture for a diskless flavor. * Add horizon vm instance creation screenshot. * Add openstack SDK example * Example script to create a diskless VM. * openstack client usage. * terraform, capo and k8s-capi documentation complete. * ispell found a few typos ... * Add TL;DR. * Fix avatar link. * Add missing patch. * Add link from de to en. Two wording fixes. * Also copy _assets/scripts directory into build. * Lots of wording fixes from Filip. * Avoid the term diskful(l). Clarify flavor with disk downgrade. This implements two suggestions from Filip in a slightly different way. * Another attempt to the right asset syntax. Signed-off-by: Kurt Garloff <[email protected]> Co-authored-by: Filip Dobrovolný <[email protected]>
- Loading branch information
1 parent
5e268ec
commit 017555d
Showing
7 changed files
with
471 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
# Create a VM on a diskless flavor | ||
# (c) Kurt Garloff <[email protected]>, 2023-08-20 | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import openstack | ||
import sys | ||
|
||
# OS_CLOUD will be taken from environment | ||
FLAVOR="SCS-1V-2" | ||
NETWORK="" | ||
IMAGE="Debian 12" | ||
KEYNAME="SSHkey-gxscscapi" | ||
|
||
def main(argv): | ||
""" | ||
Creates a server on a diskless flavor in a cloud env["OS_CLOUD"] | ||
(configured in clouds.yaml+secure.yaml) with flavor FLAVOR | ||
in network NETWORK (defaults to first if empty) with image IMAGE | ||
injecting keypair KEYNAME. | ||
""" | ||
# Connect and get token | ||
conn = openstack.connect() | ||
conn.authorize() | ||
# Get flavor and image IDs | ||
flavor = conn.compute.find_flavor(FLAVOR) | ||
if not flavor: | ||
raise ValueError(f"No flavor {FLAVOR} found") | ||
image = conn.compute.find_image(IMAGE) | ||
if not image: | ||
raise ValueError(f"No image {IMAGE} found") | ||
# Determine network to connect to | ||
found_network = None | ||
for net in conn.network.networks(): | ||
if not net.is_admin_state_up or net.is_router_external: | ||
continue | ||
if not NETWORK or net.name == NETWORK: | ||
found_network = net | ||
break | ||
if found_network is None: | ||
raise ValueError(f"No network {NETWORK} found") | ||
# Create VM instance | ||
vm = conn.compute.create_server( | ||
name="test-diskless", | ||
networks=[{"uuid": found_network.id}], | ||
flavor_id=flavor.id, | ||
key_name=KEYNAME, | ||
block_device_mapping_v2=[{'boot_index': 0, | ||
'uuid': image.id, | ||
'source_type': 'image', | ||
'volume_size': 12, | ||
'destination_type': 'volume', | ||
'delete_on_termination': True} | ||
] | ||
) | ||
|
||
if __name__ == "__main__": | ||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- openstackclient/compute/v2/server.py.orig 2021-03-20 10:17:40.000000000 +0100 | ||
+++ openstackclient/compute/v2/server.py 2023-07-03 15:59:27.301268807 +0200 | ||
@@ -802,7 +802,7 @@ class CreateServer(command.ShowOne): | ||
help=_('Create server with this flavor (name or ID)'), | ||
) | ||
disk_group = parser.add_mutually_exclusive_group( | ||
- required=True, | ||
+ required=False, | ||
) | ||
disk_group.add_argument( | ||
'--image', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../en/_posts/blog/2023-08-21-diskless-flavors.md |
Oops, something went wrong.