Help us understand the problem. What is going on with this article?

GCPのLive migrationを試してみる

はじめに

GCPのCopute Engineは、ホストマシンの障害時やメンテナンス時に停止、起動といったオペレーションが不要で、LiveMigration機能によりオンラインで同一ゾーン内での別ホストにMigrationが可能です。

やってみた

オペレーション自体は簡単で、gcloud compute instances simulate-maintenance-eventコマンドの引数として、インスタンス名とインスタンスが起動しているゾーンを指定する形になります。

$ date ; gcloud compute instances simulate-maintenance-event instance-3 --zone asia-northeast1-c  --verbosity
 debug ; date
Mon Sep  9 17:26:18 +09 2019
DEBUG: Running [gcloud.compute.instances.simulate-maintenance-event] with arguments: [--verbosity: "debug", --zone: "asia-northeast1-c", INSTANCE_NAMES:1: "[u'instance-3']"]
Simulating maintenance on instance(s) [https://www.googleapis.com/compute/v1/projects/tranquil-scion-251806/zones/asia-northeast1-c/instances/instance-3]
...done.                                                                                                                                                 
INFO: Display format: "none"
DEBUG: SDK update checks are disabled.
Mon Sep  9 17:27:39 +09 2019

81秒程度で完了しました。

蛇足

失敗時は、以下のように制限されてるためエラーとなります。

$ gcloud compute instances simulate-maintenance-event instance-1 --zone us-central1-a
Simulating maintenance on instance(s) [https://www.googleapis.com/compute/v1/projects/tranquil-scion-251806/zones/us-central1-a/instances/instance-1]...failed.                      
ERROR: (gcloud.compute.instances.simulate-maintenance-event) Maintenance cannot be simulated on this instance due to temporary concurrency limitations.  Please try again in a few minutes.

マシンリソースをリザーブしてから実行すればよいかと思い
https://cloud.google.com/compute/docs/instances/reserving-zonal-resources
以下のコマンドでリザーブ作成しました。

$ gcloud beta compute reservations create my-reserve \
>     --machine-type=n1-standard-1 \
>     --min-cpu-platform "Intel Sandy Bridge" \
>     --vm-count=1 \
>     --local-ssd=size=375,interface=scsi \
>     --require-specific-reservation \
>     --zone=us-central1-a

Created [https://www.googleapis.com/compute/beta/projects/tranquil-scion-251806/zones/us-central1-a/reservations/my-reserve].

しかしながら、gcloud compute instances simulate-maintenance-eventコマンドはリザーブIDを指定するオプションがないため使えませんでした。。

ちなみにf1はリザーブできないため、リザーブすると以下のようにエラーになります。

$ gcloud beta compute reservations create my-reserve2 \
>      --machine-type=f1-micro \
>      --min-cpu-platform "Intel Sandy Bridge" \
>      --vm-count=1 \
>      --local-ssd=size=375,interface=scsi \
>      --require-specific-reservation \
>      --zone=us-central1-a
ERROR: (gcloud.beta.compute.reservations.create) Could not fetch resource:
 - Invalid value for field 'resource.specificReservation.instanceProperties.machineType': 'f1-micro'. This machine type is disallowed for reservations.

投稿内容は私個人の意見であり、所属企業・部門見解を代表するものではありません。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away