Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Nested Virtualization on an existing Google cloud VM instance?

I'm trying to enable Nested Virtualization on a existing VM instance. The VM is on the Intel Haswell CPU platform so Nested Virtualization is possible.

Now I've read this support article at Google: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances

Under the first section Enabling nested virtualization on an instance it says the following:

Create a boot disk from a public image or from a custom image with an operating system. Alternatively, you can skip this step and apply the license to an existing disk from one of your VM instances.

However I can't figure out how to apply the Nested Virtualization license to an existing VM instance. The only steps described are for new disks and I want to apply it to an existing disk.

My question is: How can I enable Nested Virtualization on a existing Google Cloud Instance?

Thanks in advance, Hugo.

like image 444
Hugo Avatar asked Dec 26 '18 11:12

Hugo


1 Answers

I will share with you instructions on how to enable Nested Virtualization on an existing GCP VM instance. More detailed steps are described in the article you shared.

  1. From your existing VM instance, you should already have a boot disk in your project. If not, you should create a boot disk from that VM instance.

  2. Using the boot disk from that existing VM instance, please create a custom image with the special license key required for virtualization.

    a- If you are creating an image using the gcloud command-line tool, provide the following license URL using the --licenses flag:

    https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx

    For example, the following command creates an image named nested-vm-image from an example disk named disk1:

    $ gcloud compute images create nested-vm-image \ --source-disk disk1 --source-disk-zone us-central1-b \ --licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

    b- If you are using the API, please include the licenses property in your API request:

    POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/images { "licenses": ["projects/vm-options/global/licenses/enable-vmx"], "name": "nested-vm-image", "sourceDisk": "zones/us-central1-b/disks/disk1" }

    where [PROJECT_ID] is your project ID.

like image 70
Mahmoud Sharif Avatar answered Dec 14 '22 02:12

Mahmoud Sharif