Visualizza le prenotazioni o le richieste di prenotazione futura

Questo documento spiega come visualizzare le prenotazioni o le richieste di prenotazione futura. Per scoprire di più sui diversi tipi di prenotazioni, consulta Tipo di provisioning.

Quando visualizzi le prenotazioni o le richieste di prenotazione futura, puoi svolgere le seguenti operazioni:

  • Visualizza le impostazioni di prenotazione. Questo esame ti aiuta a verificare i dettagli delle tue prenotazioni, ti assicura che soddisfino le tue esigenze e ti consente di pianificare la capacità.

  • Determina il numero di istanze utilizzabili. Questo controllo ti aiuta a determinare quante istanze Compute Engine possono utilizzare la tua capacità riservata.

Limitazioni

Puoi visualizzare una prenotazione condivisa o una richiesta di prenotazione futura condivisa solo nel progetto in cui l'hai creata.

Prima di iniziare

Ruoli obbligatori

Per ottenere le autorizzazioni necessarie per visualizzare le prenotazioni o le richieste di prenotazione futura, chiedi all'amministratore di concederti il ruolo IAM Amministratore Compute (roles/compute.admin) nel progetto. Per saperne di più sulla concessione dei ruoli, consulta Gestisci l'accesso a progetti, cartelle e organizzazioni.

Questo ruolo predefinito contiene le autorizzazioni necessarie per visualizzare le prenotazioni o le richieste di prenotazione futura. Per vedere quali sono esattamente le autorizzazioni richieste, espandi la sezione Autorizzazioni obbligatorie:

Autorizzazioni obbligatorie

Per visualizzare le prenotazioni o le richieste di prenotazione futura sono necessarie le seguenti autorizzazioni:

  • Per visualizzare un elenco di prenotazioni: compute.reservations.list sul progetto
  • Per visualizzare un elenco di richieste di prenotazione futura: compute.futureReservations.list sul progetto
  • Per visualizzare i dettagli di una prenotazione: compute.reservations.get sul progetto
  • Per visualizzare i dettagli di una richiesta di prenotazione futura: compute.futureReservations.get sul progetto

Potresti anche ottenere queste autorizzazioni con ruoli personalizzati o altri ruoli predefiniti.

Visualizza le impostazioni di prenotazione

Le sezioni seguenti spiegano come visualizzare le impostazioni delle prenotazioni o delle richieste di prenotazione future.

Visualizza prenotazioni

Per visualizzare le impostazioni di una o più prenotazioni, utilizza uno dei seguenti metodi descritti in questa sezione:

  • Per visualizzare una panoramica di tutte le prenotazioni nel tuo progetto, visualizza un elenco delle tue prenotazioni.

  • Per visualizzare i dettagli completi di una singola prenotazione, visualizza i dettagli della prenotazione.

Per visualizzare i campi deleteAtTime e reservationSharingPolicy (Anteprima) in una prenotazione, visualizza i dettagli di una prenotazione utilizzando Google Cloud CLI o visualizza le prenotazioni utilizzando l'API REST. Se non hai bisogno di questi campi, visualizza le prenotazioni selezionando una delle seguenti opzioni:

Console

  1. Nella console Trusted Cloud , vai alla pagina Prenotazioni.

    Vai a Prenotazioni

    Nella scheda Prenotazioni on demand (predefinita), la tabella elenca ogni prenotazione e ogni colonna della tabella descrive una proprietà.

  2. (Facoltativo) Nella tabella Prenotazioni on demand, esegui una o entrambe le seguenti operazioni:

    • Per visualizzare il numero garantito delle tue prenotazioni, fai clic su Opzioni di visualizzazione delle colonne…, seleziona la casella di controllo Numero garantito e poi fai clic su Ok.

    • Per perfezionare l'elenco delle prenotazioni, nel campo Filtro, seleziona le proprietà in base alle quali filtrare le prenotazioni.

  3. Per visualizzare i dettagli di una prenotazione, fai clic sul nome della prenotazione nella colonna Nome. Viene visualizzata una pagina con i dettagli della prenotazione.

gcloud

  • Per visualizzare un elenco delle tue prenotazioni, utilizza il comando gcloud compute reservations list:

    gcloud compute reservations list
    

    L'output è simile al seguente:

    NAME: r-01
    IN_USE_COUNT: 0
    COUNT: 5
    ZONE: us-central1-a
    SHARE_TYPE: LOCAL
    
    NAME: r-02
    IN_USE_COUNT: 3
    COUNT: 10
    ZONE: us-central1-f
    SHARE_TYPE: LOCAL
    

    (Facoltativo) Per perfezionare un elenco di prenotazioni utilizzando un'espressione di filtro, includi il flag --filter:

    gcloud compute reservations list \
        --filter="FILTER_EXPRESSION"
    

    Sostituisci FILTER_EXPRESSION con un'espressione di filtro.

  • Per visualizzare i dettagli di una prenotazione, utilizza il comando gcloud compute reservations describe:

    gcloud compute reservations describe RESERVATION_NAME \
        --zone=ZONE
    

    Sostituisci quanto segue:

    • RESERVATION_NAME: il nome di una prenotazione esistente.

    • ZONE: la zona in cui esiste la prenotazione.

    L'output è simile al seguente:

    creationTimestamp: '2024-10-11T03:25:23.192-07:00'
    id: '4488228526648280060'
    kind: compute#reservation
    name: r-01
    selfLink: https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a/reservations/r-01
    shareSettings:
      shareType: LOCAL
    specificReservation:
      assuredCount: '50'
      count: '50'
      inUseCount: '25'
      instanceProperties:
        machineType: n2-standard-2
    specificReservationRequired: false
    status: READY
    zone: https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a
    

Vai

  • Per visualizzare un elenco delle prenotazioni, utilizza il seguente esempio di codice:

    // Copyright 2024 Google LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    package snippets
    
    import (
    	"context"
    	"fmt"
    	"io"
    
    	compute "cloud.google.com/go/compute/apiv1"
    	computepb "cloud.google.com/go/compute/apiv1/computepb"
    	"google.golang.org/api/iterator"
    )
    
    // Get list of reservations for given project in particular zone
    func listReservations(w io.Writer, projectID, zone string) error {
    	// projectID := "your_project_id"
    	// zone := "us-west3-a"
    
    	ctx := context.Background()
    	reservationsClient, err := compute.NewReservationsRESTClient(ctx)
    	if err != nil {
    		return err
    	}
    	defer reservationsClient.Close()
    
    	req := &computepb.ListReservationsRequest{
    		Project: projectID,
    		Zone:    zone,
    	}
    
    	it := reservationsClient.List(ctx, req)
    	fmt.Fprintf(w, "Instances found in zone %s:\n", zone)
    	for {
    		instance, err := it.Next()
    		if err == iterator.Done {
    			break
    		}
    		if err != nil {
    			return err
    		}
    		fmt.Fprintf(w, "- %s %d\n", instance.GetName(), instance.GetSpecificReservation().GetCount())
    	}
    
    	return nil
    }
    
    
  • Per visualizzare i dettagli di una prenotazione, utilizza il seguente esempio di codice:

    // Copyright 2024 Google LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    package snippets
    
    import (
    	"context"
    	"fmt"
    	"io"
    
    	compute "cloud.google.com/go/compute/apiv1"
    	computepb "cloud.google.com/go/compute/apiv1/computepb"
    )
    
    // Get certain reservation for given project and zone
    func getReservation(w io.Writer, projectID, zone, reservationName string) (*computepb.Reservation, error) {
    	// projectID := "your_project_id"
    	// zone := "us-west3-a"
    	// reservationName := "your_reservation_name"
    
    	ctx := context.Background()
    	reservationsClient, err := compute.NewReservationsRESTClient(ctx)
    	if err != nil {
    		return nil, err
    	}
    	defer reservationsClient.Close()
    
    	req := &computepb.GetReservationRequest{
    		Project:     projectID,
    		Reservation: reservationName,
    		Zone:        zone,
    	}
    
    	reservation, err := reservationsClient.Get(ctx, req)
    	if err != nil {
    		return nil, fmt.Errorf("unable to delete reservation: %w", err)
    	}
    
    	fmt.Fprintf(w, "Reservation: %s\n", reservation.GetName())
    
    	return reservation, nil
    }
    
    

Java

  • Per visualizzare un elenco delle prenotazioni, utilizza il seguente esempio di codice:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *   http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package compute.reservation;
    
    import com.google.cloud.compute.v1.Reservation;
    import com.google.cloud.compute.v1.ReservationsClient;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    
    public class ListReservations {
    
      public static void main(String[] args) throws IOException {
        // TODO(developer): Replace these variables before running the sample.
        // Project ID or project number of the Cloud project you want to use.
        String project = "YOUR_PROJECT_ID";
        // Zone in which reservations are located.
        String zone = "us-central1-a";
    
        listReservations(project, zone);
      }
    
      // List all reservations in the given project and zone.
      public static List<Reservation> listReservations(String project, String zone) throws IOException {
        // Initialize client that will be used to send requests. This client only needs to be created
        // once, and can be reused for multiple requests.
        List<Reservation> listOfReservations = new ArrayList<>();
    
        try (ReservationsClient reservationsClient = ReservationsClient.create()) {
          for (Reservation reservation : reservationsClient.list(project, zone).iterateAll()) {
            listOfReservations.add(reservation);
            System.out.println("Reservation: " + reservation.getName());
          }
        }
        return listOfReservations;
      }
    }
  • Per visualizzare i dettagli di una prenotazione, utilizza il seguente esempio di codice:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package compute.reservation;
    
    import com.google.cloud.compute.v1.Reservation;
    import com.google.cloud.compute.v1.ReservationsClient;
    import java.io.IOException;
    import java.util.concurrent.ExecutionException;
    import java.util.concurrent.TimeoutException;
    
    public class GetReservation {
    
      public static void main(String[] args)
          throws IOException, ExecutionException, InterruptedException, TimeoutException {
        // TODO(developer): Replace these variables before running the sample.
        // Project ID or project number of the Cloud project you want to use.
        String projectId = "YOUR_PROJECT_ID";
        // Name of the zone in which you want to create the reservation.
        String zone = "us-central1-a";
        // Name of the reservation you want to create.
        String reservationName = "test-reservation-name";
    
        getReservation(projectId, reservationName, zone);
      }
    
      // Retrieve a reservation with the given name in the given zone.
      public static Reservation getReservation(
          String projectId, String reservationName, String zone)
          throws IOException {
        // Initialize client that will be used to send requests. This client only needs to be created
        // once, and can be reused for multiple requests.
        try (ReservationsClient reservationsClient = ReservationsClient.create()) {
    
          // Get the reservation.
          Reservation reservation = reservationsClient.get(projectId, zone, reservationName);
    
          System.out.println("Reservation: " + reservation.getName());
          return reservation;
        }
      }
    }

Node.js

  • Per visualizzare un elenco delle prenotazioni, utilizza il seguente esempio di codice:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    'use strict';
    
    async function main() {
      // Import the Compute library
      const computeLib = require('@google-cloud/compute');
    
      // Instantiate a reservationsClient
      const reservationsClient = new computeLib.ReservationsClient();
    
      /**
       * TODO(developer): Update these variables before running the sample.
       */
      // The ID of the project where your reservations are located.
      const projectId = await reservationsClient.getProjectId();
      // The zone where your reservations are located.
      const zone = 'us-central1-a';
    
      async function callGetReservations() {
        const reservations = (
          await reservationsClient.list({
            project: projectId,
            zone,
          })
        )[0];
    
        console.log(JSON.stringify(reservations));
      }
    
      await callGetReservations();
    }
    
    main().catch(err => {
      console.error(err);
      process.exitCode = 1;
    });
    
  • Per visualizzare i dettagli di una prenotazione, utilizza il seguente esempio di codice:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    'use strict';
    
    async function main(reservationName) {
      // Import the Compute library
      const computeLib = require('@google-cloud/compute');
    
      // Instantiate a reservationsClient
      const reservationsClient = new computeLib.ReservationsClient();
    
      /**
       * TODO(developer): Update/uncomment these variables before running the sample.
       */
      // The ID of the project where your reservation is located.
      const projectId = await reservationsClient.getProjectId();
      // The zone where your reservation is located.
      const zone = 'us-central1-a';
      // The name of the reservation to return.
      // reservationName = 'reservation-01';
    
      async function callGetReservation() {
        const requestedReservation = (
          await reservationsClient.get({
            project: projectId,
            zone,
            reservation: reservationName,
          })
        )[0];
    
        console.log(JSON.stringify(requestedReservation));
      }
    
      await callGetReservation();
    }
    
    main(...process.argv.slice(2)).catch(err => {
      console.error(err);
      process.exitCode = 1;
    });
    

Python

  • Per visualizzare un elenco delle prenotazioni, utilizza il seguente esempio di codice:

    # Copyright 2024 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #    https://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    
    # This file is automatically generated. Please do not modify it directly.
    # Find the relevant recipe file in the samples/recipes or samples/ingredients
    # directory and apply your changes there.
    
    
    from google.cloud import compute_v1
    from google.cloud.compute_v1.services.reservations.pagers import ListPager
    
    
    def list_compute_reservation(project_id: str, zone: str = "us-central1-a") -> ListPager:
        """
        Lists all compute reservations in a specified Google Cloud project and zone.
        Args:
            project_id (str): The ID of the Google Cloud project.
            zone (str): The zone of the reservations.
        Returns:
            ListPager: A pager object containing the list of reservations.
        """
    
        client = compute_v1.ReservationsClient()
    
        reservations_list = client.list(
            project=project_id,
            zone=zone,
        )
    
        for reservation in reservations_list:
            print("Name: ", reservation.name)
            print(
                "Machine type: ",
                reservation.specific_reservation.instance_properties.machine_type,
            )
        # Example response:
        # Name:  my-reservation_1
        # Machine type:  n1-standard-1
        # Name:  my-reservation_2
        # Machine type:  n1-standard-1
    
        return reservations_list
    
    
    
  • Per visualizzare i dettagli di una prenotazione, utilizza il seguente esempio di codice:

    # Copyright 2024 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #    https://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    
    # This file is automatically generated. Please do not modify it directly.
    # Find the relevant recipe file in the samples/recipes or samples/ingredients
    # directory and apply your changes there.
    
    
    from google.cloud import compute_v1
    from google.cloud.compute_v1.types import compute
    
    
    def get_compute_reservation(
        project_id: str,
        zone: str = "us-central1-a",
        reservation_name="your-reservation-name",
    ) -> compute.Reservation:
        """
        Retrieves a compute reservation from GCP.
        Args:
            project_id (str): The ID of the Google Cloud project.
            zone (str): The zone of the reservation.
            reservation_name (str): The name of the reservation to retrieve.
        Returns:
            compute.Reservation: The reservation object retrieved from Google Cloud.
        """
    
        client = compute_v1.ReservationsClient()
    
        reservation = client.get(
            project=project_id,
            zone=zone,
            reservation=reservation_name,
        )
    
        print("Name: ", reservation.name)
        print("STATUS: ", reservation.status)
        print(reservation.specific_reservation)
        # Example response:
        # Name:  your-reservation-name
        # STATUS:  READY
        # count: 3
        # instance_properties {
        #   machine_type: "n1-standard-1"
        #   local_ssds {
        #     disk_size_gb: 375
        #     interface: "NVME"
        #   }
        # ...
    
        return reservation
    
    
    

REST

  • Per visualizzare un elenco delle tue prenotazioni, invia una richiesta GET al metodo reservations.list:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations
    

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto in cui hai creato le prenotazioni.

    • ZONE: la zona in cui esistono le tue prenotazioni.

    L'output è simile al seguente:

    {
      "kind": "compute#reservation",
      "id": "4100668622331754141",
      "creationTimestamp": "2019-09-27T08:21:14.707-07:00",
      "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-05",
      "zone": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a",
      "name": "reservation-05",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n1-standard-2"
        },
        "count": "100",
        "inUseCount": "0",
        "assuredCount": "100"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    },
    {
      "kind": "compute#reservation",
      "id": "2533514314332214789",
      "creationTimestamp": "2019-09-27T08:21:14.707-07:00",
      "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-04",
      "zone": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a",
      "name": "reservation-04",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n1-standard-2",
          "guestAccelerators": [
            {
              "acceleratorType": "nvidia-tesla-t4",
              "acceleratorCount": 1
            }
          ],
          "localSsds": [
            {
              "diskSizeGb": "375",
              "interface": "SCSI"
            }
          ]
        },
        "count": "50",
        "inUseCount": "25",
        "assuredCount": "50"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    }
    

    (Facoltativo) Per perfezionare un elenco di prenotazioni utilizzando un'espressione di filtro, includi il parametro di query filter:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations?filter=FILTER_EXPRESSION
    

    Sostituisci FILTER_EXPRESSION con un'espressione di filtro che utilizza valori codificati come URL.

  • Per visualizzare i dettagli di una prenotazione, effettua una richiesta GET al metodo reservations.get.

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME
    

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto in cui hai creato la prenotazione.

    • ZONE: la zona in cui esiste la prenotazione.

    • RESERVATION_NAME: il nome di una prenotazione esistente.

    L'output è simile al seguente:

    {
      "kind": "compute#reservation",
      "id": "4488228526648280060",
      "creationTimestamp": "2024-10-11T03:25:23.192-07:00",
      "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/davide-experimental/zones/us-central1-a/reservations/r-01",
      "zone": "https://www.s3nsapis.fr/compute/v1/projects/davide-experimental/zones/us-central1-a",
      "name": "r-01",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n2-standard-2"
        },
        "count": "50",
        "inUseCount": "25",
        "assuredCount": "50"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    }
    

Visualizza le richieste di prenotazione futura

Per visualizzare le impostazioni di una o più richieste di prenotazione futura, utilizza uno dei seguenti metodi descritti in questa sezione:

  • Per visualizzare una panoramica di tutte le richieste di prenotazione futura nel tuo progetto, visualizza un elenco delle tue richieste.

  • Per visualizzare i dettagli completi di una singola richiesta di prenotazione futura, visualizza i dettagli della richiesta.

Per visualizzare le richieste di prenotazione futura, seleziona una delle seguenti opzioni:

Console

  1. Nella console Trusted Cloud , vai alla pagina Prenotazioni.

    Vai a Prenotazioni

  2. Fai clic sulla scheda Prenotazioni future.

    La tabella elenca ogni richiesta di prenotazione futura e ogni colonna della tabella descrive una proprietà.

  3. (Facoltativo) Per perfezionare l'elenco delle richieste, nel campo Filtro seleziona le proprietà in base alle quali filtrare le richieste.

  4. Per visualizzare i dettagli di una richiesta, fai clic sul nome della richiesta nella colonna Nome. Viene visualizzata una pagina con i dettagli della richiesta di prenotazione futura.

gcloud

  • Per visualizzare un elenco delle tue richieste di prenotazione futura, utilizza il comando gcloud beta compute future-reservations list:

    gcloud beta compute future-reservations list
    

    L'output è simile al seguente:

    NAME: fr-04
    TOTAL_COUNT: 100
    START_TIME: 2025-07-20T07:00:00Z
    END_TIME: 2025-08-05T07:00:00Z
    PROCUREMENT_STATUS: FULFILLED
    ZONE: us-east1-a
    
    NAME: fr-05
    TOTAL_COUNT: 10
    START_TIME: 2025-07-20T07:00:00Z
    END_TIME: 2025-12-01T00:00:00Z
    PROCUREMENT_STATUS: PENDING_APPROVAL
    ZONE: us-west1-c
    

    Facoltativamente, per perfezionare un elenco di richieste di prenotazione future utilizzando un'espressione di filtro, includi il flag --filter:

    gcloud beta compute future-reservations list \
        --filter="FILTER_EXPRESSION"
    

    Sostituisci FILTER_EXPRESSION con un'espressione di filtro.

  • Per visualizzare i dettagli di una richiesta di prenotazione futura, utilizza il comando gcloud beta compute future-reservations describe:

    gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
        --zone=ZONE
    

    Sostituisci quanto segue:

    • FUTURE_RESERVATION_NAME: il nome di una richiesta di prenotazione futura esistente

    • ZONE: la zona in cui esiste la richiesta di prenotazione futura.

    L'output è simile al seguente:

    autoCreatedReservationsDeleteTime: '2025-05-02T01:00:00Z'
    creationTimestamp: '2025-03-23T10:08:31.613-07:00'
    id: '5212276518668495076'
    kind: compute#futureReservation
    name: fr-01
    planningStatus: SUBMITTED
    selfLink: https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/fr-01
    selfLinkWithId: https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/5212276518668495076
    shareSettings:
      shareType: LOCAL
    specificSkuProperties:
      instanceProperties:
        machineType: n1-standard-64
      totalCount: '800'
    status:
      existingMatchingUsageInfo:
        count: '3'
        timestamp: '2025-03-30T01:00:00Z'
      lockTime: '2025-03-30T17:09:59.297799Z'
      procurementStatus: APPROVED
    timeWindow:
      endTime: '2025-05-02T01:00:00Z'
      startTime: '2025-04-30T17:30:00Z'
    zone: https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a
    

REST

  • Per visualizzare un elenco delle tue richieste di prenotazione futura, invia una richiesta GET al metodo futureReservations.list beta:

    GET https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations
    

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto in cui hai creato le richieste di prenotazione futura.

    • ZONE: la zona in cui esistono le tue richieste di prenotazione futura.

    L'output è simile al seguente:

    {
      "id": "projects/my-project/zones/us-east1-a/futureReservations",
      "items": [
        {
          "id": "743865190848184978",
          "creationTimestamp": "2025-03-23T18:16:45.274-07:00",
          "selfLink": "https://www.s3nsapis.fr/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
          "selfLinkWithId": "https://www.s3nsapis.fr/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
          "zone": "https://www.s3nsapis.fr/compute/beta/projects/my-project/zones/us-east1-a",
          "name": "fr-base",
          "specificSkuProperties": {
            "instanceProperties": {
              "machineType": "n1-standard-1"
            },
            "totalCount": "100"
          },
          "planningStatus": "SUBMITTED",
          "timeWindow": {
            "endTime": "2025-05-02T01:00:00Z",
            "startTime": "2025-04-30T17:30:00Z"
          },
          "status": {
            "procurementStatus": "FULFILLED",
            "lockTime": "2025-03-30T07:00:00Z",
            "existingMatchingUsageInfo": {
              "count": "3",
              "timestamp": "2025-03-30T01:00:00Z"
            }
          },
          "kind": "compute#futureReservation"
        },
        ...
      ],
      "selfLink": "https://www.s3nsapis.fr/compute/beta/projects/my-project/zones/us-east1-a/futureReservations",
      "etag": "AnzKY34l-cvvV-JnniESJ0dtQvQ=/hvc4jaHpxFAZmOt1FVtKNgzZu-M=",
      "kind": "compute#futureReservationsListResponse"
    }
    

    Facoltativamente, per perfezionare un elenco di richieste di prenotazione futura utilizzando un'espressione di filtro, includi il parametro di query filter:

    GET https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/aggregated/futureReservations?filter=FILTER_EXPRESSION
    

    Sostituisci FILTER_EXPRESSION con un'espressione di filtro che utilizza valori codificati come URL.

  • Per visualizzare i dettagli di una richiesta di prenotazione futura, invia una richiesta GET al metodo futureReservations.get beta:

    GET https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations/FUTURE_RESERVATION_NAME
    

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto in cui hai creato la richiesta di prenotazione futura.

    • ZONE: la zona in cui esiste la richiesta di prenotazione futura.

    • FUTURE_RESERVATION_NAME: il nome di una richiesta di prenotazione futura esistente

    L'output è simile al seguente:

    {
      "autoCreatedReservationsDeleteTime": "2025-05-02T01:00:00Z",
      "creationTimestamp": "2025-03-23T10:08:31.613-07:00",
      "id": "5212276518668495076",
      "kind": "compute#futureReservation",
      "name": "fr-01",
      "planningStatus": "SUBMITTED",
      "selfLink": "https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/fr-01",
      "selfLinkWithId": "https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/5212276518668495076",
      "shareSettings": {
        "shareType": "LOCAL"
      },
      "specificSkuProperties": {
        "instanceProperties": {
          "machineType": "n1-standard-64"
        },
        "totalCount": "800"
      },
      "status": {
        "lockTime": "2025-03-30T17:09:59.297799Z",
        "procurementStatus": "APPROVED",
        "existingMatchingUsageInfo": {
          "count": "3",
          "timestamp": "2025-03-30T01:00:00Z"
        }
      },
      "timeWindow": {
        "endTime": "2025-05-02T01:00:00Z",
        "startTime": "2025-04-30T17:30:00Z"
      },
      "zone": "https://www.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a"
    }
    

Determina il numero di istanze utilizzabili

Per determinare il numero di istanze di computing che possono utilizzare la tua capacità prenotata, svolgi una delle seguenti operazioni:

Istanze utilizzabili in una prenotazione

Quando visualizzi i dettagli di una prenotazione, puoi vedere quante istanze di computing stanno utilizzando la prenotazione e quante possono farlo osservando i seguenti campi:

  • Numero garantito (assuredCount): il numero di istanze prenotate fisicamente all'interno della zona della prenotazione. Questo numero include le istanze prenotate per il tuo progetto e per qualsiasi progetto con cui è condivisa una prenotazione condivisa.

  • Numero totale (count): il numero di istanze prenotate specificate nella prenotazione. Questo numero deve corrispondere al numero garantito.

  • Macchine in uso (inUseCount): il numero di istanze in esecuzione nel progetto o in un progetto con cui è condivisa una prenotazione che stanno utilizzando la prenotazione.

Ad esempio, se il numero garantito (assuredCount) e il numero totale (count) sono entrambi pari a 50 e il numero di istanze che utilizzano la prenotazione (inUseCount) è 25, altre 25 istanze possono utilizzare la prenotazione prima che venga completamente utilizzata.

Istanze utilizzabili in una richiesta di prenotazione futura

Puoi determinare il numero di istanze di computing per le quali Compute Engine crea una prenotazione all'ora di inizio di una richiesta di prenotazione futura. Per una bozza, una richiesta in attesa di approvazione o una richiesta approvata, puoi determinare questo numero come segue:

  1. Visualizza quante istanze in esecuzione e prenotazioni inutilizzate nel tuo progetto e in qualsiasi progetto con cui la richiesta è condivisa corrispondono alle proprietà della richiesta.

  2. Sottrai il numero di istanze in esecuzione e di prenotazioni inutilizzate corrispondenti dal numero totale nella richiesta.

Puoi determinare il numero di istanze utilizzabili per richieste singole o multiple contemporaneamente. Per più richieste, utilizza la console Trusted Cloud o l'API REST. Per singole richieste, seleziona una delle seguenti opzioni:

Console

  1. Nella console Trusted Cloud , vai alla pagina Prenotazioni.

    Vai a Prenotazioni

  2. Fai clic sulla scheda Prenotazioni future.

    La tabella elenca ogni richiesta di prenotazione futura e ogni colonna della tabella descrive una proprietà.

  3. Per determinare il numero di istanze che Compute Engine prevede di prenotare per una richiesta all'ora di inizio, sottrai la colonna Conteggio corrispondente dalla colonna Conteggio totale.

    La colonna Conteggio corrispondente mostra uno dei seguenti avvisi:

    • Il conteggio corrispondente è pari a zero: non sono presenti istanze in esecuzione o prenotazioni inutilizzate corrispondenti nel tuo progetto o in qualsiasi progetto con cui è condivisa la tua richiesta.

    • Conteggio corrispondente uguale a Conteggio totale: Compute Engine non prenoterà istanze per la tua richiesta all'ora di inizio.

    Se modifichi una richiesta o crei nuove istanze o prenotazioni corrispondenti alla richiesta, Compute Engine aggiorna la colonna Conteggio corrispondente entro 30 minuti.

  4. (Facoltativo) Per controllare quando è stata aggiornata l'ultima volta la colonna Conteggio corrispondente in una richiesta, segui questi passaggi:

    1. Nella colonna Nome, fai clic sul nome della richiesta. Viene visualizzata una pagina con i dettagli della richiesta di prenotazione futura.

    2. Nella sezione Dettagli della risorsa, controlla il campo Ora ultima valutazione dell'utilizzo corrispondente.

gcloud

  1. Per visualizzare i dettagli di una richiesta di prenotazione futura, utilizza il comando gcloud beta compute future-reservations describe:

    gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
        --zone=ZONE
    

    Sostituisci quanto segue:

    • FUTURE_RESERVATION_NAME: il nome di una richiesta di prenotazione futura esistente

    • ZONE: la zona in cui esiste la richiesta di prenotazione futura.

    Nell'output, individua i campi count e totalCount:

    ...
    specificSkuProperties:
      ...
      totalCount: '100'
    status:
      existingMatchingUsageInfo:
        count: '50'
        timestamp: '2025-03-30T01:00:00Z'
      ...
      procurementStatus: DRAFTING
    ...
    
  2. Sottrai il valore di count da totalCount. Ad esempio, se count è 50 e totalCount è 100, Compute Engine crea automaticamente una prenotazione per 50 istanze all'ora di inizio della richiesta.

    Se modifichi la richiesta o crei nuove istanze o prenotazioni corrispondenti alla richiesta, Compute Engine aggiorna il campo existingMatchingUsageInfo entro 30 minuti. Per verificare quando è stato aggiornato l'ultimo campo, controlla il valore di existingMatchingUsageInfo.timestamp.

REST

  1. Per visualizzare un elenco delle tue richieste di prenotazione futura, invia una richiesta GET al metodo futureReservations.list beta. Nell'URL della richiesta, includi il parametro di query filter e specifica di mostrare solo i campi name, specificSkuProperties e status:

    GET https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations?fields=items.name,items.specificSkuProperties,items.status
    

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto in cui hai creato le richieste di prenotazione futura.

    • ZONE: la zona in cui esiste la richiesta di prenotazione futura.

    Nell'output, individua i campi count e totalCount per ogni bozza, richiesta in attesa di approvazione o richiesta approvata:

    {
      "items": [
        {
          "specificSkuProperties": {
            ...
            totalCount: "100"
          },
          "name": "fr-01",
          "status": {
            "procurementStatus": "APPROVED",
            ...
            existingMatchingUsageInfo: {
              count: "50",
              "timestamp": "2025-01-22T07:54:26.295Z"
            }
          }
        },
        {
          "specificSkuProperties": {
            ...
            totalCount: "20"
          },
          "name": "fr-02",
          "status": {
            "procurementStatus": "DRAFTING",
            ...
            existingMatchingUsageInfo: {
              "count": "2",
              "timestamp": "2025-01-22T07:54:26.295Z"
            }
          }
        }
      ]
    }
    
  2. Per ogni richiesta, sottrai il valore di count da totalCount. Ad esempio, se count è 50 e totalCount è 100, Compute Engine crea automaticamente una prenotazione per 50 istanze all'ora di inizio della richiesta.

    Se modifichi una richiesta o crei nuove istanze o prenotazioni corrispondenti alla richiesta, Compute Engine aggiorna il campo existingMatchingUsageInfo entro 30 minuti. Per verificare quando è stato aggiornato l'ultimo campo, controlla il valore di existingMatchingUsageInfo.timestamp.

Passaggi successivi