הצגת הזמנות או בקשות להזמנות עתידיות

במאמר הזה מוסבר איך לצפות בהזמנות, בבקשות להזמנות עתידיות ובצריכת הנתונים במקום שמור. מידע נוסף על הזמנות זמין במאמר בחירת סוג הזמנה.

כשאתם צופים בהזמנות, בבקשות למקום שמור לעתיד או בשימוש בהזמנות, אתם יכולים:

  • הצגת הגדרות ההזמנה הבדיקה הזו עוזרת לכם לוודא שהפרטים של ההזמנות נכונים, שהן עונות על הצרכים שלכם ולתכנן את הקיבולת.

  • קביעת מספר המופעים שניתן לצרוך. הבדיקה הזו עוזרת לכם לקבוע כמה מכונות של Compute Engine יכולות לצרוך את הקיבולת המוזמנת.

  • צפייה בשימוש בהזמנה בסקירה הזו אפשר לבדוק איזו הזמנה נצרכת על ידי מכונה ספציפית של Compute Engine, או לראות רשימה של כל המכונות שצורכות הזמנה מסוימת בפרויקט.

מגבלות

אפשר לראות בקשה משותפת לשריון מקום שמור או בקשה משותפת לשריון מקום שמור לעתיד רק בפרויקט שבו היא נוצרה.

לפני שמתחילים

התפקידים הנדרשים

כדי לקבל את ההרשאות שנדרשות לצפייה בהזמנות או בבקשות להזמנות עתידיות, צריך לבקש מהאדמין להקצות לכם ב-IAM את התפקיד אדמין של Compute (roles/compute.admin) בפרויקט. כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

זהו תפקיד שמוגדר מראש וכולל את ההרשאות שנדרשות לצפייה בהזמנות או בבקשות להזמנות עתידיות. כדי לראות בדיוק אילו הרשאות נדרשות, אפשר להרחיב את הקטע ההרשאות הנדרשות:

ההרשאות הנדרשות

כדי להציג מקומות שמורים או בקשות למקום שמור לעתיד, נדרשות ההרשאות הבאות:

  • כדי לראות רשימה של הזמנות: compute.reservations.list בפרויקט
  • כדי לראות רשימה של בקשות למקומות שמורים לעתיד: compute.futureReservations.list בפרויקט
  • כדי לראות את פרטי ההזמנה: compute.reservations.get בפרויקט
  • כדי לראות את הפרטים של בקשה למקום שמור לעתיד: compute.futureReservations.get בפרויקט

יכול להיות שתקבלו את ההרשאות האלה באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש אחרים.

הצגת הגדרות ההזמנה

בקטעים הבאים מוסבר איך לראות את ההגדרות של ההזמנות או של בקשות להזמנות עתידיות.

הצגת הזמנות

כדי לראות את ההגדרות של הזמנה אחת או יותר, משתמשים באחת מהשיטות הבאות שמתוארות בקטע הזה:

  • כדי לראות סקירה כללית של כל ההזמנות בפרויקט, אפשר להציג רשימה של ההזמנות.

  • כדי לראות את הפרטים המלאים של הזמנה מסוימת, אפשר לעיין בפרטים של ההזמנה.

כדי לראות את השדות deleteAtTime ו-reservationSharingPolicy (תצוגה מקדימה) בהזמנה, אפשר להציג את פרטי ההזמנה באמצעות Google Cloud CLI או באמצעות ה-API בארכיטקטורת REST. אם השדות האלה לא נדרשים, אפשר לראות את ההזמנות על ידי בחירה באחת מהאפשרויות הבאות:

המסוף

  1. פותחים את הדף Reservations במסוף Cloud de Confiance .

    כניסה לדף Reservations

    בכרטיסייה On-demand reservations (ברירת המחדל), כל הזמנה מופיעה בשורה נפרדת בטבלה, וכל עמודה בטבלה מתארת מאפיין.

  2. אופציונלי: בטבלה On-demand reservations, מבצעים אחת מהפעולות הבאות או את שתיהן:

    • כדי להציג את assured count של ההזמנות, לוחצים על Column display options..., מסמנים את תיבת הסימון Assured count ולוחצים על OK.

    • כדי לצמצם את רשימת ההזמנות, בשדה Filter בוחרים את המאפיינים שלפיהם רוצים לסנן את ההזמנות.

  3. כדי לראות את פרטי ההזמנה, בעמודה Name (שם), לוחצים על שם ההזמנה. ייפתח דף עם פרטי ההזמנה.

gcloud

  • כדי לראות את רשימת ההזמנות, משתמשים בפקודה gcloud compute reservations list:

    gcloud compute reservations list
    

    הפלט אמור להיראות כך:

    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
    

    אופציונלי: כדי לצמצם את רשימת ההזמנות באמצעות ביטוי סינון, כוללים את הדגל --filter:

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

    מחליפים את FILTER_EXPRESSION בביטוי סינון.

  • כדי לראות את פרטי ההזמנה, משתמשים בפקודה gcloud compute reservations describe:

    gcloud compute reservations describe RESERVATION_NAME \
        --zone=ZONE
    

    מחליפים את מה שכתוב בשדות הבאים:

    • RESERVATION_NAME: השם של הזמנה קיימת.

    • ZONE: האזור שבו קיימת ההזמנה.

    הפלט אמור להיראות כך:

    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
    

המשך

  • כדי לראות את רשימת ההזמנות, משתמשים בדוגמת הקוד הבאה:

    // 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
    }
    
    
  • כדי להציג את פרטי ההזמנה, משתמשים בדוגמת הקוד הבאה:

    // 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

  • כדי לראות את רשימת ההזמנות, משתמשים בדוגמת הקוד הבאה:

    /*
     * 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;
      }
    }
  • כדי להציג את פרטי ההזמנה, משתמשים בדוגמת הקוד הבאה:

    /*
     * 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

  • כדי לראות את רשימת ההזמנות, משתמשים בדוגמת הקוד הבאה:

    /*
     * 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;
    });
    
  • כדי להציג את פרטי ההזמנה, משתמשים בדוגמת הקוד הבאה:

    /*
     * 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

  • כדי לראות את רשימת ההזמנות, משתמשים בדוגמת הקוד הבאה:

    # 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
    
    
    
  • כדי להציג את פרטי ההזמנה, משתמשים בדוגמת הקוד הבאה:

    # 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

  • כדי לראות רשימה של ההזמנות שלכם, שולחים בקשת GET אל ה-method‏ reservations.list:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PROJECT_ID: מזהה הפרויקט שבו יצרתם את ההזמנות.

    • ZONE: האזור שבו קיימות ההזמנות.

    הפלט אמור להיראות כך:

    {
      "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"
      }
    }
    

    אפשר גם לצמצם את רשימת ההזמנות באמצעות ביטוי מסנן. כדי לעשות זאת, צריך לכלול את פרמטר השאילתה filter:

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

    במקום FILTER_EXPRESSION, מזינים ביטוי מסנן שמשתמש בערכים עם קידוד URL.

  • כדי לראות את פרטי ההזמנה, שולחים בקשת GET ל-method‏ reservations.get.

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PROJECT_ID: מזהה הפרויקט שבו יצרתם את ההזמנה.

    • ZONE: האזור שבו קיימת ההזמנה.

    • RESERVATION_NAME: השם של הזמנה קיימת.

    הפלט אמור להיראות כך:

    {
      "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"
      }
    }
    

הצגת בקשות למקום שמור לעתיד

כדי לראות את ההגדרות של בקשות למקום שמור לעתיד, אפשר להשתמש באחת מהשיטות הבאות שמתוארות בקטע הזה:

  • כדי לראות סקירה כללית של כל מקומות שמורים לעתיד בפרויקט, אפשר לעיין ברשימת הבקשות.

  • כדי לראות את הפרטים המלאים של בקשה יחידה למקום שמור לעתיד, אפשר לעיין בפרטי הבקשה.

כדי לראות בקשות למקום שמור לעתיד, בוחרים באחת מהאפשרויות הבאות:

המסוף

  1. פותחים את הדף Reservations במסוף Cloud de Confiance .

    כניסה לדף Reservations

  2. לוחצים על הכרטיסייה Future reservations.

    בטבלה מפורטת כל בקשה למקום שמור לעתיד, ובכל עמודה בטבלה מתואר מאפיין.

  3. אופציונלי: כדי לצמצם את רשימת הבקשות, בשדה Filter בוחרים את המאפיינים שלפיהם רוצים לסנן את הבקשות.

  4. כדי לראות את פרטי הבקשה, בעמודה Name, לוחצים על שם הבקשה. ייפתח דף עם הפרטים של בקשת המקום השמור לעתיד.

gcloud

  • כדי להציג רשימה של בקשות למקום שמור לעתיד, משתמשים בפקודה gcloud compute future-reservations list:

    gcloud compute future-reservations list
    

    הפלט אמור להיראות כך:

    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
    

    אופציונלי: כדי לצמצם את רשימת הבקשות למקום שמור לעתיד באמצעות ביטוי מסנן, כוללים את הדגל --filter:

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

    מחליפים את FILTER_EXPRESSION בביטוי סינון.

  • כדי לראות את הפרטים של בקשה למקום שמור לעתיד, משתמשים בפקודה gcloud compute future-reservations describe:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • FUTURE_RESERVATION_NAME: השם של בקשה קיימת למקום שמור לעתיד.

    • ZONE: האזור שבו קיימת הבקשה למקום שמור לעתיד.

    הפלט אמור להיראות כך:

    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/v1/projects/example-project/zones/us-central1-a/futureReservations/fr-01
    selfLinkWithId: https://www.s3nsapis.fr/compute/v1/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/v1/projects/example-project/zones/us-central1-a
    

REST

  • כדי להציג רשימה של בקשות למקומות שמורים לעתיד, שולחים בקשת GET אל ה-method‏ futureReservations.list:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PROJECT_ID: המזהה של הפרויקט שבו יצרתם את בקשות המקום השמור לעתיד.

    • ZONE: האזור שבו קיימות בקשות ההזמנה העתידיות.

    הפלט אמור להיראות כך:

    {
      "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/v1/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
          "selfLinkWithId": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
          "zone": "https://www.s3nsapis.fr/compute/v1/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/v1/projects/my-project/zones/us-east1-a/futureReservations",
      "etag": "AnzKY34l-cvvV-JnniESJ0dtQvQ=/hvc4jaHpxFAZmOt1FVtKNgzZu-M=",
      "kind": "compute#futureReservationsListResponse"
    }
    

    אפשר גם להשתמש בביטוי מסנן כדי לצמצם את רשימת הבקשות להזמנות עתידיות. לשם כך, צריך לכלול את הפרמטר filter של השאילתה:

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

    במקום FILTER_EXPRESSION, מזינים ביטוי מסנן שמשתמש בערכים עם קידוד URL.

  • כדי לראות את הפרטים של בקשה למקום שמור לעתיד, שולחים בקשת GET אל ה-method‏ futureReservations.get:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PROJECT_ID: מזהה הפרויקט שבו יצרתם את בקשת המקום השמור לעתיד.

    • ZONE: האזור שבו קיימת הבקשה למקום שמור לעתיד.

    • FUTURE_RESERVATION_NAME: השם של בקשה קיימת למקום שמור לעתיד.

    הפלט אמור להיראות כך:

    {
      "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/v1/projects/example-project/zones/us-central1-a/futureReservations/fr-01",
      "selfLinkWithId": "https://www.s3nsapis.fr/compute/v1/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/v1/projects/example-project/zones/us-central1-a"
    }
    

קביעת מספר המכונות הניתנות לשימוש

כדי לקבוע את מספר המקרים של Compute שיכולים לנצל את הקיבולת המוזמנת, אפשר לבצע אחת מהפעולות הבאות:

מופעים שניתנים לשימוש בהזמנה

כשמציגים את פרטי ההזמנה, אפשר לראות כמה מופעי מחשוב צורכים את ההזמנה וכמה מופעים יכולים לצרוך אותה. כדי לעשות את זה, בודקים את השדות הבאים:

  • מספר מובטח (assuredCount): מספר המכונות שמוזמנות פיזית באזור של ההזמנה. המספר הזה כולל את המקרים ששמורים לפרויקט שלכם, ולכל פרויקט ששמורה משותפת משותפת איתו.

  • המספר הכולל (count): מספר המקרים השמורים שצוינו בהזמנה. המספר הזה צריך להיות זהה למספר המובטח.

  • Machines in use (מכונות בשימוש) (inUseCount): מספר המופעים הפועלים בפרויקט או בפרויקט שמשתף איתו הזמנה, שצורכים את ההזמנה.

לדוגמה, אם המספר המובטח (assuredCount) והמספר הכולל (count) הם 50, ומספר המקרים שצורכים את ההזמנה (inUseCount) הוא 25, אז אפשר להשתמש בעוד 25 מקרים לפני שההזמנה תמוצה במלואה.

Consumable instances in a future reservation request

אתם יכולים לקבוע את מספר המכונות ש-Compute Engine יוצר עבורן מקום שמור בשעת ההתחלה של בקשה למקום שמור לעתיד. כדי לדעת מה מספר הבקשה שנמצאת בשלב הטיוטה, בהמתנה לאישור או שאושרה, אפשר לפעול לפי השלבים הבאים:

  1. אתם יכולים לראות כמה מופעים פעילים וכמה מקומות שמורים לא מנוצלים בפרויקט שלכם, ובכל פרויקט שהבקשה משותפת איתו, תואמים למאפייני הבקשה.

  2. מפחיתים את מספר המופעים הפעילים התואמים ואת מספר השמירות שלא נעשה בהן שימוש מהמספר הכולל בבקשה.

אתם יכולים לקבוע את מספר המכונות שניתן להשתמש בהן לבקשה אחת או לכמה בקשות בו-זמנית. כדי לשלוח כמה בקשות, אפשר להשתמש ב Cloud de Confiance מסוף או ב-API בארכיטקטורת REST. לגבי בקשות בודדות, בוחרים אחת מהאפשרויות הבאות:

המסוף

  1. פותחים את הדף Reservations במסוף Cloud de Confiance .

    כניסה לדף Reservations

  2. לוחצים על הכרטיסייה Future reservations.

    בטבלה מפורטת כל בקשה למקום שמור לעתיד, ובכל עמודה בטבלה מתואר מאפיין.

  3. כדי לקבוע את מספר המכונות ש-Compute Engine מתכנן לשריין לבקשה בזמן ההתחלה שלה, מפחיתים את הערך בעמודה מספר התאמות מהערך בעמודה מספר כולל.

    בעמודה מספר ההתאמות מוצגת אחת מהאזהרות הבאות:

    • מספר ההתאמות הוא אפס: אין מופעים פעילים תואמים או הזמנות לא מנוצלות בפרויקט שלכם, או בכל פרויקט אחר שהבקשה שלכם משותפת איתו.

    • Matching count equals Total count: ‏ Compute Engine לא ישריין מכונות לבקשה שלכם בזמן ההתחלה שלה.

    אם משנים בקשה או יוצרים הזמנות או מכונות וירטואליות חדשות שתואמות לבקשה, מערכת Compute Engine מעדכנת את העמודה מספר התוצאות התואמות תוך 30 דקות.

  4. אופציונלי: כדי לבדוק מתי העמודה מספר ההתאמות עודכנה לאחרונה בבקשה, מבצעים את הפעולות הבאות:

    1. בעמודה Name (שם), לוחצים על שם הבקשה. ייפתח דף עם הפרטים של בקשת המקום השמור לעתיד.

    2. בקטע פרטי המשאב, בודקים את השדה הזמן האחרון של הערכת השימוש התואם.

gcloud

  1. כדי לראות את הפרטים של בקשה למקום שמור לעתיד, משתמשים בפקודה gcloud compute future-reservations describe:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • FUTURE_RESERVATION_NAME: השם של בקשה קיימת למקום שמור לעתיד.

    • ZONE: האזור שבו קיימת הבקשה למקום שמור לעתיד.

    בפלט, מחפשים את השדות count ו-totalCount:

    ...
    specificSkuProperties:
      ...
      totalCount: '100'
    status:
      existingMatchingUsageInfo:
        count: '50'
        timestamp: '2025-03-30T01:00:00Z'
      ...
      procurementStatus: DRAFTING
    ...
    
  2. חיסור הערך של count מ-totalCount. לדוגמה, אם הערך של count הוא 50 והערך של totalCount הוא 100, ‏ Compute Engine יוצר באופן אוטומטי הזמנה ל-50 מכונות בשעת ההתחלה של הבקשה.

    אם משנים את הבקשה, או יוצרים מכונות או הזמנות חדשות שתואמות לבקשה, מערכת Compute Engine מעדכנת את השדה existingMatchingUsageInfo תוך 30 דקות. כדי לדעת מתי השדה הזה עודכן לאחרונה, בודקים את הערך של existingMatchingUsageInfo.timestamp.

REST

  1. כדי לראות רשימה של הבקשות למקומות שמורים לעתיד, שולחים בקשת GET אל ה-method‏ futureReservations.list. בכתובת ה-URL של הבקשה, כוללים את פרמטר השאילתה filter ומציינים להציג רק את השדות name, specificSkuProperties ו-status:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PROJECT_ID: המזהה של הפרויקט שבו יצרתם את בקשות המקום השמור לעתיד.

    • ZONE: האזור שבו קיימת הבקשה למקום שמור לעתיד.

    בפלט, מחפשים את השדות count ו-totalCount של כל בקשה שנמצאת בשלב הטיוטה, בהמתנה לאישור או שאושרה:

    {
      "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. בכל בקשה, מחסרים את הערך של count מ-totalCount. לדוגמה, אם count הוא 50 ו-totalCount הוא 100, ‏ Compute Engine יוצר אוטומטית בקשה לשמירת מקום ל-50 מכונות בשעת ההתחלה של הבקשה.

    אם משנים בקשה, או יוצרים מכונות או שמירת מקום חדשות שתואמות לבקשה, Compute Engine מעדכן את השדה existingMatchingUsageInfo תוך 30 דקות. כדי לדעת מתי השדה הזה עודכן לאחרונה, בודקים את הערך של existingMatchingUsageInfo.timestamp.

מופעים שניתן להשתמש בהם בבקשה למקום שמור לעתיד במצב יומן

כשפותחים את הפרטים של בקשה לשמירת מקום לעתיד, אפשר לראות כמה מכונות וירטואליות של Compute Engine מתוכננות להקצאה בזמן ההתחלה של הבקשה. ‫Compute Engine יוצר את מספר המכונות שצוין בבקשה, בלי קשר למספר המכונות התואמות בפרויקט שלכם או בכל פרויקט אחר שהבקשה משותפת איתו.

איך רואים את נתוני הצריכה של מכונות ספציפיות

בכל פעם שמכונת חישוב צורכת הזמנה, אפשר לראות את הפרטים הבאים:

איך רואים את ההזמנה שבה נעשה שימוש במכונה

כדי לראות את ההזמנה שמופעלת על ידי מופע, בוחרים באחת מהאפשרויות הבאות:

המסוף

  1. נכנסים לדף VM instances במסוף Cloud de Confiance .

    כניסה לדף VM instances

  2. לוחצים על השם של המכונה שצורכת הזמנה שרוצים לראות.

  3. בקטע מידע בסיסי, בשדה Consumed reservation (ניצול של הזמנה), מוצג השם של ההזמנה שהמופע צורך.

gcloud

כדי לראות את ההזמנה שמוקצית למכונה, משתמשים בפקודה gcloud compute instances describe עם הדגל --flatten=resourceStatus.reservationConsumptionInfo:

gcloud compute instances describe INSTANCE_NAME \
    --flatten=resourceStatus.reservationConsumptionInfo \
    --zone=ZONE

מחליפים את מה שכתוב בשדות הבאים:

  • INSTANCE_NAME: השם של המכונה.
  • ZONE: האזור שבו המכונה קיימת.

הפלט אמור להיראות כך:

consumedReservation: https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-c/reservations/example-reservation

REST

כדי לראות את הבקשה לשמירת מקום שמוקצת למכונה, שולחים בקשת GET אל ה-method‏ instances.get. בכתובת ה-URL של הבקשה, כוללים את פרמטר השאילתה fields שמוגדר לערך resourceStatus.reservationConsumptionInfo:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME?fields=resourceStatus.reservationConsumptionInfo

מחליפים את מה שכתוב בשדות הבאים:

  • PROJECT_ID: מזהה הפרויקט שבו קיים המופע.
  • ZONE: האזור שבו המכונה קיימת.
  • INSTANCE_NAME: השם של המכונה.

תופיע תגובה שדומה לזו:

{
  "resourceStatus": {
    "reservationConsumptionInfo": {
      "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
    }
  }
}

צפייה ברשימת המקרים שצורכים הזמנה

אפשר לראות רשימה של מכונות עם צריכת נתונים בהזמנה במסגרת פרויקט יחיד. במקרה של מקום שמור משותף, השיטה הזו מחזירה רק את המכונות בפרויקט שצוין, ולא כוללת מכונות מפרויקטים אחרים שצורכים את אותו מקום שמור.

כדי לראות את המקרים שצורכים הזמנה, בוחרים באחת מהאפשרויות הבאות:

gcloud

כדי לראות את המכונות הווירטואליות שצורכות את ההזמנה, משתמשים בפקודה gcloud compute instances list עם הדגל --filter שמוגדר להזמנה שרוצים לראות:

gcloud compute instances list \
    --project=CONSUMER_PROJECT_ID \
    --zones=ZONE \
    --filter="resourceStatus.reservationConsumptionInfo.consumedReservation:https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME"

מחליפים את מה שכתוב בשדות הבאים:

  • CONSUMER_PROJECT_ID: מזהה הפרויקט שבו נעשה שימוש בהזמנה.
  • ZONE: האזור שבו נמצאים ההזמנה והמכונות.
  • HOST_PROJECT_ID: מזהה הפרויקט שבו נוצרה ההזמנה (אם הוא שונה מפרויקט הלקוח).
  • RESERVATION_NAME: השם של ההזמנה.

הפלט אמור להיראות כך:

NAME               ZONE           MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
my-e2-instance     us-central1-c  e2-medium                  10.128.0.61  35.239.208.172  RUNNING
my-e2-instance-02  us-central1-c  e2-medium                  10.128.0.62  104.154.31.123  RUNNING
my-e2-instance-03  us-central1-c  e2-medium                  10.128.0.63  34.171.90.254   RUNNING

REST

כדי לראות את המכונות שצורכות הזמנה, שולחים בקשת GET אל ה-method‏ instances.list. בכתובת ה-URL של הבקשה, מוסיפים את פרמטר השאילתה filter שמוגדר לשם ההזמנה שרוצים להציג:

GET https://compute.googleapis.com/compute/v1/projects/CONSUMER_PROJECT_ID/zones/ZONE/instances?filter=resourceStatus.reservationConsumptionInfo.consumedReservation%3D%22.*%2Fprojects%2FHOST_PROJECT_ID%2Fzones%2FZONE%2Freservations%2FRESERVATION_NAME%22

מחליפים את מה שכתוב בשדות הבאים:

  • CONSUMER_PROJECT_ID: מזהה הפרויקט שבו נעשה שימוש בהזמנה.
  • ZONE: האזור שבו נמצאים ההזמנה והמכונות.
  • HOST_PROJECT_ID: מזהה הפרויקט שבו נוצרה ההזמנה (אם הוא שונה מפרויקט הלקוח).
  • RESERVATION_NAME: השם של ההזמנה.

תופיע תגובה שדומה לזו:

{
  "kind": "compute#instanceList",
  "id": "projects/example-project/zones/us-central1-a/instances",
  "items": [
    {
      ...
      "name": "example-instance-01",
      ...
      "resourceStatus": {
        "scheduling": {},
        "reservationConsumptionInfo": {
          "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
        }
      }
    },
    {
      ...
      "name": "example-instance-02",
      ...
      "resourceStatus": {
        "scheduling": {},
        "reservationConsumptionInfo": {
          "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
        }
      },
      ...
    }
  ],
  "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances"
}

המאמרים הבאים