OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
63 stars 52 forks source link

virtual machine (ID: 14): unexpected state 'POWEROFF', wanted target 'RUNNING'. last error: %!s(<nil>) #533

Open zixelmike opened 6 months ago

zixelmike commented 6 months ago

Description

Hello, I try to create VM and run it. But it`s not runing after deploy. Opennebula 6.0.0.2

Terraform and Provider version

provider registry.terraform.io/opennebula/opennebula v1.4.0

Affected resources and data sources

resources network, image, template and VM

Terraform configuration

resource "opennebula_image" "Linux" {
  name = "Linux-1.7.2"
  description = "Linux 1.7.2 Image"
  datastore_id = "1"
  persistent = true
  dev_prefix = "vd"
  driver = "qcow2"
  permissions = "640"
  path = "http://boot.xxxxx.com/linux-nogui15"
  type = "OS"
   timeouts {
     create = "2h"
   }
}

resource "opennebula_virtual_network" "br0" {
  name         = "br0"
  type         = "bridge"
  bridge       = "br0"
  physical_device = "eth0"
  permissions  = "640"
  mtu          = 1500
  gateway      = "10.3.35.254"
  dns          = "8.8.8.8"
  network_mask = "255.255.255.0"
}

resource "opennebula_virtual_network_address_range" "br0range" {
  virtual_network_id = opennebula_virtual_network.br0.id
  ar_type            = "IP4"
  size               = 20
  ip4                = "10.3.35.80"
}

resource "opennebula_template" "desk" {
  name        = "Desk"
  description = "VM template for desk"
  cpu         = 2
  vcpu        = 4
  memory      = 4096
  permissions = "640"

  context = {
    NETWORK      = "YES"
    HOSTNAME     = "$NAME"
    SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]"
  }

  graphics {
    type   = "VNC"
    listen = "0.0.0.0"
  }

  os {
    arch = "x86_64"
    boot = "disk0"
  }

  features {
    guest_agent = "YES"
    acpi = "YES"
  }

  disk {
    image_id = opennebula_image.Linux.id
    #size     = 15000
    target   = "vda"
    driver   = "qcow2"
  }

  nic {
    network_id      = opennebula_virtual_network.br0.id
    model           = "virtio"
  }

}

resource "opennebula_virtual_machine" "desk" {
  #count = 2

  name        = "Ddesk"
  description = "VM For Desk"
  cpu         = 2
  vcpu        = 4
  memory      = 4096
  permissions = "640"
  template_id = opennebula_template.desk.id

  nic {
    model           = "virtio"
    network_id      = opennebula_virtual_network.br0.id
    ip = "10.3.35.80"
  }
}

Expected behavior

Waiting RUNING state

Actual behavior

│ Error: Failed to wait virtual machine to be in RUNNING state │ │ with opennebula_virtual_machine.desk, │ on default.tf line 101, in resource "opennebula_virtual_machine" "desk": │ 101: resource "opennebula_virtual_machine" "desk" { │ │ virtual machine (ID: 14): unexpected state 'POWEROFF', wanted target 'RUNNING'. last error: %!s()

Steps to Reproduce

terraform plan terraform apply

Debug output

No response

Panic output

No response

Important factoids

No response

References

No response

zixelmike commented 6 months ago

I added tags, it runs =) tags = { AUTOSTARTVM = "1" SERVICEUSERVM = "1" }

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.