Maintain the Bare Metal Solution environment

After your Bare Metal Solution environment is up and running, use the information included in this guide to maintain your Bare Metal Solution servers.

Set up your Google Cloud project to use the Bare Metal Solution API

The Bare Metal Solution API provides many tools to let you to monitor and maintain your Bare Metal Solution environment. Typically, you only need to use this procedure the first time you use the Bare Metal Solution API. However, reuse these instructions as needed for troubleshooting purposes in case the API does not respond as expected.

  1. Assign the Bare Metal Solution Admin or Bare Metal Solution Editor predefined IAM role to your principals. To learn how to map IAM roles to principals, see Assign an IAM role to your project principals.

  2. Enable the Bare Metal Solution API in your Cloud project.

    Console

    1. Go to the Bare Metal Solution API in your Google Cloud Console dashboard. You can also search for the Bare Metal Solution API in the API Library here: APIs & Services > Library.
    2. On the Bare Metal Solution API page, click Enable.
    3. Click the Back button on your browser. If you see a green checkmark next to the words API Enabled, you can use the API.

    gcloud

    • To enable the Bare Metal Solution API through gcloud, enter your Google Cloud project ID in the following command, copy the command, paste it into the Cloud Shell prompt, and press the Enter or Return key:

       gcloud services enable baremetalsolution.googleapis.com --project=PROJECT_ID
       

  3. Allow the Cloud SDK to work with your Cloud project.

    1. In your Cloud Shell window, enter the gcloud auth login command.
      gcloud auth login
      
    2. Copy the resulting URL and paste it into a separate browser tab or window.
    3. Log in to the page by using your username associated with your Cloud project.
    4. Click Allow to enable the Cloud SDK.
    5. Copy the authorization code.
    6. Paste the code into your Cloud Shell client command line.
    7. Press the Enter or Return key.

For additional information about the general steps required to set up an API in Google Cloud, see: Getting Started with Google Cloud APIs.

Restart a Bare Metal Solution server

To power off and restart your Bare Metal Solution server, use the following steps.

Make sure you follow the API set up steps

Restarting a server requires you to enable the Bare Metal Solution API and the Cloud SDK. You also need to assign either the Bare Metal Solution Admin or Bare Metal Solution Editor IAM role. To complete the set up steps, see Set up your Google Cloud project to use the Bare Metal Solution API.

Log in to your Bare Metal Solution server to watch the server restart

  1. Open a Cloud Console window.
  2. Navigate to your jump host VM instance: Compute Engine > VM Instances
  3. Click the SSH button to connect to your jump host VM instance.
  4. To log in to your Bare Metal Solution server, enter the SSH command in the jump host command line.

    [username@instance-jump-host ~]$ ssh customeradmin@bms-ip-address>
    customeradmin@bms-ip-address's password: bms-password
    Last login: Mon Mar 15 22:43:19 2021 from bms-ip-address
    [customeradmin@bms-server-name ~]$
     

  5. Enter the top command to verify that the server is running. You can use this window to monitor the progress of the reboot.

Run the restart command

  1. Open the Cloud Shell window.
  2. Add your Cloud project ID and Bare Metal Solution server name into the following command.

     curl -X POST \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "X-Goog-User-Project: project-id" \
     "https://baremetalsolution.googleapis.com/v1/projects/project-id/locations/loc/instances/bms-server-name:resetInstance" --header 'Content-Length: 0'
     

  3. Copy and paste the command into your Cloud Shell window, and press the Enter or Return key.

    Your Bare Metal Solution server powers off and reboots, and open and closed curly braces {} appear as output in your Cloud Shell window. While the server reboots, you cannot use ping or SSH from your jump host VM instance to reach the Bare Metal Solution server.

    After several minutes, the Bare Metal Solution server comes back online.

  4. When the server comes back online, you can successfully issue a ping or use SSH from your jump host VM instance to reach your Bare Metal Solution server.

For more information on restarting your Bare Metal Solution server, see the Bare Metal Solution API.

Manage servers in your Bare Metal Solution environment

Bare Metal Solution management APIs enable you to view the status of the devices in your Bare Metal Solution environment. To see current status, use the following steps.

Make sure you set up the Bare Metal Solution API

Viewing server status requires you to enable the Bare Metal Solution API and the Cloud SDK. You also need to assign one of the Bare Metal Solution IAM roles to your principals, such as Bare Metal Solution Admin or Bare Metal Solution Editor. To complete the API set up steps prior to managing your servers, see Set up your Google Cloud project to use the Bare Metal Solution API.

Run commands to view servers in your Bare Metal Solution environment

When you issue commands to call the Bare Metal Solution management APIs, you can learn about the status of the devices in your Bare Metal Solution environment. To see current status, choose one of the following command options:

Console

  1. Open a Cloud Shell terminal window in your Google Cloud Console.

  2. To list the servers in your Bare Metal Solution environment and see their status, enter your project ID and region into the following curl command, copy the command, paste it into the Cloud Shell prompt, and press the Enter or Return key:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://baremetalsolution.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances"
    
  3. To get network and storage information for a server in your Bare Metal Solution environment, issue the following command:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://baremetalsolution.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/SERVER_NAME"
    

gcloud

  1. To list the servers in your Bare Metal Solution environment and see their status, issue the following gcloud command:

    gcloud alpha bms instances list --project=PROJECT_ID
    

    The following output example shows information for a server, such as the server name, type, IP addresses, and state.

    NAME               PROJECT              REGION           MACHINE_TYPE          IP_ADDRESSES             STATE
    SERVER_NAME      PROJECT_ID        REGION         o2-standard-32-metal  192.168.1.1,192.168.2.1  RUNNING
    

    Additional command options include:

    • --region: View devices in a specific Google Cloud region.
    • --limit: Limit the output to show a specific number of devices
  2. To get network and storage information for a server in your Bare Metal Solution environment, issue the following gcloud command:

    gcloud alpha bms instances describe SERVER_NAME --project=PROJECT_ID --region=REGION
    

    The following output example shows an operational server with 12 LUNs, a client network of 192.168.1.1, and a private network of 192.168.2.1.

    luns:
    - bootLun: true
      name: SERVER_NAME-lun000-b1
      sizeGb: '200'
      state: READY
      storageVolume: SERVER_NAME-vol000-b1
    - name: STORAGE_DEVICE_NAME-lun001
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun002
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun003
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun004
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun005
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun006
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun007
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun008
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun009
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun010
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun011
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    - name: STORAGE_DEVICE_NAME-lun012
      sizeGb: '85'
      state: READY
      storageVolume: STORAGE_DEVICE_NAME-vol001
    machineType: o2-standard-32-metal
    name: projects/PROJECT_ID/locations/REGION/instances/SERVER_NAME
    networks:
    - ipAddress: 192.168.1.1
      macAddress:
      - 34:80:0D:52:AF:28
      - 34:80:0D:15:3E:0D
      network: STORAGE_DEVICE_NAME-vlan001
    - ipAddress: 192.168.2.1
      macAddress:
      - 34:80:0D:52:AF:38
      - 34:80:0D:15:3E:1D
      network: STORAGE_DEVICE_NAME-vlan002
    state: RUNNING