Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework/redisign cloudinit iso-generation #465

Open
MalloZup opened this issue Oct 30, 2018 · 9 comments
Open

Rework/redisign cloudinit iso-generation #465

MalloZup opened this issue Oct 30, 2018 · 9 comments

Comments

@MalloZup
Copy link
Collaborator

MalloZup commented Oct 30, 2018

So this is issue is for improving the cloudinit design.

We find out currently that requiring mkisofs is not universal enough in different os ( some version of SLES/ and some debian lack on this pkg).
Using also geniso was the same issue.

This issue is more about thinking on how we could redisign the iso generation part in more scalable/universal way.

I was thinking to use usb disk and dd. I think this could be possible and more universal.

But maybe other ways are possible

@moio
Copy link
Collaborator

moio commented Nov 13, 2019

How about using https://github.com/kdomanski/iso9660, do you see any immediate downside or roadblock?

@MalloZup
Copy link
Collaborator Author

good point. I think i didn't check it but is a good link to look at. thx for re-opining :)

@CyberDomovoy
Copy link

For debian:

apt update && apt install xorriso && update-alternatives --install /usr/bin/mkisofs mkisofs /usr/bin/xorrisofs 10

@bigon
Copy link

bigon commented Feb 25, 2020

In the mean time https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680949 has been fixed in debian unstable/testing so installing the genisoimage package should be enough

@MalloZup
Copy link
Collaborator Author

thx

@kstieger
Copy link

kstieger commented Mar 2, 2020

dirkmueller added a commit to dirkmueller/terraform-provider-libvirt that referenced this issue Jun 5, 2020
See https://raw.githubusercontent.com/hashicorp/terraform-plugin-sdk/v1-maint/CHANGELOG.md

BUG FIXES:

* Remove deprecation for `d.Partial` ([dmacvicar#463](hashicorp/terraform-plugin-sdk#463))
* Fix bug when serializing bool in TypeMap ([dmacvicar#465](hashicorp/terraform-plugin-sdk#465))

DEPRECATIONS:

* Deprecate `DisableBinaryDriver` ([dmacvicar#450](hashicorp/terraform-plugin-sdk#450))
* Deprecate the `helper/mutexkv`, `helper/pathorcontents`, `httpclient`, and `helper/hashcode` packages ([dmacvicar#453](hashicorp/terraform-plugin-sdk#453))

FEATURES:

* Allow disabling binary testing via `TF_DISABLE_BINARY_TESTING` environment variable. ([dmacvicar#441](hashicorp/terraform-plugin-sdk#441))

BUG FIXES:

* More accurate results for `schema.ResourceData.HasChange` when dealing with a Set inside another Set. ([dmacvicar#362](hashicorp/terraform-plugin-sdk#362))

DEPRECATED:

* helper/encryption: In line with sensitive state best practices, the `helper/encryption` package is deprecated. ([dmacvicar#437](hashicorp/terraform-plugin-sdk#437))

ENHANCEMENTS:

* Better error messaging when indexing into TypeSet for test checks, while the binary driver is enabled (currently not supported) ([dmacvicar#417](hashicorp/terraform-plugin-sdk#417))
* Prevent ConflictsWith from self referencing and prevent referencing multi item Lists or Sets ([dmacvicar#416](hashicorp/terraform-plugin-sdk#416)] [[dmacvicar#423](hashicorp/terraform-plugin-sdk#423)] [[dmacvicar#426](hashicorp/terraform-plugin-sdk#426))

FEATURES:

* Added validation helper `RequiredWith` ([dmacvicar#342](hashicorp/terraform-plugin-sdk#342))

BUG FIXES:

* Binary acceptance test driver: omit test cleanup when state is empty ([dmacvicar#356](hashicorp/terraform-plugin-sdk#356))
* Make mockT.Fatal halt execution ([dmacvicar#396](hashicorp/terraform-plugin-sdk#396))

DEPENDENCIES:

* `github.com/hashicorp/terraform-plugin-test@v1.2.0` -> `v1.3.0` [[dmacvicar#400](hashicorp/terraform-plugin-sdk#400)]

BUG FIXES:

* Binary acceptance test driver: fix cleanup of temporary directories ([dmacvicar#378](hashicorp/terraform-plugin-sdk#378))

DEPRECATED:

* helper/schema: `ResourceData.GetOkExists` will not be removed in the next major version unless a suitable replacement or alternative can be prescribed ([dmacvicar#350](hashicorp/terraform-plugin-sdk#350))

FEATURES:

* Added support for additional protocol 5.2 fields (`Description`, `DescriptionKind`, `Deprecated`) ([dmacvicar#353](hashicorp/terraform-plugin-sdk#353))

BUG FIXES:

* Binary acceptance test driver: auto-configure providers ([dmacvicar#355](hashicorp/terraform-plugin-sdk#355))

FEATURES:

* helper/validation: `StringNotInSlice` ([dmacvicar#341](hashicorp/terraform-plugin-sdk#341))

FEATURES:

* Binary acceptance test driver ([dmacvicar#262](hashicorp/terraform-plugin-sdk#262))

DEPRECATED:

* helper/schema: `ResourceData.Partial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317))
* helper/schema: `ResourceData.SetPartial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317))

DEPRECATED:

* helper/validation: `ValidateListUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `SingleIP` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IPRange` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `CIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateJsonString` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateRegexp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateRFC3339TimeString` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))

FEATURES:

* helper/validation: `IntDivisibleBy` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IntNotInSlice` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsIPv6Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsIPv4Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsCIDR` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsMACAddress` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsPortNumber` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsPortNumberOrZero` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsDayOfTheWeek` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsMonth` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsRFC3339Time` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithHTTPorHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithScheme` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `ListOfUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsIPAddress` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsIPv4Range` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsCIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `StringIsJSON` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `StringIsValidRegExp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))

FEATURES:

* helper/validation: `StringIsEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsNotEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsNotWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `IsUUID` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) ([dmacvicar#297](hashicorp/terraform-plugin-sdk#297))

BUG FIXES:

* schema/ExactlyOneOf: Fix handling of unknowns in complex types ([dmacvicar#287](hashicorp/terraform-plugin-sdk#287))

BUG FIXES:

* helper/resource: Don't crash when dependent test sweeper is missing ([dmacvicar#279](hashicorp/terraform-plugin-sdk#279))
dirkmueller added a commit to dirkmueller/terraform-provider-libvirt that referenced this issue Jun 5, 2020
See https://raw.githubusercontent.com/hashicorp/terraform-plugin-sdk/v1-maint/CHANGELOG.md

BUG FIXES:

* Remove deprecation for `d.Partial` ([dmacvicar#463](hashicorp/terraform-plugin-sdk#463))
* Fix bug when serializing bool in TypeMap ([dmacvicar#465](hashicorp/terraform-plugin-sdk#465))

DEPRECATIONS:

* Deprecate `DisableBinaryDriver` ([dmacvicar#450](hashicorp/terraform-plugin-sdk#450))
* Deprecate the `helper/mutexkv`, `helper/pathorcontents`, `httpclient`, and `helper/hashcode` packages ([dmacvicar#453](hashicorp/terraform-plugin-sdk#453))

FEATURES:

* Allow disabling binary testing via `TF_DISABLE_BINARY_TESTING` environment variable. ([dmacvicar#441](hashicorp/terraform-plugin-sdk#441))

BUG FIXES:

* More accurate results for `schema.ResourceData.HasChange` when dealing with a Set inside another Set. ([dmacvicar#362](hashicorp/terraform-plugin-sdk#362))

DEPRECATED:

* helper/encryption: In line with sensitive state best practices, the `helper/encryption` package is deprecated. ([dmacvicar#437](hashicorp/terraform-plugin-sdk#437))

ENHANCEMENTS:

* Better error messaging when indexing into TypeSet for test checks, while the binary driver is enabled (currently not supported) ([dmacvicar#417](hashicorp/terraform-plugin-sdk#417))
* Prevent ConflictsWith from self referencing and prevent referencing multi item Lists or Sets ([dmacvicar#416](hashicorp/terraform-plugin-sdk#416)] [[dmacvicar#423](hashicorp/terraform-plugin-sdk#423)] [[dmacvicar#426](hashicorp/terraform-plugin-sdk#426))

FEATURES:

* Added validation helper `RequiredWith` ([dmacvicar#342](hashicorp/terraform-plugin-sdk#342))

BUG FIXES:

* Binary acceptance test driver: omit test cleanup when state is empty ([dmacvicar#356](hashicorp/terraform-plugin-sdk#356))
* Make mockT.Fatal halt execution ([dmacvicar#396](hashicorp/terraform-plugin-sdk#396))

DEPENDENCIES:

* `github.com/hashicorp/terraform-plugin-test@v1.2.0` -> `v1.3.0` [[dmacvicar#400](hashicorp/terraform-plugin-sdk#400)]

BUG FIXES:

* Binary acceptance test driver: fix cleanup of temporary directories ([dmacvicar#378](hashicorp/terraform-plugin-sdk#378))

DEPRECATED:

* helper/schema: `ResourceData.GetOkExists` will not be removed in the next major version unless a suitable replacement or alternative can be prescribed ([dmacvicar#350](hashicorp/terraform-plugin-sdk#350))

FEATURES:

* Added support for additional protocol 5.2 fields (`Description`, `DescriptionKind`, `Deprecated`) ([dmacvicar#353](hashicorp/terraform-plugin-sdk#353))

BUG FIXES:

* Binary acceptance test driver: auto-configure providers ([dmacvicar#355](hashicorp/terraform-plugin-sdk#355))

FEATURES:

* helper/validation: `StringNotInSlice` ([dmacvicar#341](hashicorp/terraform-plugin-sdk#341))

FEATURES:

* Binary acceptance test driver ([dmacvicar#262](hashicorp/terraform-plugin-sdk#262))

DEPRECATED:

* helper/schema: `ResourceData.Partial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317))
* helper/schema: `ResourceData.SetPartial` ([dmacvicar#317](hashicorp/terraform-plugin-sdk#317))

DEPRECATED:

* helper/validation: `ValidateListUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `SingleIP` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IPRange` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `CIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateJsonString` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateRegexp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `ValidateRFC3339TimeString` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))

FEATURES:

* helper/validation: `IntDivisibleBy` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IntNotInSlice` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsIPv6Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsIPv4Address` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsCIDR` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsMACAddress` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsPortNumber` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsPortNumberOrZero` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsDayOfTheWeek` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsMonth` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsRFC3339Time` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithHTTPorHTTPS` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `IsURLWithScheme` ([dmacvicar#296](hashicorp/terraform-plugin-sdk#296))
* helper/validation: `ListOfUniqueStrings` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsIPAddress` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsIPv4Range` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `IsCIDRNetwork` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `StringIsJSON` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `StringIsValidRegExp` ([dmacvicar#301](hashicorp/terraform-plugin-sdk#301))
* helper/validation: `StringIsEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsNotEmpty` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `StringIsNotWhiteSpace` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294))
* helper/validation: `IsUUID` ([dmacvicar#294](hashicorp/terraform-plugin-sdk#294)) ([dmacvicar#297](hashicorp/terraform-plugin-sdk#297))

BUG FIXES:

* schema/ExactlyOneOf: Fix handling of unknowns in complex types ([dmacvicar#287](hashicorp/terraform-plugin-sdk#287))
* helper/resource: Don't crash when dependent test sweeper is missing ([dmacvicar#279](hashicorp/terraform-plugin-sdk#279))
@NHAS
Copy link

NHAS commented Jun 13, 2023

Hm, not sure if this is the right place to put this but using 0.7.1 I seem to get an infinite hang when generating the cloudinit disk using archlinux as the host to create a rocklylinux guest.
I saw in the debug logs that I needed mkisofs however this doesnt seem to have resolved the issue, if this was brought into the application itself it might prevent weirdness like this.

As example here is a tiny snippet of a build reaching the 22 minute mark despite it only trying to create a single host:
Where the cloud-init contents is literally "set a public key"

libvirt_cloudinit_disk.commoninit: Still creating... [22m11s elapsed]
libvirt_volume.rocky9: Still creating... [22m21s elapsed]
libvirt_cloudinit_disk.commoninit: Still creating... [22m21s elapsed]

main.tf

terraform {
  required_version = ">= 0.13"
  required_providers {
    libvirt = {
      source  = "dmacvicar/libvirt"
      version = "0.7.1"
    }
  }
}

# instance the provider
provider "libvirt" {
  uri = "qemu:///system"
}

# We fetch the latest ubuntu release image from their mirrors
resource "libvirt_volume" "rocky9" {
  name   = "rocky9"
  source = "https://download.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2"
  format = "qcow2"
}

data "template_file" "user_data" {
  template = file("${path.module}/cloud_init.cfg")
}

data "template_file" "network_config" {
  template = file("${path.module}/network_config.cfg")
}

# for more info about paramater check this out
# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown
# Use CloudInit to add our ssh-key to the instance
# you can add also meta_data field
resource "libvirt_cloudinit_disk" "commoninit" {
  name           = "commoninit.iso"
  user_data      = data.template_file.user_data.rendered
  network_config = data.template_file.network_config.rendered
}

# Create the machine
resource "libvirt_domain" "domain-rocky9" {
  name   = "rocky9-terraform"
  memory = "2048"
  vcpu   = 2

  cloudinit = libvirt_cloudinit_disk.commoninit.id

  network_interface {
    network_name   = "default"
    wait_for_lease = true
  }

  cpu {
    mode = "host-passthrough"
  }

  # IMPORTANT: this is a known bug on cloud images, since they expect a console
  # we need to pass it
  # https://bugs.launchpad.net/cloud-images/+bug/1573095
  console {
    type        = "pty"
    target_port = "0"
    target_type = "serial"
  }

  console {
    type        = "pty"
    target_type = "virtio"
    target_port = "1"
  }

  disk {
    volume_id = libvirt_volume.rocky9.id
  }

  graphics {
    type     = "vnc"
    autoport = true
  }
}

@NHAS
Copy link

NHAS commented Jun 13, 2023

Ah okay, terraform 1.5.0 is broken, terraform 1.4.6 is totally fine. This isnt an issue for here I'll open one directly.

@scabala
Copy link
Contributor

scabala commented Sep 17, 2024

Related to #1018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants