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

Can't find storage pool 'default' #446

Closed
rajugupta15 opened this issue Oct 13, 2018 · 2 comments
Closed

Can't find storage pool 'default' #446

rajugupta15 opened this issue Oct 13, 2018 · 2 comments

Comments

@rajugupta15
Copy link

rajugupta15 commented Oct 13, 2018

Version Reports:

Distro version of host:

ubuntu 18.04

Terraform Version Report

(11.8.)

Libvirt version

4.0.0

terraform-provider-libvirt plugin version (0.5.0)

Setup

provider "libvirt" {
    uri = "qemu:///system"
}
data "ignition_user" "users" {
    name = "raju"
    home_dir = "/home/raju/"
    shell = "/bin/bash"
}

# Ignition config include the previous defined systemd unit data source
data "ignition_config" "example" {
   users = [
	"${data.ignition_user.users.id}"
  ]
}

resource "libvirt_ignition" "ignition" {
  name = "ignition"
  content = "${data.ignition_config.example.rendered}"
}

resource "libvirt_volume" "coreos-qcow2" {
  name = "coreos-qcow2"
  source = "http://localhost/coreos_production_qemu_image.img"
  format = "qcow2"
}

resource "libvirt_domain" "my_machine" {
  coreos_ignition = "${libvirt_ignition.ignition.id}"
  name = "coreos1"
  memory = "2048"
  vcpu = 2
  network_interface {
	network_name = "tf"
  }
  disk {
    volume_id = "${libvirt_volume.coreos-qcow2.id}"
  }
}

Steps to Reproduce Issue

data.ignition_user.users: Refreshing state...
data.ignition_config.example: Refreshing state...

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + libvirt_domain.my_machine
      id:                               <computed>
      arch:                             <computed>
      coreos_ignition:                  "${libvirt_ignition.ignition.id}"
      disk.#:                           "1"
      disk.0.scsi:                      "false"
      disk.0.volume_id:                 "${libvirt_volume.coreos-qcow2.id}"
      emulator:                         <computed>
      machine:                          <computed>
      memory:                           "2048"
      name:                             "coreos1"
      network_interface.#:              "1"
      network_interface.0.addresses.#:  <computed>
      network_interface.0.hostname:     <computed>
      network_interface.0.mac:          <computed>
      network_interface.0.network_id:   <computed>
      network_interface.0.network_name: "tf"
      qemu_agent:                       "false"
      running:                          "true"
      vcpu:                             "2"

  + libvirt_ignition.ignition
      id:                               <computed>
      content:                          "{\"ignition\":{\"config\":{},\"timeouts\":{},\"version\":\"2.1.0\"},\"networkd\":{},\"passwd\":{\"users\":[{\"homeDir\":\"/home/raju/\",\"name\":\"raju\",\"sshAuthorizedKeys\":[\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCn0y286Tk8QfHtt2JRWr1syBNi4ohpc9mvjGHFqudexKMdD4d8ucn5uKQ8eNylhw96fuU7OaPECzhkkuGdlnxDsBcyXJpwQNUNGgjFoKPZVICNXSOdeEdMMbXCwg5+eCGRM1zcT9P3VNq7JpPlIDPmwdZfVa3AVFnVQaX0bfghiv5BaURs/lRue8sAxgSfk3yRkNKW2DPu9QsyxhoyBktp2BH9TsJF7UAY3I9w3lXjT6fov4vWe2cnX6zY5ygKgRWpRDmJyX9kVJAVnLo2+3XTtIfE/NOl6LjUfowTe2lAiu6d2g3eK9hYPodC6Kg/co58riL3fXxdmi31rQnb4mrK7NG8zmylc+gBzehLwohKTTdUbAPPWakmpyK4K8HFNSX3oaIlMU4/AVTFk24JhDK+E20sXKYUKWW1wVK+VhIlKhMCTPwMJ7hei4QvEswSv8LfhvdL4oX58Ew86+IU9P17X7oxuXHhU1GqkMg1ibuYBtSfZxHW8mtjdMhrdZKZDzCW1Mp+NlBWHMBC2nRxxkOu9NAPpPz0s2ZREcNIuUPsuFV1hIrb827UpUSNTyNgjhRo2B1DnLq0nkaqNHLUhJuTUKQlTuLbAJJsVeMnakH+SEIBuW52oVRCITmzYzGv4K2SCJLoPSHTrQwIdM1AfMD+QuDwQbrSdVKdT2yHe5zMWQ== [email protected]\"],\"shell\":\"/bin/bash\"}]},\"storage\":{},\"systemd\":{}}"
      name:                             "ignition"
      pool:                             "default"

  + libvirt_volume.coreos-qcow2
      id:                               <computed>
      format:                           "qcow2"
      name:                             "coreos-qcow2"
      pool:                             "default"
      size:                             <computed>
      source:                           "http://localhost/coreos_production_qemu_image.img"


Plan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

libvirt_ignition.ignition: Creating...
  content: "" => "{\"ignition\":{\"config\":{},\"timeouts\":{},\"version\":\"2.1.0\"},\"networkd\":{},\"passwd\":{\"users\":[{\"homeDir\":\"/home/raju/\",\"name\":\"raju\",\"sshAuthorizedKeys\":[\"sshkey\"],\"shell\":\"/bin/bash\"}]},\"storage\":{},\"systemd\":{}}"
  name:    "" => "ignition"
  pool:    "" => "default"
libvirt_volume.coreos-qcow2: Creating...
  format: "" => "qcow2"
  name:   "" => "coreos-qcow2"
  pool:   "" => "default"
  size:   "" => "<computed>"
  source: "" => "http://localhost/coreos_production_qemu_image.img"

Error: Error applying plan:

2 error(s) occurred:

* libvirt_ignition.ignition: 1 error(s) occurred:

* libvirt_ignition.ignition: can't find storage pool 'default'
* libvirt_volume.coreos-qcow2: 1 error(s) occurred:

* libvirt_volume.coreos-qcow2: can't find storage pool 'default'

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
@rajugupta15
Copy link
Author

My bad. default pool was not there. created and it worked
simon3z/virt-deploy#8 (comment)

@Dr4s1l
Copy link

Dr4s1l commented Feb 24, 2021

Still got this issue even if the pool exist, also recreate it on different path still got issue

Host Config:

Fedora 31

Terraform Version Report
(0.14)

Libvirt version
5.6.0

terraform-provider-libvirt plugin version (stable binary)

Setup

#
# worker nodes
#

resource "libvirt_volume" "worker_image" {
  count  = local.workers
  name   = "worker-${count.index + 1}"
  pool   = "default"
  source = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
  format = "qcow2"
}

resource "libvirt_volume" "worker" {
  count          = local.workers
  name           = "volume-${count.index + 1}"
  base_volume_id = element(libvirt_volume.worker_image.*.id, count.index)
  size           = var.worker_root_size
}

resource "libvirt_cloudinit_disk" "commoninit" {
  count     = local.workers
  name      = "k8s-worker-${count.index + 1}-commoninit.iso"
  pool      = "default"
  user_data = element(data.template_file.user_data.*.rendered, count.index + 1)
}


data "template_file" "user_data" {
  count    = local.workers
  template = file("${path.module}/kubernetes_cloudinit.cfg")
  vars = {
    hostname    = "k8s-worker${count.index + 1}"
    public_key  = var.public_key
    k8s_version = var.k8s_version
    k8s_minor   = var.k8s_minor
  }
}


resource "libvirt_domain" "worker" {
  count  = local.workers
  name   = "k8s-worker${count.index + 1}"
  memory = var.worker_mem
  vcpu   = var.worker_cpu

  disk {
    volume_id = element(libvirt_volume.worker.*.id, count.index + 1)
  }

  network_interface {
    network_name = "default"
  }

  cloudinit = element(libvirt_cloudinit_disk.commoninit.*.id, count.index + 1)

  console {
    type        = "pty"
    target_port = "0"
    target_type = "serial"
  }

  graphics {
    type        = "spice"
    listen_type = "address"
    autoport    = "true"
  }

  autostart = var.enable_autostart
}

terraform {
  required_version = ">= 0.14"
}

Also :

 Nom       État    Démarrage automatique
------------------------------------------
 default   actif   yes

And the provider declaration :

terraform {
  required_providers {
    libvirt = {
      # According to new terraform 0.13 hacky plugin path
      source  = "hashicorp/libvirt"
      version = "1.0.0"
    }
  }
}

provider "libvirt" {
  uri = "qemu:///system"
}

Current behavior :

module.k8s.libvirt_volume.worker_image[1]: Creating...
module.k8s.libvirt_cloudinit_disk.commoninit[1]: Creating...
module.k8s.libvirt_volume.worker_image[0]: Creating...
module.k8s.libvirt_cloudinit_disk.commoninit[0]: Creating...

Error: can't find storage pool 'default'

  on k8s/main.tf line 5, in resource "libvirt_volume" "worker_image":
   5: resource "libvirt_volume" "worker_image" {



Error: can't find storage pool 'default'

  on k8s/main.tf line 5, in resource "libvirt_volume" "worker_image":
   5: resource "libvirt_volume" "worker_image" {



Error: can't find storage pool 'default'

  on k8s/main.tf line 20, in resource "libvirt_cloudinit_disk" "commoninit":
  20: resource "libvirt_cloudinit_disk" "commoninit" {



Error: can't find storage pool 'default'

  on k8s/main.tf line 20, in resource "libvirt_cloudinit_disk" "commoninit":
  20: resource "libvirt_cloudinit_disk" "commoninit" {

Expected behavior

Access the default storage pool using terraform libvirt provider

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

No branches or pull requests

2 participants