NetApp / netappdvp

A Docker volume plugin for NetApp storage
96 stars 33 forks source link

Allow override of the volume prefix when creating clones #54

Closed synotio closed 7 years ago

synotio commented 7 years ago

Creating an issue here instead of a pull request since I think this should be discussed first.

If you are cloning production volumes into your docker environment but you still want to have some "containment" in case things go wrong (the volume prefix), you either have the choice of writing scripts outside NDVP to talk to the filer to create the clone, or not setting a prefix at all and handle that manually.

The issue with not setting a prefix at all and enabling volume deletion is that it opens a possibility for having bad things happen if you happen to mount a production volume. NDVP will happily discover a current volume and mount it, but it will destroy it upon removal (unless you disable it) and having a prefix makes this a bit less likely to happen.

I made a commit here to demonstrate this. It will allow you to specify fromRaw=true during docker volume create to indicate that the volume being cloned should not carry the prefix. However, it can never remove the source volume (provided it does not carry the prefix of course) since NDVP will not find it.

For example: You have a volume called WebUploadContent that's used for storing uploads in a CMS. If you turn off the prefix, you can mount and destroy this volume using

docker volume create -d netapp --name WebUploadContent docker volume rm WebUploadContent

If you however have a prefix enabled, and you try

docker volume create -d netapp --name WebUploadContent_1 -o from=WebUploadContent

then NDVP will not find it since it will look for netappdvp_WebUploadContent.

If you apply my patch, you can issue

docker volume create -d netapp --name WebUploadContent -o from=WebUploadContent -o fromRaw=true

and it will clone WebUploadContent to netappdvp_WebUploadContent.

Running

docker volume rm WebUploadContent

afterwards will only touch netappdvp_WebUploadContent, not WebUploadContent.

adkerr commented 7 years ago

Fixed in e7e2db5