Troubleshooting reservation consumption


This page shows you how to resolve issues with consuming reservations of Compute Engine zonal resources.

Difficulty tracking reservation consumption

Issue: Although you can view the details of a reservation or monitor the consumption of reservations to view how many of its reserved VMs are being consumed and monitor changes to this number over time, you cannot directly view which VMs are consuming a reservation.

Resolution: If you can successfully create a VM that targets a specific reservation, then the VM is consuming the reservation specified in the affinity property (reservationAffinity) of the VM. Otherwise, creating the VM fails because the properties don't match or there are no available reserved resources.

You can also create a VM that targets a specific reservation to test that it's correctly configured to automatically consume a matching reservation, and then create the VM to consume any matching reservation.

Issues for VMs not consuming reservations

If a VM can't consume a reservation, it might be due to one or more of the following issues:

  • The VM's properties don't match the reservation's properties.
  • The VM's reservation affinity is incorrect.
  • The reservation is already fully consumed by other matching VMs.
  • The quota for the resource is exceeded

This section describes how to identify each of these issues, how to resolve each, and how to verify reservation consumption.

Mismatched VM properties

Issue: A VM cannot consume a reservation with different VM properties.

To identify this issue, select one of the following methods:

  • View the details the reservation and VM, and manually verify that their VM properties match:

    1. View the details of the reservation that you want the VM to consume using the gcloud compute reservations describe command:

      gcloud compute reservations describe RESERVATION_NAME --zone=ZONE
      

      Replace the following:

      • RESERVATION_NAME is the name of a reservation.
      • ZONE is the zone where the reservation is located.

      Keep this output available.

    2. View the details of the VM that you want to consume the reservation gcloud compute instances describe command.

      gcloud compute instances describe VM_NAME
      

      where VM_NAME is the name of the VM.

      Keep this output available.

    3. Using both the VM description and reservation description outputs, verify that following properties match:

      • project
        • If the reservation is shared with multiple projects (if the reservation has theshareType property set to SPECIFIC_PROJECTS), the VM's project can either match the project where the reservation is located or match any of the projects listed under shareSettings.
      • zone
      • machineType
      • guestAccelerators.acceleratorType
      • guestAccelerators.acceleratorCount
      • minCpuPlatform
        • Your VM and reservation must have the exact same minCpuPlatform configuration. If you specify a minCpuPlatform value for either one of them, then both of them must have the same value for that property. Otherwise, both the reservation and the VM should omit the property. For instance, setting minCpuPlatform to "Intel Broadwell" when creating a VM will not match the minCpuPlatform value of "Automatic" within a reservation.
      • localSsds.interface
        • The reservation and VM must have the same number of local SSDs with a matching localSsds.interface property for each local SSD.
      • resourcePolicies*

      *Only if a reservation specifies a compact placement policy.

  • Create a VM that targets a specific reservation, which returns an error if the properties don't match. For instructions, see Verify reservation consumption.

Resolution: Update any mismatched VM properties by doing one of the following:

To check if the VM is now consuming the reservation, see Verify reservation consumption.

If the VM's and reservation's properties match but the VM is not consuming the reservation, proceed to the next section.

VMs miss a placement policy

Issue: A VM is trying to consume a reservation without specifying the reservation's compact placement policy.

Resolution: If a single-project reservation specifies a compact placement policy, a VM must specify exactly the same compact placement policy to consume the reservation. Otherwise, the VM can't consume the reservation.

To make sure that a VM consumes a reservation that specifies a compact placement policy, try one of the following:

VMs specify a different compact placement policy

Issue: A VM is trying to consume a reservation, but the compact placement policy specified in the VM and in the reservation don't match.

Resolution: If a single-project reservation specifies a compact placement policy, a VM must specify exactly the same compact placement policy to consume the reservation. Otherwise, the VM can't consume the reservation.

To solve this issue, try one of the following:

VM's reservation affinity is incorrect

Issue: The VM's reservation affinity is misconfigured. A VM's reservation affinity controls the reservations that a VM can consume. To check your VM's reservation affinity, do the following:

  1. View the details of the reservation that you want the VM to consume with the gcloud compute reservations describecommand.

      gcloud compute reservations describe RESERVATION_NAME --zone=ZONE

    Replace the following:

    • RESERVATION_NAME is the name of a reservation.
    • ZONE is the zone where the reservation is located.

    In the output, find the value of the specificReservationRequired field, either true or false.

  2. View the details of the VM using the gcloud compute instances describecommand.

       gcloud compute instances describe VM_NAME

    where VM_NAME with the name of the VM.

    In the output, find the reservationAffinity field, which looks similar to the following:

    ...
       reservationAffinity:
         consumeReservationType: RESERVATION_AFFINITY
         key: compute.googleapis.com/reservation-name
         values:
         - RESERVATION_NAME
       ...

Resolution: Update the VM's reservationAffinity property to be compatible with the reservation's specificReservationRequired field by using one of the following accepted configurations:

  1. If the reservation's specificReservationRequired field is true, the VM's reservationAffinity property must match the following:

    ...
      reservationAffinity:
        consumeReservationType: SPECIFIC_RESERVATION
        key: compute.googleapis.com/reservation-name
        values:
        - RESERVATION_NAME
      ...

    where RESERVATION_NAME is the name of the reservation.

  2. If the reservation's specificReservationRequired field is false, the VM's reservationAffinity property must match the following:

    ...
      reservationAffinity:
        consumeReservationType: ANY_RESERVATION
      ...

You need to restart the VM to make the update. After the update, to check if the VM is consuming the reservation, see Verify reservation consumption.

If the VM's reservation affinity is configured correctly but the VM is not consuming any reservations, proceed to the next section.

Reservation is already fully consumed

Issue: The number of VMs currently in use for this reservation matches the reservation's total number of reserved VMs.

To identify this issue, view the details of the reservation and verify that the number of VMs in use for this reservation is less than the reservation's total number of reserved VMs.

Resolution: You can increase the number of VMs available to consume for the reservation by doing one of the following:

To check if the VM is now consuming the reservation, see Verify reservation consumption.

If the reservation is not fully consumed, but the VM is not consuming the reservation, you can further troubleshoot the issue by creating a VM that targets a specific reservation, which returns an error if the consumption fails. For more information, proceed to the next section.

VM count not restored after stopping or deleting a VM

Issue: If you stop, suspend, or delete a VM that is consuming a reservation, then the operation must complete before the VM no longer counts against the reservation, and the previously consumed resources are again available for consumption.

Resolution: Wait for a few minutes for the stop, suspend, or delete operation on the VMs to complete. Then, to verify that the stopped, suspended, or deleted VMs no longer count against the reservation, check the total number of consumed VMs in the reservation by using one of the following methods:

  • Recommended: Monitor the reservation and look for a change in the measurements of the reservation.

  • View the details of the reservation and check if the value of the inUseCount field decreased. If its value didn't decrease, one or more VMs have started consuming the reservation while the stop, suspend, or delete operation was completing.

VMs unintentionally consuming reservations

Issue: When you create reservations that are consumed automatically (default), VMs might unintentionally consume these reservations.

Resolution: You can help control which VMs consume reservations by doing the following:

Resource quota exceeded

Issue: A shared reservation is not utilised because a quota has been exceeded for a particular resource.

Shared reservations have an additional requirement with regards to quota. The owner project must have sufficient quota for twice the resources reserved for consumer projects to use the reserved resources.

Resolution: Request additional quota for the resource to be used.