Results 1 to 3 of 3

Thread: Returning PROPERTY values in Script-API plugin

  1. #1

    Default Returning PROPERTY values in Script-API plugin

    I've nearly completed an Amanda Script-API plugin that provides support for LVM snapshots. It successfully creates and mounts a snapshot in the pre-dle-backup phase and un-mounts and removes the snapshot during post-dle-backup. However, I'm not sure of one very important thing: How do I inform the server process of the location of the new mount point?

    The ZFS plugin outputs a line message "PROPERTY directory <directory_value>" that seems to define the path to the ZFS snapshot directory, so I basically copied that same implementation. Though, when I look at the debug logs there's no indication that the path to the mounted snapshot is the one being backed up.

    If anyone could help I'd greatly appreciate it.

    Oh, the plugin is [URL=""]hosted at GitHub[/URL] for anyone who's interested (also, for code reference.)


  2. #2


    I did some digging in the Amanda source and found the problem. According to "client-src/sendbackup.c:main()", only if the dumptype uses an application API program will the PROPERTY values returned from the client script be passed on.

        int		argc,
        char **	argv)
        // ...
        run_client_scripts(EXECUTE_ON_PRE_DLE_BACKUP, g_options, dle, mesgstream);
        if (dle->program_is_application_api==1) {
            // ...
    	    for (scriptlist = dle->scriptlist; scriptlist != NULL;
    		 scriptlist = scriptlist->next) {
    		script = (script_t *)scriptlist->data;
    		if (script->result && script->result->proplist) {
    		    property_add_to_argv(argv_ptr, script->result->proplist);
            // ...
        } else {
            // (invocation without using script properties) ...
        // ...
    Anyway, after changing my dumptype definition to use amgtar—an application-api tool—instead of regular old tar, it works as expected:

    1. The snapshot script is called at "pre-dle-backup".

    1271115451.795632: Amlvm_snapshot: command: pre_dle_backup
    1271115452.187619: Amlvm_snapshot: Resolved device `/dev/lvm-test/vol0' and volume group `lvm-test' from mount point `/mnt/test'.
    1271115452.276424: Amlvm_snapshot: A snapshot of size `6' will be created.
    1271115452.417210: Amlvm_snapshot: Created snapshot of `/dev/lvm-test/vol0' at `/dev/lvm-test/amsnapshot'.
    1271115452.459190: Amlvm_snapshot: Mounted snapshot `/dev/lvm-test/amsnapshot' at `/tmp/TjnvI8b4G6'.
    2. The temporarily mounted snapshot is backed up.

    1271115452.498749: amgtar: Spawning "/bin/tar /bin/tar --create --verbose --file - --directory /tmp/TjnvI8b4G6 --one-file-system --atime-preserve=system --listed-incremental /var/lib/amanda/gnutar-lists/ --sparse --ignore-failed-read --totals ." in pipeline
    1271115452.835517: amgtar:  78:    size(|): Total bytes written: 21524480 (21MiB, 63MiB/s)
    3. The snapshot is unmounted and deleted.

    1271115452.998455: Amlvm_snapshot: script: Amlvm_snapshot
    1271115452.998561: Amlvm_snapshot: command: post_dle_backup
    1271115453.302123: Amlvm_snapshot: Resolved device `/dev/lvm-test/vol0' and volume group `lvm-test' from mount point `/mnt/test'.
    1271115453.350799: Amlvm_snapshot: Un-mounted snapshot device `/dev/lvm-test/amsnapshot' from `/tmp/TjnvI8b4G6'.
    1271115453.521056: Amlvm_snapshot: Removed snapshot of `/dev/lvm-test/vol0'.
    So, after I test this script out a bit more, I suppose I should announce it somewhere...

  3. #3
    Join Date
    Nov 2005


    Passing property from pre-script to application works only with the application-api.
    We could include your script in the distribution if you licenses it from [url][/url]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts