有关将Google Compute VM映像正确保存到Google存储桶的建议?

时间:2019-03-21 18:16:55

标签: google-cloud-platform google-compute-engine ubuntu-18.04 google-cloud-billing

我有一个使用Google Compute设置的Ubunutu VM,由于非常好,我试图创建该映像的副本并将其存档,以便将来可以使用它创建VM实例。但是,我遇到了随机的命令行错误,因此我将列出所有步骤以查看是否有明显的错误。

首先,可以看到here的VM,我用它创建的映像image-1以及尝试存储它的Google存储桶。

我遵循step 1创建映像,step 2创建存储区,Google可以为我存储VM映像之类的大对象,step 3则是在本地安装Google Cloud SDK计算机来运行必要的命令,然后跟随step 4在其中运行命令。

运行后

gcloud compute images export --destination-uri gs://bucket_address --image image-1

我收到一条长日志,告诉我发生了一个错误。

日志:

Created [https://cloudbuild.googleapis.com/v1/projects/bayes-230019/builds/015e4129-5407-48cd-8fb5-0b0803406a0f].
Logs are available at [https://console.cloud.google.com/gcr/builds/015e4129-5407-48cd-8fb5-0b0803406a0f?project=297462970761].
[Daisy] Running workflow "image-export" (id=2d3br)
[image-export]: 2019-03-21T18:05:51Z Validating workflow
[image-export]: 2019-03-21T18:05:51Z Validating step "setup-disks"
[image-export]: 2019-03-21T18:05:51Z Validating step "image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T18:05:51Z Validating step "setup-disks"
[image-export.image-export-export-disk]: 2019-03-21T18:05:51Z Validating step "run-image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T18:05:52Z Validating step "wait-for-inst-image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T18:05:52Z Validating step "copy-image-object"
[image-export.image-export-export-disk]: 2019-03-21T18:05:52Z Validating step "delete-inst"
[image-export]: 2019-03-21T18:05:52Z Validation Complete
[image-export]: 2019-03-21T18:05:52Z Workflow Project: bayes-230019
[image-export]: 2019-03-21T18:05:52Z Workflow Zone: us-east4-c
[image-export]: 2019-03-21T18:05:52Z Workflow GCSPath: gs://bayes-230019-daisy-bkt/
[image-export]: 2019-03-21T18:05:52Z Daisy scratch path: https://console.cloud.google.com/storage/browser/bayes-230019-daisy-bkt/daisy-image-export-20190321-18:05:50-2d3br
[image-export]: 2019-03-21T18:05:52Z Uploading sources
[image-export]: 2019-03-21T18:05:52Z Running workflow
[image-export]: 2019-03-21T18:05:52Z Running step "setup-disks" (CreateDisks)
[image-export.setup-disks]: 2019-03-21T18:05:52Z CreateDisks: Creating disk "disk-image-export-image-export-2d3br".
[image-export]: 2019-03-21T18:06:37Z Step "setup-disks" (CreateDisks) successfully finished.
[image-export]: 2019-03-21T18:06:37Z Running step "image-export-export-disk" (IncludeWorkflow)
[image-export.image-export-export-disk]: 2019-03-21T18:06:37Z Running step "setup-disks" (CreateDisks)
[image-export.image-export-export-disk.setup-disks]: 2019-03-21T18:06:37Z CreateDisks: Creating disk "disk-image-export-export-disk-image-export-image-export--2d3br".
[image-export]: 2019-03-21T18:06:37Z Error running workflow: step "image-export-export-disk" run error: step "setup-disks" run error: googleapi: Error 403: Quota 'SSD_TOTAL_GB' exceeded. Limit: 100.0 in region us-east4., quotaExceeded
[image-export]: 2019-03-21T18:06:37Z Workflow "image-export" cleaning up (this may take up to 2 minutes).
[Daisy] Errors in one or more workflows:
  image-export: step "image-export-export-disk" run error: step "setup-disks" run error: googleapi: Error 403: Quota 'SSD_TOTAL_GB' exceeded. Limit: 100.0 in region us-east4., quotaExceeded
ERROR
ERROR: build step 0 "gcr.io/compute-image-tools/daisy:release" failed: exit status 1
ERROR: (gcloud.compute.images.export) build 015e4129-5407-48cd-8fb5-0b0803406a0f completed with status "FAILURE"

它提到磁盘大小错误,但是我的映像大小只有31 Gb,并且说我位于us-east4区域的存储桶中的配额超过了100 Gb吗?我在做什么错了?

编辑

按照建议升级帐户,我这样做了,现在代码继续进行,但是最后又出现了一个奇怪的错误。

 image-export: step "image-export-export-disk" run error: step "copy-image-object" run error: error copying from gs://bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2/outs/image-export-export-disk.tar.gz to gs://ml_vm_bucket: storage: object name is empty

新日志:

Created [https://cloudbuild.googleapis.com/v1/projects/bayes-230019/builds/02d7af72-12a4-4950-9bc6-153aabeef788].
Logs are available at [https://console.cloud.google.com/gcr/builds/02d7af72-12a4-4950-9bc6-153aabeef788?project=297462970761].
[Daisy] Running workflow "image-export" (id=mdxb2)
[image-export]: 2019-03-21T20:14:58Z Validating workflow
[image-export]: 2019-03-21T20:14:58Z Validating step "setup-disks"
[image-export]: 2019-03-21T20:14:58Z Validating step "image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T20:14:58Z Validating step "setup-disks"
[image-export.image-export-export-disk]: 2019-03-21T20:14:58Z Validating step "run-image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T20:14:59Z Validating step "wait-for-inst-image-export-export-disk"
[image-export.image-export-export-disk]: 2019-03-21T20:14:59Z Validating step "delete-inst"
[image-export.image-export-export-disk]: 2019-03-21T20:14:59Z Validating step "copy-image-object"
[image-export]: 2019-03-21T20:14:59Z Validation Complete
[image-export]: 2019-03-21T20:14:59Z Workflow Project: bayes-230019
[image-export]: 2019-03-21T20:14:59Z Workflow Zone: us-east4-c
[image-export]: 2019-03-21T20:14:59Z Workflow GCSPath: gs://bayes-230019-daisy-bkt/
[image-export]: 2019-03-21T20:14:59Z Daisy scratch path: https://console.cloud.google.com/storage/browser/bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2
[image-export]: 2019-03-21T20:14:59Z Uploading sources
[image-export]: 2019-03-21T20:15:00Z Running workflow
[image-export]: 2019-03-21T20:15:00Z Running step "setup-disks" (CreateDisks)
[image-export.setup-disks]: 2019-03-21T20:15:00Z CreateDisks: Creating disk "disk-image-export-image-export-mdxb2".
[image-export]: 2019-03-21T20:15:43Z Step "setup-disks" (CreateDisks) successfully finished.
[image-export]: 2019-03-21T20:15:43Z Running step "image-export-export-disk" (IncludeWorkflow)
[image-export.image-export-export-disk]: 2019-03-21T20:15:43Z Running step "setup-disks" (CreateDisks)
[image-export.image-export-export-disk.setup-disks]: 2019-03-21T20:15:43Z CreateDisks: Creating disk "disk-image-export-export-disk-image-export-image-export--mdxb2".
[image-export.image-export-export-disk]: 2019-03-21T20:16:02Z Step "setup-disks" (CreateDisks) successfully finished.
[image-export.image-export-export-disk]: 2019-03-21T20:16:02Z Running step "run-image-export-export-disk" (CreateInstances)
[image-export.image-export-export-disk.run-image-export-export-disk]: 2019-03-21T20:16:02Z CreateInstances: Creating instance "inst-image-export-export-disk-image-export-image-export--mdxb2".
[image-export.image-export-export-disk]: 2019-03-21T20:16:11Z Step "run-image-export-export-disk" (CreateInstances) successfully finished.
[image-export.image-export-export-disk]: 2019-03-21T20:16:11Z Running step "wait-for-inst-image-export-export-disk" (WaitForInstancesSignal)
[image-export.image-export-export-disk.run-image-export-export-disk]: 2019-03-21T20:16:11Z CreateInstances: Streaming instance "inst-image-export-export-disk-image-export-image-export--mdxb2" serial port 1 output to https://storage.cloud.google.com/bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2/logs/inst-image-export-export-disk-image-export-image-export--mdxb2-serial-port1.log
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:11Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": watching serial port 1, SuccessMatch: "ExportSuccess", FailureMatch: "ExportFailed:", StatusMatch: "GCEExport:".
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Running export tool."
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Disk /dev/sdb is 31 GiB, compressed size will most likely be much smaller."
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Exporting disk to gs://bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2/outs/image-export-export-disk.tar.gz."
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Beginning copy..."
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:16:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 504 MiB of 31 GiB (101 MiB/sec), total uploaded size: 76 MiB (15 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:17:12Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 3.5 GiB of 31 GiB (68 MiB/sec), total uploaded size: 1.5 GiB (32 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:17:52Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 6.5 GiB of 31 GiB (69 MiB/sec), total uploaded size: 2.9 GiB (32 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:18:42Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 9.5 GiB of 31 GiB (68 MiB/sec), total uploaded size: 4.2 GiB (31 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:19:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 12 GiB of 31 GiB (54 MiB/sec), total uploaded size: 5.8 GiB (37 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:20:12Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 15 GiB of 31 GiB (65 MiB/sec), total uploaded size: 7.4 GiB (35 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:20:52Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 19 GiB of 31 GiB (102 MiB/sec), total uploaded size: 8.5 GiB (25 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:21:42Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 23 GiB of 31 GiB (93 MiB/sec), total uploaded size: 9.6 GiB (26 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:22:22Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Read 28 GiB of 31 GiB (95 MiB/sec), total uploaded size: 11 GiB (25 MiB/sec)"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:23:02Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": StatusMatch found: "GCEExport: Finished export in 6m43.907834062s"
[image-export.image-export-export-disk.wait-for-inst-image-export-export-disk]: 2019-03-21T20:23:02Z WaitForInstancesSignal: Instance "inst-image-export-export-disk-image-export-image-export--mdxb2": SuccessMatch found "ExportSuccess"
[image-export.image-export-export-disk]: 2019-03-21T20:23:02Z Step "wait-for-inst-image-export-export-disk" (WaitForInstancesSignal) successfully finished.
[image-export.image-export-export-disk]: 2019-03-21T20:23:02Z Running step "copy-image-object" (CopyGCSObjects)
[image-export.image-export-export-disk]: 2019-03-21T20:23:02Z Running step "delete-inst" (DeleteResources)
[image-export.image-export-export-disk.delete-inst]: 2019-03-21T20:23:02Z DeleteResources: Deleting instance "inst-image-export-export-disk".
[image-export]: 2019-03-21T20:23:02Z Error running workflow: step "image-export-export-disk" run error: step "copy-image-object" run error: error copying from gs://bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2/outs/image-export-export-disk.tar.gz to gs://ml_vm_bucket: storage: object name is empty
[image-export]: 2019-03-21T20:23:02Z Workflow "image-export" cleaning up (this may take up to 2 minutes).
[Daisy] Errors in one or more workflows:
  image-export: step "image-export-export-disk" run error: step "copy-image-object" run error: error copying from gs://bayes-230019-daisy-bkt/daisy-image-export-20190321-20:14:58-mdxb2/outs/image-export-export-disk.tar.gz to gs://ml_vm_bucket: storage: object name is empty
ERROR
ERROR: build step 0 "gcr.io/compute-image-tools/daisy:release" failed: exit status 1
ERROR: (gcloud.compute.images.export) build 02d7af72-12a4-4950-9bc6-153aabeef788 completed with status "FAILURE"

2 个答案:

答案 0 :(得分:0)

您正在使用免费套餐。要增加配额,您需要升级到付费帐户。

Google在后台为工作流分配了SSD磁盘空间。该磁盘空间是临时的,因此不会对您的帐单产生太大影响,但是免费套餐帐户无法为工作流分配足够的空间。

答案 1 :(得分:0)

如果您尝试将虚拟机映像从一个GCP帐户导出到另一个GCP帐户,则可以使用以下步骤:

  1. 激活新的Account Compute Engine API,创建(任何)虚拟机,创建其映像,删除虚拟机,删除映像

  2. 转到新帐户的IAM并找到名为以下名称的SA: @ cloudservices.gserviceaccount.com

  3. 使用gcloud对旧的org / project_id进行身份验证并运行此命令:

    gcloud项目add-iam-policy-binding
    --member serviceAccount: @ cloudservices.gserviceaccount.com --role role / compute.imageUser

    gcloud项目add-iam-policy-binding
    --member用户:your @ new_user_email --role role / compute.imageUser

    gcloud计算项目add-iam-policy-binding
    --member用户:your @ new_user_email
    --role ='角色/查看器'

现在您应该能够选择自定义图片-和旧项目ID来从中启动实例