kubic-project / kubic-terraform-kvm

Kubic Terraform script using KVM/libvirt
Apache License 2.0
31 stars 10 forks source link

Can't find storage pool 'default' #15

Open vadorovsky opened 5 years ago

vadorovsky commented 5 years ago

When you run on the fresh machine, you might see the following error:

libvirt_volume.data_volume[2]: Creating...
libvirt_volume.data_volume[1]: Creating...
libvirt_volume.data_volume[0]: Creating...
libvirt_cloudinit_disk.commoninit[1]: Creating...
libvirt_volume.kubic_image: Creating...
libvirt_cloudinit_disk.commoninit[0]: Creating...
libvirt_cloudinit_disk.commoninit[2]: Creating...

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 5, in resource "libvirt_volume" "kubic_image":
   5: resource "libvirt_volume" "kubic_image" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 16, in resource "libvirt_volume" "data_volume":
  16: resource "libvirt_volume" "data_volume" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 16, in resource "libvirt_volume" "data_volume":
  16: resource "libvirt_volume" "data_volume" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 16, in resource "libvirt_volume" "data_volume":
  16: resource "libvirt_volume" "data_volume" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 33, in resource "libvirt_cloudinit_disk" "commoninit":
  33: resource "libvirt_cloudinit_disk" "commoninit" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 33, in resource "libvirt_cloudinit_disk" "commoninit":
  33: resource "libvirt_cloudinit_disk" "commoninit" {

Error: can't find storage pool 'default'

  on kubic-kvm.tf line 33, in resource "libvirt_cloudinit_disk" "commoninit":
  33: resource "libvirt_cloudinit_disk" "commoninit" {

The fix is to run virt-manager which creates the default storage pool (and also the default network, which could be an another potential error). It would be nice to somehow handle the case if someone is not running virt-manager.

vadorovsky commented 5 years ago

Oh, actually you might see also the error about the default network being not active if you don't activate it before:

Error: Error creating libvirt domain: virError(Code=55, Domain=19, Message='Requested operation is not valid: network 'default' is not active')

  on kubic-kvm.tf line 40, in resource "libvirt_domain" "kubic-domain":
  40: resource "libvirt_domain" "kubic-domain" {

Error: Error creating libvirt domain: virError(Code=55, Domain=19, Message='Requested operation is not valid: network 'default' is not active')

  on kubic-kvm.tf line 40, in resource "libvirt_domain" "kubic-domain":
  40: resource "libvirt_domain" "kubic-domain" {

Error: Error creating libvirt domain: virError(Code=55, Domain=19, Message='Requested operation is not valid: network 'default' is not active')

  on kubic-kvm.tf line 40, in resource "libvirt_domain" "kubic-domain":
  40: resource "libvirt_domain" "kubic-domain" {
sebastian-philipp commented 5 years ago

Hm, wondering if we really should fix this ourselves. sounds like a general thing with the libvirt provider?

vadorovsky commented 5 years ago

Yes, you are right. We probably should handle that in terraform-provider-libvirt.

zeenix commented 5 years ago

Just FYI, you should not assume the existence of default storage pool. It's not created by libvirt itself and hence not guaranteed to exist. Best is to create your own storage pool and terraform-provider-libvirt now a days support creating a pool.