OpenNebula / docker-machine-opennebula

Docker Machine Plugin for OpenNebula
Apache License 2.0
22 stars 20 forks source link

adding volatile disk in 5.2+ #13

Open FlorianHeigl opened 6 years ago

FlorianHeigl commented 6 years ago

Hi,

I had a weird issue in the UI, it was no longer possible to create a volatile disk because now there's a fancy dialog that didn't have the drop down anymore. raw data like this:

DISK = [
  CACHE = "unsafe",
  FORMAT = "ext4",
  SIZE = "10240",
  TYPE = "fs" ]

Something is changed in the UI I think. I checked with Carlo and it seems to be an upstream change. Please check it is still possible to add a ext4 volatile disk...

jmelis commented 6 years ago

No, it's not currently possible anymore to add an ext4 formatted disk in OpenNebula.

What is the use case of that with the docker-machine-opennebula plugin?

FlorianHeigl commented 6 years ago

ahem I think it's a regression then? :-) The use case is simple, automatically attaching volatile disks, they're used for /var/lib/docker (i think the mountpoint is different)

jmelis commented 6 years ago

As far as I can tell, there is no way to attach new devices through docker machine, right?

$ docker-machine help  
[...]
Commands:
active      Print which machine is active
config      Print the connection config for machine
create      Create a machine
env         Display the commands to set up the environment for the Docker client
inspect     Inspect information about a machine
ip          Get the IP address of a machine
kill            Kill a machine
ls          List machines
provision       Re-provision existing machines
regenerate-certs    Regenerate TLS Certificates for a machine
restart     Restart a machine
rm          Remove a machine
ssh         Log into or run a command on a machine with SSH.
scp         Copy files between machines
mount           Mount or unmount a directory from a machine with SSHFS.
start           Start a machine
status      Get the status of a machine
stop            Stop a machine
upgrade     Upgrade a machine to the latest version of Docker
url         Get the URL of a machine
version     Show the Docker Machine version or a machine docker version
help            Shows a list of commands or help for one command

When you create a new docker-machine, with the --opennebula-b2d-size <size> flag, it will create a new volatile disk with RAW format.

DISK = [
    SIZE = "<size>",
    TYPE = "fs",
    FORMAT = "raw"
]

Boot2Docker-one is available to detect it and use it as the storage for the dockers.

So, I'm still unsure what the use case is, in the context of this project, for attaching new volatile disks with ext4 formatting.

FlorianHeigl commented 6 years ago

Hi,

Am 24.01.2018 um 11:52 schrieb Jaime Melis notifications@github.com:

As far as I can tell, there is no way to attach new devices through docker machine, right?

you'll need to compare the documentation for this driver plugin instead, not the docker-machine one. By default, you get about 700MB of data space with the docker-machine VM from the marketplace. That means, if you don't just start a idle container, you will run out of space and all your data goes to trash.

You can pass options to attach a disk at runtime, if you are not using a template. That uses a volatile disk. The commands for that are fragile though and it is not a useful use case to not work with templates. (the default in much of the docs, but if one really uses the driver, it is a bad choice to go this way)

The second path is if you start with a template, and have a volatile disk defined for it. Like in the above case it'll be automatically used. That is a feature of the driver (just like volatile disks are a feature of OpenNebula... or used to be?)

With this config I can just do docker-machine create -d opennebula --opennebula-template-id 12 --opennebula-network-id 13 smac2

and bring up 10 of them, each new gives new storage and I don't need to pass any config extra config. (network is just because I had a different one for that test)

Hope that helps Flo

jmelis commented 6 years ago

You can pass options to attach a disk at runtime, if you are not using a template

How? (Thanks for bearing with me!)

docker-machine create -d opennebula --opennebula-template-id 12 --opennebula-network-id 13 smac2

With the current driver you can, I believe? As long as you have the following in your template it should work, right?

DISK = [
    SIZE = "<size>",
    TYPE = "fs",
    FORMAT = "raw"
]
FlorianHeigl commented 6 years ago

Hi,

The trick for version 1 is to pass --opennebula-b2d-size (it DOES NOT work with --opennebula-template-id(or -name) only with --opennebula-image-id (or -name)

yes, with the current driver you can do this. The problem in conjunction with having a volatile disk on the template is just that you can no longer add the volatile disk via UI. If you ever update the template (i.e. to change memory or add some cpu flag, etc), it's again lost. you then again need to onetemplate update and add that bit, again. I think format raw is wrong, I it needs format = ext4 (as above) or it would not be able to mount.

axs-gentoo commented 6 years ago

If I'm understanding what I've read above correctly, the issue you had with adding volatile disk to a boot2docker template via the UI is a bug in OpenNebula, which was fixed somewhere between 5.4.7 and 5.4.12. If you can ensure you have the 5.4.12 hotfix installed then it'll work as expected. AFAIK you can't (or rather, probably can but it won't be used) add additional volatile disk to a running boot2docker VM, it's got to be done upon (version 1) or prior to (version 2) docker-machine create.

FlorianHeigl commented 6 years ago

@axs-gentoo Thank you! I'll try to get the hotfix added! That is the real issue then I think.