question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add support for cloud-init drive as created by libvirt_cloudinit_disk

See original GitHub issue

I would like to use the cloud-init disk generated by https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown. I have an ubuntu regular cloud-init example usage at https://github.com/rgl/terraform-libvirt-ubuntu-example which I’m trying to port to windows.

Essentially, terraform-provider-libvirt creates a iso which is attached as a cd-rom to the VM. The cd-rom label is cidata and the root directory has the following files:

  • meta-data
  • network-config
  • user-data

As displayed by Windows Explorer:

image

I’ve tried to follow the cloudbase-init codebase and ended up at https://github.com/cloudbase/cloudbase-init/blob/cd8eca0f91aed04690ed7272485185ab6a1a8e18/cloudbaseinit/metadata/services/osconfigdrive/windows.py#L55-L58 which checks for the label and some files. Is this the best place to add support for the cloud-init? or is it better to create an entire new metadata service class?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ader1990commented, Oct 9, 2019

On another topic, you can easily generate custom Windows images using https://github.com/cloudbase/windows-openstack-imaging-tools/, with support for custom cloudbase-init config files, custom installers and much more.

1reaction
ader1990commented, Oct 9, 2019

Cloudbase-init works on a plugin based framework. Available plugin docs: https://cloudbase-init.readthedocs.io/en/latest/plugins.html

As for the cloud-config example, cloudbase-init supports only setting timezone, hostname and write_file: https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config

Your requirements:

Automatically expand the root disk if there is space available. – plugin available: https://cloudbase-init.readthedocs.io/en/latest/plugins.html#volume-expanding-main

Change a user password: available for more advanced services, your options using config drive are limited to creating a cmd/powershell userdata that does that. For this feature there is (again) an older patch that adds cloud-config support, which you can use: https://review.opendev.org/#/c/379354/

Format and initialize disks: not implemented, but you can fallback to the aforementioned userdata

Set IP configuration: not supported for NoCloudConfigDrive, you need to implement the network metadata parsing, as the plugin exists. For example, the config drive implementation: https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/metadata/services/baseopenstackservice.py#L240 You need to implement for the NoCloudConfigDrive metadata service the get_network_details or get_network_details _v2 method.

Run commands: localscripts plugin or userdata.

Keep in mind that the userdata can be in MIME format: https://cloudbase-init.readthedocs.io/en/latest/userdata.html#multi-part-content

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloud-Init Support - Proxmox VE
Add Cloud-Init CD-ROM drive. The next step is to configure a CD-ROM drive, which will be used to pass the Cloud-Init data to...
Read more >
Creating a VM using Libvirt, Cloud Image and Cloud-Init
Create a VM from scratch by allocating a newly created blank disk image to it. Install an OS on the VM, from either...
Read more >
Cloud config examples - cloud-init 22.4.2 documentation
Cloud config examples# · Including users and groups# · Writing out arbitrary files# · Adding a yum repository# · Configure an instances trusted...
Read more >
Cloud-init support for ProxmoxVE · Issue #2938 · rancher/os
PVE allows users to attach the cloud-init data as an IDE, SATA, or SCSI drive. After attaching this drive to the VM, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found