Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Newly created VM stays as a template #28

Open
zzzuzik opened this issue Mar 3, 2018 · 9 comments
Open

Newly created VM stays as a template #28

zzzuzik opened this issue Mar 3, 2018 · 9 comments

Comments

@zzzuzik
Copy link

zzzuzik commented Mar 3, 2018

Hi @ringods and @mborodin
thank you for working on this gem.

My TF is failing (minimized example version) to actually start VM, just template is created.
No error in after applying, just "1 added"
The trace shows this:

[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 Consumed total  1  bytes to generate hash
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 String for hash:  0
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [DEBUG] Query VBD
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [DEBUG] Creating  1  VBDS of type  Disk
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [DEBUG] Got 2 VDIs
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [DEBUG] Query VBD
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [ERROR]  API Error: HANDLE_INVALID VDI OpaqueRef:NULL
[DEBUG] plugin.terraform-provider-xenserver.exe: 2018/03/02 18:37:35 [ERROR]  <nil>

Could you please point me to where should I dig further.

TF.11.03
XS: 7.1ECU1
The base template is healthy, has 1 disk. I can spin up VMs from it within 3 seconds

@joncave
Copy link
Contributor

joncave commented Mar 3, 2018

I believe that I may have encountered this issue at one point, but I cannot remember what I did to fix it! What version of the provider are you using and can you paste a copy of the Terraform configuration, please?

@zzzuzik
Copy link
Author

zzzuzik commented Mar 3, 2018

I pulled the master go get github.com/ringods/terraform-provider-xenserver
the TF is quiet simple.
provider:

provider "xenserver" {
  url = "https://xxxx"
  username = "xxxx"
  password = "xxx"
}

vm:

resource "xenserver_vm" "test" {
    base_template_name = "my_template_on_xen"
    name_label = "new_vm"
    # 8G
    static_mem_min = 8589934592
    static_mem_max = 8589934592
    dynamic_mem_min = 8589934592
    dynamic_mem_max = 8589934592
    vcpus = 4
    boot_order = "cdn"

    hard_drive {
        is_from_template = true
        user_device = "0"
    }

    cdrom {
        is_from_template = true
        user_device = "1" #also tried with 3
    }

    network_interface {
        network_uuid = "7254fcf8-b982-41ea-aab2-455fee47308b"
        device = 0
        mtu = 1500
        mac = ""
        other_config {
            ethtool-gso = "off"
            ethtool-ufo = "off"
            ethtool-tso = "off"
            ethtool-sg = "off"
            ethtool-tx = "off"
            ethtool-rx = "off"
        }
    }
}

@chafey
Copy link

chafey commented Mar 3, 2018

I am having the same problem with xen server 7.3. I am pretty sure it started creating VM's at one point, but now it seems stuck just creating templates

@KristoferGrahn
Copy link

Same issue here on 7.2.

@zzzuzik
Copy link
Author

zzzuzik commented Mar 6, 2018

to fix my problem:
API Error: HANDLE_INVALID VDI OpaqueRef:NULL
the base template CD-ROM HAS to have guest_tool.iso in it AND the TF should look like this:

cdrom {
        is_from_template = true
        user_device = "2"  # notice 2
    }

@chafey
Copy link

chafey commented Mar 9, 2018

zzzuzik - I updated my template to have guest_tool.iso in it and it worked, but I had to leave user_device="3". Thanks for the tip!

@warmfusion
Copy link

How are you finding the guest_tool.iso; can you show me a working version to built and boot a VM?

@BlaqDekko
Copy link

warmfusion - guest_tool.iso is included in xenserver. What I did was this:

  • Create a VM that had everything I wanted in it
  • Attach the guest_tool.iso to the cdrom
  • Convert the VM to a template

Then I used this code with my new template name and everything ran:

provider "xenserver" {
  url = "https://<server-address>"
  username = "root"
  password = "<xenserver-password>"
}

resource "xenserver_vm" "ubuntu" {
  base_template_name = "Ubuntu 16.04 New Template"
  name_label = "ubuntu_new_terraform"
  static_mem_min = 8589934592
  static_mem_max = 8589934592
  dynamic_mem_min = 8589934592
  dynamic_mem_max = 8589934592
  vcpus = 1
  boot_order = "c"

  hard_drive {
    is_from_template = true
    user_device = "0"
  }

  cdrom {
    is_from_template = true
    user_device = "3"
  }

  network_interface {
    network_uuid = "<Your Network UUID>"
    device = "0"
    mtu = 1500
    mac = ""
    other_config {
      ethtool-gso = "off"
      ethtool-ufo = "off"
      ethtool-tso = "off"
      ethtool-sg = "off"
      ethtool-tx = "off"
      ethtool-rx = "off"
    }
  }
}

@grant-veepshosting
Copy link

We're also experiencing this issue on the latest XCP-ng hosts which is a XenServer 7x fork. Has anyone figured out the root cause yet, or proposed a workaround?

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

No branches or pull requests

7 participants