vinfra service compute server create
Create a new virtual machine:
usage: vinfra service compute server create [--description <description>] [--metadata <metadata>] [--user-data <user-data>] [--key-name <key-name>] [--config-drive] [--count <count>] [--ha-enabled {true,false}] [--placements <placements>] [--allow-live-resize] --network id|<id=id[,key=value,…]> --volume <source=source [,key=value,…]> --flavor <flavor> <server-name>
--description <description>
- Virtual machine description
--metadata <metadata>
- Virtual machine metadata
--user-data <user-data>
- User data file
--key-name <key-name>
- Key pair to inject
--config-drive
- Use an ephemeral drive
--count <count>
- If count is specified and greater than 1, the
name
argument is treated as a naming pattern. --ha-enabled {true,false}
- Enable or disable HA for the virtual machine.
--placements <placements>
- Names or IDs of placements to add the virtual machine to.
--allow-live-resize
- Allow online resize for the virtual machine.
--network id|<id=id[,key=value,…]>
-
Create a virtual machine with a specified network. Specify this option multiple times to create multiple networks.
id
: attach network interface to a specified network (ID or name)- comma-separated
key=value
pairs with keys (optional):mac
: MAC address for network interfacefixed-ip
: fixed IP address orNone
to automatically allocate an IP address. This option can be used multiple times.spoofing-protection-enable
: enable spoofing protection for network interfacespoofing-protection-disable
: disable spoofing protection for network interfacesecurity-group
: security group ID or name. This option can be used multiple times.no-security-group
: do not use a security group
--volume <source=source[,key=value,…]>
-
Create a virtual machine with a specified volume. Specify this option multiple times to create multiple volumes.
source
: source type (volume
,image
,snapshot
, orblank
)- comma-separated
key=value
pairs with keys (optional):id
: resource ID or name for the specified source type (required for source typesvolume
,image
, andsnapshot
)size
: block device size, in gigabytes (required for source typesimage
andblank
)boot-index
: block device boot index (required for multiple volumes with source typevolume
)bus
: block device controller type (scsi
)type
: block device type (disk
orcdrom
)rm
: remove block device on virtual machine termination (yes
orno
)storage-policy
: block device storage policy
--flavor <flavor>
- Flavor ID or name
<server-name>
- A new name for the virtual machine
Example:
# vinfra service compute server create myvm \ --network id=private,fixed-ip=192.168.128.100 \ --volume source=image,id=cirros,size=1 --flavor tiny +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | allow_live_resize | False | | config_drive | | | created | 2019-05-29T11:24:04Z | | description | | | flavor | disk: 0 | | | ephemeral: 0 | | | extra_specs: {} | | | original_name: tiny | | | ram: 512 | | | swap: 0 | | | vcpus: 1 | | ha_enabled | True | | host | | | id | 8cd29296-8bee-4efb-828d-0e522d816c6e | | key_name | | | metadata | {} | | name | myvm | | networks | [] | | power_state | NOSTATE | | project_id | b4267de6fd0c442da99542cd20f5932c | | status | BUILD | | task_state | scheduling | | updated | 2019-05-29T11:24:21Z | | user_data | | | vm_state | building | | volumes | [] | +-------------------+--------------------------------------+
This command creates a virtual machine myvm
based on the default Cirros image and the flavor tiny
, connects it to the network private
with the fixed IP address 192.168.128.100, and enables HA for it.