Create virtual machines with a custom user direct for z/VM
The IBM® Cloud Infrastructure Center supports creating a virtual
machine with a custom user direct for the z/VM hypervisor. This
custom user direct defines custom values for CPU share, max memory,
and comments for the virtual machine. You can confirm the user
direct using the
USER
statement in
the output of the command
smcli Image_Query_DM -T
<userid>
on the compute node hosting the
virtual machine. Here,
<userid>
corresponds to the
Instance id
column
on the virtual machines' list page. For more information, see
SHARE Directory Statement and
Calculating a User's Share of Resources.
You can also define custom max memory for the virtual machine. For more information, see Deploy virtual machine with max Memory.
By default, the CPU share of a virtual machine is determined by
the
user_default_share_unit
configuration item in the
/etc/zvmsdk/zvmsdk.conf
file on the
compute node during deployment. If
user_default_share_unit
is set to
100
, the share value for a deployed
virtual machine is calculated by multiplying the
user_default_share_unit
by the vCPU
count of the virtual machine. For example, if a virtual machine is
configured with 2 vCPUs and the
user_default_share_unit
is set to
100, then the share value will be
200.
You can also specify the CPU share value when creating a virtual machine. If you specify a CPU share value during creation, it overrides the default setting.
Note:
- This feature is supported only for z/VM hypervisor.
- The custom fields can be specified through the UI, command line, or API.
- You can deploy a virtual machine with absolute CPU share, relative CPU share, and comment.
- Absolute CPU share value must be between 0.1% and 100%.
- Relative CPU share value must be between 1 and 10000.
- Comment length must be less than 72 characters.
- No changes can be made to the deployed VMs.
- No changes can be made once the VM is deployed using custom share.
- Resizing of CPU and memory is supported for VMs deployed with custom user direct.
- Only an administrator can specify the custom user direct size when creating the virtual machine. Other users are not allowed to do this action. For detailed information on roles and users, see Managing roles.
- On the Images page, select the z/VM image you want to deploy and click Deploy.
- On the Images > Deploy
<image_name> page, specify the custom user direct
value in the
Instance Extra Specsfield using the following format:- For only absolute share:
{"general:cpu_share": "ABSOLUTE 50%"} - For only relative share:
{"general:cpu_share": "RELATIVE 150"} - For Share ABS with max_memory:
{"general:max_mem": "20G", "general:cpu_share": "ABSOLUTE 50%"} - CPU Share REL with max_memory:
{"general:max_mem": "20G", "general:cpu_share": "RELATIVE 150"} - CPU Share ABS with comment:
{"general:max_mem": "20G", "general:cpu_share": "RELATIVE 150", "general:comment": "CPU Share with Absolute"}.
- For only absolute share:
- Click the Deploy button to deploy a new virtual machine with the specified custom user direct size.
You can also create a custom flavor with a specified custom user direct size and then deploy a new virtual machine using that flavor.
- On the Configuration / Compute Templates page, click Create.
- On the Create Compute Template page, specify
the custom user direct size using the format
{"general:max_mem":"<number>G"}in theInstance Extra Specsfield, For example:{"general:cpu_share":"ABSOLUTE 50%"}sets the custom user direct for CPU share toABSOLUTE 50%for the virtual machine. After entering this, proceed to select other options and input the required information, and click Create Compute Template. - On the Images page, select the z/VM image you want to deploy and click Deploy.
- On the Images Deploy page, select the compute template with the custom user direct size created in step 2 for the Compute template field. Proceed to select other options and input the required information.
- Click the Deploy button to deploy a new virtual machine with the specified custom user direct size.
-
Use the authorized username and password to access the IBM Cloud Infrastructure Center CLI according to Setting environment variables.
-
Create the virtual machine with the command:
openstack server create --image <image> --flavor <flavor> --network <network> --property 'general:cpu_share=ABSOLUTE 50%' --property 'general:comment=CPU Share with Absolute' <vm-name>or
openstack server create --image <image> --flavor <flavor> --network <network> --property 'general:cpu_share=RELATIVE 150' --property 'general:comment=CPU Share with Relative' <vm-name> -
Use the command
openstack server listto check the virtual machine's creation status. You can also check its status in the UI.
-
To deploy a new virtual machine with a specified custom user direct size via the API, include
"general:cpu_share":"ABSOLUTE 50%"in theextra_specsproperty of theflavorin the request body. Here is an example of the request body:{"server": { "name": "TestVM", "imageRef": "<image_id>", "networks": "<network_id>", "metadata": { ... }, "flavor":{ ..., "extra_specs":{ ..., "general:cpu_share": "ABSOLUTE 50%", "general:comment": "CPU Share with Absolute" } }, "min_count": 1, "max_count": 1 } } -
To deploy a new virtual machine with a specified custom user direct size via the API, include
"general:cpu_share":"RELATIVE 150"in theextra_specsproperty of theflavorin the request body. Here is an example of the request body:{"server": { "name": "TestVM", "imageRef": "<image_id>", "networks": "<network_id>", "metadata": { ... }, "flavor":{ ..., "extra_specs":{ ..., "general:cpu_share": "RELATIVE 150", "general:comment": "CPU Share with Relative" } }, "min_count": 1, "max_count": 1 } }
Following is an example output from the smcli command, showcasing the custom user direct configuration for a virtual machine:
[root@xyz_cmp_node1 site-packages]# smcli Image_Query_DM -T ZWICIC60
USER ZWICIC60 LBYONLY 4G 20G G <<< Max memory went along with the CPU share
COMMAND SET VCONFIG MODE LINUX
COMMAND DEFINE CPU 00 TYPE IFL
COMMAND DEF STOR INITIAL STANDBY REMAINDER
IPL 0100
LOGONBY GRPDVLOP
MACHINE ESA 32
SHARE ABSOLUTE 50% <<< manual addition
NICDEF 1000 TYPE QDIO DEVICES 3 MACID 9031AF LAN SYSTEM VSICIC
MDISK 0100 3390 607131 14564 T60101 MR
*DVHOPT LNK0 LOG1 RCM1 SMS0 NPW1 LNGAMENG PWC20240627 CRCXX