This document describes how to resolve issues with consuming
[reservations of Compute Engine zonal resources](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt).

## Fewer compute instances available for consumption

**Issue** : The number of physically reserved Compute Engine instances (the
`assuredCount` field) is less than the number of compute instances that are
specified in the reservation (the `count` field). This discrepancy means that
you have fewer compute instances available than expected for your project, and
for any project with which a reservation is shared.

This issue can occur for one or more of the following reasons:

- **Google Cloud suspended a consumer project or a user migrated it** .
  Google Cloud has
  [suspended](https://docs.cloud.google.com/resource-manager/docs/project-suspension-guidelines.md.txt) a project
  with which the reservation is shared, a *consumer project* , or a user
  [migrated the consumer project to another organization](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt#how-shared-reservations-work).
  In these cases, Compute Engine decreases the `assuredCount` field in
  the reservation by the number of compute instances that the consumer project
  was consuming before the migration or suspension.

- **Google Cloud suspended the owner project** . Google Cloud has
  suspended the project in which the reservation exists, the *owner project* .
  In this case, Compute Engine sets the `assuredCount` field in the
  reservation to `0`.

- **A hardware or host error impacted the reservation**. In this case,
  Compute Engine does both of the following in the reservation:

  - Compute Engine sets the `status` field to `DEGRADED`.

  - Compute Engine decreases the `assuredCount` field by the number
    of impacted hosts.

**Resolution** : Unless the owner project for your reservation is suspended,
Compute Engine makes best-effort attempts to resolve the discrepancy
between the `assuredCount` and `count` fields within 24 hours. During this time,
Google Cloud bills you only for the physically reserved capacity that's
shown in the `assuredCount` field. If this issue isn't resolved within 48 hours,
then contact your [account team](https://cloud.google.com/tam) or
[support](https://docs.cloud.google.com/support).

## Issues for compute instances not consuming reservations

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

- [The reservation is degraded](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#degraded-reservation)

- [The host in the reservation is already in use](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#host-occupied)

- [The host in the reservation is undergoing maintenance or a reboot](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#host-power-cycle)

- [The reservation and compute instance's properties don't match](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#mismatched-vm-properties)

- [The compute instance's reservation affinity is incorrect](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#vm-reservation-affinity-incorrect)

- [The reservation is already fully consumed](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#reservation-already-consumed)

- [The quota for the shared reservations is exceeded](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#resource_quota_exceeded)

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

### Degraded reservation

**Issue**: You attempt to create a compute instance by consuming a reservation,
but creating the compute instance fails with one of the following errors:

    BACKEND_ERROR

    GCE_STOCKOUT

    INFEASIBLE

    MACHINE_UNAVAILABLE_IN_RESERVATION

    QUOTA_ERROR

    ZONE_RESOURCE_POOL_EXHAUSTED

Additionally, when you
[view the details of the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-view.md.txt#view-reservations),
the value of the `status` field is set to `DEGRADED`. This value indicates that
some of the physically reserved machines in your reservation have encountered a
hardware or host error. In this state, you can use the reservation to create
compute instances only up to the number that is specified in the `assuredCount`
field. Until the issue is resolved, Google Cloud bills you only for the
number of reserved compute instances that's indicated in the `assuredCount`
field.

**Resolution** : Compute Engine makes best-effort attempts to resolve the
issue within 24 hours. If the `status` field in your reservation is still set to
`DEGRADED` after 48 hours, then contact your
[account team](https://cloud.google.com/tam) or [support](https://docs.cloud.google.com/support) for
guidance.

### Targeted host already in use

**Issue**: You attempt to create a compute instance on a specific host within a
reservation, and the request fails with the following error:

    MACHINE_OCCUPIED

This error indicates that a running compute instance occupies the host or slot
that you targeted in the reservation.

**Resolution** :
[View the topology of your reservation](https://docs.cloud.google.com/ai-hypercomputer/docs/view-reserved-capacity.md.txt#view-capacity-topology)
to check the availability of hosts, blocks, or sub-blocks, and then target a
different available host, block, or sub-block. If you need that specific host,
then wait until the existing compute instance stops or is deleted, and then
retry your request.

### Targeted host undergoing maintenance or reboot

**Issue**: You attempt to create a compute instance in a reservation, and the
request fails with the following error:

    MACHINE_POWER_CYCLE

This error indicates that the host on which you want to create the
compute instance is unavailable because of host maintenance or an ongoing
reboot.

**Resolution** : To check for active host maintenance,
[view the maintenance state of your reservation](https://docs.cloud.google.com/ai-hypercomputer/docs/manage/host-events-reservations.md.txt#view-maintenance).
Wait a few minutes for the host maintenance or reboot to finish, and then retry
your request. If you attempted to create a compute instance on a specific host,
then
[view the topology of your reservation](https://docs.cloud.google.com/ai-hypercomputer/docs/view-reserved-capacity.md.txt#view-capacity-topology)
to check the availability of hosts, blocks, or sub-blocks, and then target a
different available host, block, or sub-block.

### Mismatched compute instance properties

**Issue** : A compute instance can't consume a reservation with different
[compute instance properties](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt#requirements).
If the compute instance's placement policy conflicts with the reservation or
exceeds the available capacity of the reservation, then your request might fail
with a `PLACEMENT_CONSTRAINTS_INFEASIBLE_WITH_RESERVATION_AFFINITY` or
`PLACEMENT_POLICY_CONSTRAINTS_INFEASIBLE` error.

To identify which properties aren't matching between the compute instance and
reservation, view the properties of the reservation and the compute instance by
doing the following:

1. [View the details of the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-view.md.txt#describe-reservations)

2. [View the details of the compute instance](https://docs.cloud.google.com/compute/docs/instances/view-vm-details.md.txt)

Then, compare the two outputs to verify that the following properties *exactly*
match:

- `project`

  - If the reservation is shared with multiple projects (specifically, if the reservation has the`shareType` field set to `SPECIFIC_PROJECTS`), then the compute instances can be located in the project where the reservation was created (the owner project), or in any projects that the reservation is shared with (consumer projects).
- `zone`

- `machineType`

- `guestAccelerators.acceleratorType` (if any)

- `guestAccelerators.acceleratorCount` (if any)

- `minCpuPlatform`

  - The compute instance and reservation must have the exact same `minCpuPlatform` configuration. For example, setting `minCpuPlatform` to `Intel Broadwell` when creating a compute instance won't match the `minCpuPlatform` value of `Automatic` within a reservation.
- `localSsds.interface` (if any)

  - The reservation and compute instance must have the same number of Local SSD disks with a matching `localSsds.interface` property for each Local SSD disk.
- `resourcePolicies` (if any)

  - Only if a reservation specifies a [compact placement policy](https://docs.cloud.google.com/compute/docs/instances/use-compact-placement-policies.md.txt).
- `locationHint` (if any)

  - Only if a reservation specifies the `locationHint` field. You can specify the `locationHint` field only when creating compute instances by using the REST API.

**Resolution**: After identifying the properties that don't match, try one of
the following:

- If the compute instance properties don't match the reservation, then do one
  of the following:

  - [Delete the compute instance](https://docs.cloud.google.com/compute/docs/instances/deleting-instance.md.txt)
    and create a new compute instance with properties that match the
    reservation's properties.

  - [Update the compute instance](https://docs.cloud.google.com/compute/docs/instances/update-instance-properties.md.txt)
    to match the reservation's properties.

- If the reservation's properties are supposed to match the compute instance's
  properties, then
  [delete the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-delete.md.txt#deleting_a_reservation)
  and
  [create a new reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-single-project.md.txt)
  that matches the compute instance's properties. Optionally, you can create a
  [specific reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#consuming_instances_from_a_specific_reservation).
  When creating compute instances to consume a specific reservation, you
  encounter errors if the compute instance's properties don't match the
  reservation's properties.

- If your request fails with a
  `PLACEMENT_CONSTRAINTS_INFEASIBLE_WITH_RESERVATION_AFFINITY` or
  `PLACEMENT_POLICY_CONSTRAINTS_INFEASIBLE` error, then do one of the
  following:

  - Omit or
    [remove the compact placement policy](https://docs.cloud.google.com/compute/docs/instances/manage-placement-policies.md.txt#remove-policy)
    when you target the reservation for consumption.

  - Specify the same placement policy as the reservation, or use a compact
    placement policy with a higher
    [maximum distance value](https://docs.cloud.google.com/compute/docs/instances/placement-policies-overview.md.txt#about-compact-policies).

  - [View the topology of your reservation](https://docs.cloud.google.com/ai-hypercomputer/docs/view-reserved-capacity.md.txt#view-capacity-topology)
    to check the available capacity in each block or sub-block, and then
    reduce the number of requested compute instances to fit the available
    capacity.

After updating the compute instance or creating a new reservation, check if the
compute instance is consuming the reservation by
[verifying the reservation consumption](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#verify-consumption).

### Reservation affinity is incorrect

**Issue** : The
[reservation affinity](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#consuming_reserved_instances)
of the compute instance is misconfigured. The reservation affinity of a compute
instance controls the reservations that a compute instance can consume. To check
your compute instance's reservation affinity, do the following:

1. [View the details of a reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-view.md.txt#describe-reservations)
   and verify if the reservation is an automatically consumed or specific
   reservation. For more information, see
   [Consumption type](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt#consumption-type).

2. [View the details of the compute instance](https://docs.cloud.google.com/compute/docs/instances/view-vm-details.md.txt)
   and verify the reservation affinity.

**Resolution**: If the reservation affinity of the compute instance and the
reservation don't match, then do one of the following:

- Create a new compute instance with a reservation affinity property that
  matches the reservation's type.

- [Update the `reservationAffinity` property in the compute instance](https://docs.cloud.google.com/compute/docs/instances/update-instance-properties.md.txt)
  to specify whether the compute instance can consume any matching reservation
  or a specific reservation. To finalize the compute instance's update, you
  must restart the compute instance.

To check if the compute instance is consuming the reservation, see
[Verify reservation consumption](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#verify-consumption).

### Reservation is already fully consumed

**Issue**: The number of compute instances consuming this reservation matches
the reservation's total number of reserved compute instances, or your request
exceeds the remaining available capacity in the reservation. When you target a
specific reservation that lacks enough available resources, your request fails
with one of the following errors:

    MACHINE_UNAVAILABLE_IN_RESERVATION

    POOL_CAPACITY_INSUFFICIENT_WITH_RESERVATION_AFFINITY

**Resolution** : To verify if the reservation is fully consumed,
[view the details of the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-view.md.txt#view-reservations),
and then verify that the number of compute instances consuming the reservation
matches the total number of reserved compute instances in the reservation.

If the reservation is fully consumed, then try one of the following:

- Increase the number of reserved compute instances by
  [modifying the number of reserved compute instances in a reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-modify.md.txt#resizing_a_reservation).

- If the reservation already reserves the
  [maximum number of compute instances](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-vm-creation.md.txt#max-vm-count-exceeded),
  then create a new reservation.

- Reduce the number of compute instances that are consuming the reservation.
  For more information, see
  [Compute instances unintentionally consuming reservations](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-reservation-consumption.md.txt#unintentional-reservation-consumption).

If the reservation isn't fully consumed but the compute instance isn't consuming
the reservation, then you can further troubleshoot the issue by doing the
following:

1. [Create a specific reservation with matching properties](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#consuming_instances_from_a_specific_reservation).

2. Create a compute instance to consume the reservation. If the compute
   instance and the reservation properties don't match, then creating the
   compute instance fails.

### Resource quota exceeded for shared reservations

**Issue**: A compute instance isn't consuming a shared reservation because your
project doesn't have sufficient quota for the resources that you're trying to
consume.

**Resolution** : Shared reservations have
[additional quota requirements](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt#requirements-shared-reservations).
If you need to increase quota in your project to consume the reserved resources,
then see
[Request a quota adjustment](https://docs.cloud.google.com/docs/quotas/help/request_increase) in
the Cloud Quotas documentation.

## Compute instance count not restored after stopping or deleting a compute instance

**Issue**: If you stop, suspend, or delete a compute instance that is consuming
a reservation, then the operation must complete before the compute instance 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 compute instances to complete. Then, to verify that the
stopped, suspended, or deleted compute instances no longer count against the
reservation, check the total number of consumed compute instances in the
reservation by using one of the following methods:

- Recommended:
  [Monitor the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-monitor.md.txt) and
  look for a change in the measurements of the reservation.

- [View the details of the reservation](https://docs.cloud.google.com/compute/docs/instances/reservations-view.md.txt#describe-reservations)
  and check if the value of the `inUseCount` field decreased. If its value
  didn't decrease, then check these conditions:

  - Check whether another compute instance started to consume the
    reservation while the stop, suspend, or delete operation completed.

  - If the stopped compute instance has Local SSD disks attached, then
    verify that you discarded the Local SSD data when you
    [stopped the compute instance](https://docs.cloud.google.com/compute/docs/instances/stop-start-instance.md.txt#stop-vm-local-ssd).
    If you preserved the Local SSD data or shut down the compute
    instance from inside the guest OS, then stop the compute instance
    using Google Cloud and discard the Local SSD data, or
    [delete the compute instance](https://docs.cloud.google.com/compute/docs/instances/deleting-instance.md.txt).

## Compute instance unintentionally consuming reservations

**Issue** : When you create
[reservations that are automatically consumed](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#consuming_instances_from_any_matching_reservation)
(default), a compute instance might unintentionally consume these reservations.

**Resolution**: To avoid that one or more compute instances unintentionally
consume a reservation, do one of the following:

- [Create compute instances that can't consume any reservations](https://docs.cloud.google.com/compute/docs/instances/reservations-prevent-consumption.md.txt)

- [Create reservations that can be consumed only when specifically targeted](https://docs.cloud.google.com/compute/docs/instances/reservations-consume.md.txt#consuming_instances_from_a_specific_reservation)