theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
106 stars 31 forks source link

mount points configured, but 'rootfs' not set #173

Closed thorpj closed 3 years ago

thorpj commented 3 years ago

Hi, really loving this plugin, thank you. I'll write a PR if I can, but at this stage I've spent some time trying to understand how this works to fix this bug, and I'm not having much luck. Any advice would be greatly appreciated.

Describe the bug Unable to create a container.

Failed to create a compute HV01 (Proxmox) instance patti-kawski.REDACTED_DOMAIN: Expected([200]) <=> Actual(500 InternalServerError) excon.error.response :body => "{\"data\":null}" :cookies => [ ] :headers => { "Cache-Control" => "max-age=0" "Connection" => "close" "Content-Length" => "13" "Content-Type" => "application/json;charset=UTF-8" "Date" => "Sun, 04 Oct 2020 07:03:17 GMT" "Expires" => "Sun, 04 Oct 2020 07:03:17 GMT" "Pragma" => "no-cache" "Server" => "pve-api-daemon/3.0" } :host => "hv01.REDACTED_DOMAIN" :local_address => "10.0.0.4" :local_port => 49652 :path => "/api2/json/nodes/HV01/lxc" :port => 8006 :reason_phrase => "mount points configured, but 'rootfs' not set - aborting" :remote_ip => "10.0.0.5" :status => 500 :status_line => "HTTP/1.1 500 mount points configured, but 'rootfs' not set - aborting\r\n"

image

To Reproduce Steps to reproduce the behavior:

  1. Create host image image image

Expected behavior A container is created in Proxmox, and the Foreman page does not show an error

Desktop (please complete the following information): Server info:

Proxmox: 6.2-6 Foreman: 2.1.3 foreman_fog_proxmox: 0.12.4 Ubuntu Server 18.04.5

Additional context Add any other context about the problem here.

Storage configuration is based on examples from here

Here's the config of the container Foreman tried to create:

vmid="100", description=nil, ostype="ubuntu", smbios1=nil, bios=nil, numa=nil, kvm=nil, vcpus=nil, cores=2, bootdisk=nil, onboot="1", boot=nil, agent=nil, scsihw=nil, sockets=nil, memory=2147483648, shares=nil, balloon=nil, name=nil, cpu=nil, cpulimit=nil, cpuunits=nil, keyboard=nil, vga=nil, storage=nil, template=nil, arch="amd64", swap=nil, hostname=nil, nameserver="10.0.0.10", searchdomain="REDACTED_DOMAIN", password=nil, startup=nil, console=nil, cmode=nil, tty=nil, force=nil, lock=nil, pool="servers", bwlimit=nil, unprivileged=nil, interfaces= <Fog::Proxmox::Compute::Interfaces [

  ]
>,
disks=    <Fog::Proxmox::Compute::Disks
  [
                    <Fog::Proxmox::Compute::Disk
      id="mp0",
      volid=nil,
      size=32212254720,
      storage="ssd-lvmthin-02",
      cache=nil,
      replicate=nil,
      media=nil,
      format=nil,
      model=nil,
      shared=nil,
      snapshot=nil,
      backup=nil,
      aio=nil,
      mp="/opt/test"
    >
  ]
>

I have tried variations of the path and device settings in foreman:

In addition to the usual Google searches, i have tried searching:

Foreman can communicate with Proxmox, screenshot from the VIrtual Machines page: image

tristanrobert commented 3 years ago

Your container requires a rootfs volume. And I don't see any in your mount points screenshot forms.

thorpj commented 3 years ago

Interesting, here's what I found. The rootfs option was not showing up for me, which is why I was creating a mount point, figuring that the wording was just awkward, and it wasn't actually referring to a mount point.

If I remove the Roofts, then click "Add Volume", it adds a Mount Point, instead of a rootfs. This means once you remove the rootfs, you need to delete the Compute Profile in order to get a rootfs again. The same thing happens if you create a host withoout applying a Compute Profile, and then delete the rootfs and click "Add Volume".

From a cursory glance, the culrpit appears to be this

Perhaps two buttons giving the option of adding a mount point or a rootfs (and disabling the add rootfs button if one is already added).

I can probably make a PR if that's the case.

tristanrobert commented 3 years ago

Yes if you remove rootfs (volume with id=rootfs) you can't add it later. It is because the Add volume button adds only mount points i=mp[n] with n integer. You should not remove rootfs because it is required.

thorpj commented 3 years ago

Yes if you remove rootfs (volume with id=rootfs) you can't add it later. It is because the Add volume button adds only mount points i=mp[n] with n integer. You should not remove rootfs because it is required.

I see. Would you like me to submit a PR preventing the rootfs device from being removed, or adding a note in the documentation?

tristanrobert commented 3 years ago

Your contributions are welcome @thorpj ! Preventing rootfs from being remove should be the best indeed.