|
From: <fcr...@us...> - 2012-01-20 12:25:21
|
Revision: 792
http://safekeep.svn.sourceforge.net/safekeep/?rev=792&view=rev
Author: fcrawford
Date: 2012-01-20 12:25:15 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
Allow snapshot tag item to take a comma separated list of tags
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.backup.txt
safekeep/trunk/safekeep
Modified: safekeep/trunk/doc/safekeep.backup.txt
===================================================================
--- safekeep/trunk/doc/safekeep.backup.txt 2012-01-13 11:47:11 UTC (rev 791)
+++ safekeep/trunk/doc/safekeep.backup.txt 2012-01-20 12:25:15 UTC (rev 792)
@@ -249,9 +249,10 @@
Mandatory for a `<snapshot>` element.
/backup/setup/snapshot/@tag::
- A tag to be added to the snapshot, with the `--addtag` argument
- to `lvcreate`. An `@` is automatically added to the generated
- tag.
+ A list of tags to be added to the snapshot, with the `--addtag`
+ argument to `lvcreate`. The @tag entry consists of a `,`
+ separated list of tags.
+ An `@` is automatically added to each generated tag.
Optional for a `<snapshot>` element.
/backup/setup/script/@location::
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2012-01-13 11:47:11 UTC (rev 791)
+++ safekeep/trunk/safekeep 2012-01-20 12:25:15 UTC (rev 792)
@@ -327,8 +327,16 @@
size = snap_el.getAttribute('size')
if not size:
raise ConfigException('Please specify the size for the snapshot')
- tag = snap_el.getAttribute('tag')
- return { 'device' : device, 'size' : size, 'tag' : tag }
+ tags = []
+ tag_el = snap_el.getAttribute('tag')
+ if tag_el:
+ for tag in tag_el.split(','):
+ if tag:
+ if not tag.startswith('@'): tag = '@' + tag.lstrip()
+ tags.append(tag.strip())
+ else:
+ warn('Device: %s: empty tag in taglist: %s' % (device, tag_el))
+ return { 'device' : device, 'size' : size, 'tags' : tags }
def parse_clude(clude_el):
path = clude_el.getAttribute('path')
@@ -690,14 +698,12 @@
if not snapmnt:
warn('Cannot find the mountpoint for: %s' % device)
continue
- tag = snap['tag']
- if tag:
- args = ['lvcreate', '--addtag', '@' + tag,
- '--snapshot', '--size', snap['size'],
- '--name', os.path.basename(snapdev), lvmdev]
- else:
- args = ['lvcreate', '--snapshot', '--size', snap['size'],
- '--name', os.path.basename(snapdev), lvmdev]
+ args = ['lvcreate']
+ if snap['tags']:
+ for tag in snap['tags']:
+ args.extend(['--addtag', tag.strip()])
+ args.extend(['--snapshot', '--size', snap['size'],
+ '--name', os.path.basename(snapdev), lvmdev])
ec = spawn(args)
if ec:
warn('Can not snapshot the device: %s' % device)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|