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

volatile disk issue: missing FS information #430

Closed ombarek closed 1 year ago

ombarek commented 1 year ago

Community Note

Terraform Version

Terraform v1.4.4 on linux_amd64

Affected Resource(s)

openbebula_virtual_machine disk section

Terraform Configuration Files

disk { target = "sda" size = 100000 volatile_format = "raw" volatile_type = "fs" }

Expected Behavior

Mounting the volatile disk

Actual Behavior

After creation, the volatie disk is impossible to mount. with this message : wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.

After investigation, it seems that the FS option is important for volatile disk (ceph datastore) VM template extract : DISK = [ ALLOW_ORPHANS = "mixed", ... CEPH_USER = "libvirt", CLUSTER_ID = "0", DATASTORE = "ceph-rbdone-system", DATASTORE_ID = "101", DEV_PREFIX = "sd", DISK_ID = "3", DISK_TYPE = "RBD", DRIVER = "raw", FORMAT = "raw", FS = "ext4", <==== IMPORTANT INFORMATION POOL_NAME = "one-rbd", SIZE = "102400", TARGET = "sdb", TM_MAD = "ceph", TM_MAD_SYSTEM = "ceph", TYPE = "fs" ]

Without this information, the disk is not recognize correctly in the vm.

Same behavior if you create a attach disk without this information with the sunstone UI.

Please add this feature int disk part.

Best regards

treywelsh commented 1 year ago

If I understand right, you want to add an fs attribute to the disk section of virtual_machine resource. Is there a need to add it in the disk section of the template resource ?

Infortunately I don't find any related information in OpenNebula documentation and I don't have any Ceph datastore to test it.

For now I only found a commit that seems to introduce FS in OpenNebula core but it requires some efforts to understand: https://github.com/OpenNebula/one/commit/95a7a4ede57aced162344b19a30cacdbb6d83ca9

I should be able to add the FS attribute but If I do this I won't be able to really test it

ombarek commented 1 year ago

Thanks for your reply.

In Opennebula (ONE) 6.6.0 Sunstone UI, when you want to add a volatile disk, you need to enter 4 parameters (Size; Disk Type: FS/SWAP; Filesystem: ext4/ext3/ext2/xfs/- ; Format : raw/qcow2).

During my test to understand my issue, I've seen if I don't indicate the Filesystem, the volatile disk created has the same issue. This parameter seems important.

May be is a new feature of the 6.6 version. In the link you gave, FS should replace FSTYPE ("FSTYPE is deprecated and no longer used, FS new attribute to specify file system FS.").

I can indicate this parameter in the VM Template, but the vm instance, created with terraform, overrides all information and doesn't use it. Placing a volatile disk information into the template has no influence.

Extract of the vm template script (I didn't use terraform for this vm template).

DISK = [
  DEV_PREFIX = "vd",
  FORMAT = "raw",
  FS = "ext4",
  READONLY = "no",
  SIZE = "102400",
  TARGET = "vdb",
  TYPE = "fs" ]

Our project is to evaluate OpenNebula to replace an on premise OpenStack. ONE seems to be a good candidate. I'm trying to translate a Kubernetes cluster creation terraform script that I use in OpenStack into ONE (NB: START_SCRIPT_BASE64 is a real good alternative to USERDATA that I use for OS).

We have 4 evaluation servers (included one with GPU) used for a Ceph cluster and ONE Cluster. We are a French University IT Research Lab. We can proceed to some test if you want.

regards,

ombarek commented 1 year ago

I've succeeded to resolve manually this issue. I've tried to add "mkfs -t ext4 /dev/vdb" in START_SCRIPT and it resolved the problem. I can continue my other test.

Add FS should be a better solution for the future.

Thanks