Updating library_contents on exit - enhancement?

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Updating library_contents on exit - enhancement?

Supra James
Is it possible to have mhvtl update library_contents.x dynamically to make the library more persistent?

For example, I used mktape then used vtlcmd to inject it into the map, and netbackup picked it up and moved it to an empty slot. All good except next time I start mhvtl my tape is outside the library again.
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

salvus
Funny, I was actually thinking pretty much the same last night when I was sitting learning about mhvtl.

I can see some people not wanting this in certain situations so making it an option would be preffered.
Maybe adding an option in device.conf so it can be adjusted for different libraries.

Also modifying vtlcmd in similar fashion might be useful?
vtlcmd 10 save librarycontents [force]

force to force save contents if device.conf says library not to save on exit
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
To date, this has been deliberate (i.e. by design) as the primary
focus of this vtl has been to assist with supporting NetBackup.
Hence after testing/re-producing a customer's issue, it is nice to
re-start everything and have it all come back to default.
It also reproduces the "what if the customer changes the library
configuration without telling the backup software" scenario.

I'm more than willing to accept a patch which optionally re-writes the
library_contents.XX on exit.
It is something I plan on adding when I finally get around to the xml
config file format. But that won't be in the foreseeable future.

An entry in device.conf like
PERSISTENT: yes | no

So if the "PERSISTENT: yes" will re-write the config file, where
"PERSISTENT: no" will keep current behaviour.

Cheers
Mark

On Thu, Apr 14, 2011 at 8:50 PM, salvus [via MHVTL - Linux Virtual
Tape Library - Community Forums]
<[hidden email]> wrote:

> Funny, I was actually thinking pretty much the same last night when I was
> sitting learning about mhvtl.
>
> I can see some people not wanting this in certain situations so making it an
> option would be preffered.
> Maybe adding an option in device.conf so it can be adjusted for different
> libraries.
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://mhvtl-linux-virtual-tape-library-community-forums.966029.n3.nabble.com/Updating-library-contents-on-exit-enhancement-tp2819843p2819866.html
> To start a new topic under MHVTL - Linux Virtual Tape Library - Community
> Forums, email [hidden email]
> To unsubscribe from MHVTL - Linux Virtual Tape Library - Community Forums,
> click here.
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

golem
Useful thing. Thanks!

Can you tell me - was this enhancement implemented?
Or in plans?

Seriously lacking in this
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator

Not implemented at this point..

I'd actually forgotten all about this feature request..

I'll look at this again over the next couple of days... No promises..
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
Well - that wasn't hard :)

Any chance of testing this patch (on top of current github source)..

persistent_library.diff

This patch adds the following functionality.
- On startup - check for /etc/mhvtl/library_contents.XX.persist file
  If it does not exist - read /etc/mhvtl/library_contents.XX (2nd bit is as per current behaviour)
- On shutdown - dump current config to /etc/mhvtl/library_contents.XX.persist

As always - comments / testing welcome..

Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
One more thing..

To enable the new behaviour - you will need to update your Library: xx setting in device.conf

e.g. -> Note the new entry PERSIST:
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
 Vendor identification: ADIC
 Product identification: Scalar i500
 Unit serial number: A0C0045421_LLB
 Product revision level: 621G
 NAA: 00:00:00:00:00:00:00:00
 PERSIST: yes

Will accept either 'yes' or 'true'. Anything else results is a false setting.
Regards from Australia
Mark Harvey
nia
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

nia
Administrator
In reply to this post by Mark Harvey
*** Error ***

patching file man/device.conf.5
patching file usr/vtllib.h
patching file usr/vtllibrary.c
Hunk #5 FAILED at 1773.
1 out of 5 hunks FAILED -- saving rejects to file usr/vtllibrary.c.rej
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
Strange.. Can you try this one.

persistent_library-1.diff
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
In reply to this post by nia
Any chance of cat usr/vtllibrary.c.rej

and pasting the contents here.

Many thanks
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

golem
In reply to this post by Mark Harvey
Mark Harvey wrote
Any chance of testing this patch (on top of current github source)..

persistent_library.diff
Maybe I'm wrong but it seems to me that this patch doesn't suit current github source from here  https://github.com/markh794/mhvtl/blob/master

[user@gate mhvtl-master]$ cat persistent_library.diff | patch -p1
patching file man/device.conf.5
patching file usr/vtllib.h
patching file usr/vtllibrary.c
Hunk #5 FAILED at 1773.
1 out of 5 hunks FAILED -- saving rejects to file usr/vtllibrary.c.rej

Than I correct file usr/vtllibrary.c

I run mhvtl daemon with the patch. Than I've stopped the daemon - file library-contents.10.persist was created but it was completely empty.


What sources code I must patch?

P.S.
I am  not alone ))
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

golem
In reply to this post by Mark Harvey
cat usr/vtllibrary.c.rej

***************
*** 1712,1717 ****
                }
        }
  exit:
        cleanup_lu(&lunit);
        ioctl(cdev, VTL_REMOVE_LU, &ctl);
        close(cdev);
--- 1773,1780 ----
                }
        }
  exit:
+       if (lunit.persist)
+               save_config(&lunit);
        cleanup_lu(&lunit);
        ioctl(cdev, VTL_REMOVE_LU, &ctl);
        close(cdev);
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
In reply to this post by golem
OK - let me try again..

As they say - 3rd time lucky


On Thu, Oct 3, 2013 at 4:52 PM, golem [via mhVTL - A Linux Virtual Tape Library] <[hidden email]> wrote:
Mark Harvey wrote
Any chance of testing this patch (on top of current github source)..

persistent_library.diff
Maybe I'm wrong but it seems to me that this patch doesn't suit current github source from here  https://github.com/markh794/mhvtl/blob/master

[user@gate mhvtl-master]$ cat persistent_library.diff | patch -p1
patching file man/device.conf.5
patching file usr/vtllib.h
patching file usr/vtllibrary.c
Hunk #5 FAILED at 1773.
1 out of 5 hunks FAILED -- saving rejects to file usr/vtllibrary.c.rej

Than I correct file usr/vtllibrary.c

I run mhvtl daemon with the patch. Than I've stopped the daemon - file library-contents.10.persist was created but it was completely empty.


What sources code I must patch?

P.S.
I am  not alone ))



To start a new topic under mhVTL - A Linux Virtual Tape Library, email [hidden email]
To unsubscribe from mhVTL - A Linux Virtual Tape Library, click here.
NAML

Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
In reply to this post by golem
OK - the previous patch (persistent_library-1.diff) should be good..

I attempted to 'cheat' and combine the persistent library patch into one combined patch.. I forgot to roll up one patch into the original 'persistent_library.diff' - not directly related to persistent library patch but is in the code path..

FWIW: The three patches to get from github head to this is:
0001-vtllibrary-call-cleanup_lu-on-exit.patch (the missing one from original patch)
0002-Update-man-page-for-PERSIST-setting-in-device.conf.patch
0003-Save-library-config-on-shutdown.patch

So you have three options:
1. Apply patch 0001-vtllibrary-call-cleanup.... patch in this posting and the apply the persistent_library.diff first posted.
2. Apply persistent_library-1.diff posted earlier
3. Apply the three git-formatted patches in this posting..

Apologies for such a botch job of supplying a patch..
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
In reply to this post by golem
golem wrote
I run mhvtl daemon with the patch. Than I've stopped the daemon - file library-contents.10.persist was created but it was completely empty.
Please make sure you manually remove library_contents.10.persist before restarting mhVTL - otherwise it will attempt to read zero data from this blank file.. Obviously, then if you exit, it will resave 'blank' amount of data..

Removing the .persist file(s) will force the next load to read library_contents.XX
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

golem
In reply to this post by Mark Harvey
Now it works as  expected with persistent_library-1.diff . Thanks.
I'll continue to test...
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
One hurdle passed - thanks for the update.
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
In reply to this post by golem
Another patch - on top of persistent_library-1.diff

This adds/changes the following behaviour:
- Don't read (or update on exit) library_contents.<id>.persist if "PERSIST: " is false in device.conf
- Read library_contents.<id> if it has a newer modify date to library_contents.<id>.persist

0004-Don-t-read-library_contents.-id-.persist-if-disabled.patch

Regards from Australia
Mark Harvey
nia
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

nia
Administrator
Mark,

Volumes mounted on drives during mhvtl restart do not come back to their original slots or drives.

-nia
Reply | Threaded
Open this post in threaded view
|

Re: Updating library_contents on exit - enhancement?

Mark Harvey
Administrator
Media in drives should go back to slots they came from. 

I'll need to check out this case.

Thanks for the update

Sent from my iPhone

On 4 Oct 2013, at 12:05, "nia [via mhVTL - A Linux Virtual Tape Library]" <[hidden email]> wrote:

Mark,

Volumes mounted on drives during mhvtl restart do not come back to their original slots or drives.

-nia


To start a new topic under mhVTL - A Linux Virtual Tape Library, email [hidden email]
To unsubscribe from mhVTL - A Linux Virtual Tape Library, click here.
NAML
Regards from Australia
Mark Harvey
12