Changing the BMS OS
Function
This API is used to change the BMS OS. Password and key pair injection are supported during OS change.
This is an asynchronous API. Calling the API successfully indicates that the task is delivered successfully. To check whether the task is successful, use the Querying Task Statuses API.
Constraints
- Only a stopped BMS or a BMS on which changing the OS failed supports changing OS.
- For BMSs created from private images, ensure that Cloud-Init (for Linux) or Cloudbase-Init (for Windows) has been installed for the image. If an image without Cloud-Init or Cloudbase-Init is used, this API cannot inject a key pair or password. Cloud-Init or Cloudbase-Init has been installed for public images by default.
- You are not allowed to perform other operations when changing the OS. Otherwise, changing the OS will fail.
- Windows images do not support password injection. For Linux images, user_data is the encrypted password.
URI
POST /v1/{project_id}/baremetalservers/{server_id}/changeos
Parameter |
Mandatory |
Description |
---|---|---|
X-Auth-Token |
Yes |
Specifies the user token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
project_id |
Yes |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
server_id |
Yes |
Specifies the BMS ID. You can obtain the BMS ID from the BMS console or by calling the Querying BMSs (Discarded). |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
os-change |
Yes |
Object |
Specifies the operation to change the BMS OS. For details, see Table 2. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
adminpass |
No |
String |
Specifies the initial login password of the BMS administrator account. The Linux administrator is root, and the Windows administrator is Administrator. Recommended password complexity requirements are as follows:
NOTE:
|
keyname |
No |
String |
Specifies the key pair name. You can create a key pair using the Creating or Importing an SSH Key Pair (Native OpenStack API) API, or query existing key pairs using the Querying SSH Key Pairs (Native OpenStack API) API. |
userid |
No |
String |
Specifies the user ID. You can obtain the user ID from My Credential on the management console. |
imageid |
Yes |
String |
Specifies the image ID. You can obtain the image ID from the IMS console or by following the instructions in Querying Images in Image Management Service API Reference. When using the API for querying images, you can add field ?virtual_env_type=Ironic to filter BMS images. |
metadata |
No |
Object |
Specifies the BMS metadata. For details, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
user_data |
No |
String |
Specifies the Linux image root password injected during the BMS OS change. It is a user-defined initial password. Note: The password change script must be encoded using Base64. Recommended password complexity requirements are as follows:
An example is as follows:
where, $6$V6azyeLwcD3CHlpY$BN3VVq18fmCkj66B4zdHLWevqcxlig is the ciphertext password, which can be generated as follows:
|
Example Request
1
|
POST https://{BMS Endpoint}/v1/bbf1946d374b44a0a2a95533562ba954/baremetalservers/cf2a8b97-b5c6-47ef-9714-eb27adf26e5b/changeos |
1 2 3 4 5 6 7 8 9 10 |
{ "os-change": { "keyname": "$key_name", "imageid": "04dc740a-5820-4ab6-9d01-8cd3a6577296", "userid": "7e25b1da389f4697a79df3a0e5bd494e", "metadata": { "user_data": "$USER_DATA" } } } |
Response Parameters
- Normal Response
Parameter |
Type |
Description |
---|---|---|
jobId |
String |
Specifies the task ID returned after a task command is issued. The task ID can be used to query the execution status of the task. For details about how to query the task execution status based on job_id, see Querying Task Statuses. |
- Abnormal Response
Parameter |
Type |
Description |
---|---|---|
error |
dict |
Specifies the error returned when a task submission encounters an exception. For details, see Table 6. |
Example Response
- Normal response
{ "jobId": "9288ec8d769dbc9b01769dc8f261002f" }
Returned Values
Returned Values |
Description |
---|---|
200 |
The request has been successfully processed. |
For details about other returned values, see Status Codes.
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot