715d8a84c9d7d18cfa980c221c931502e5e89f80
[certmaster.git] / certmaster / minion / modules / netapp / vol / clone.py
1 ##
2 ## NetApp Filer 'vol.clone' Module
3 ##
4 ## Copyright 2008, Red Hat, Inc
5 ## John Eckersberg <jeckersb@redhat.com>
6 ##
7 ## This software may be freely redistributed under the terms of the GNU
8 ## general public license.
9 ##
10 ## You should have received a copy of the GNU General Public License
11 ## along with this program; if not, write to the Free Software
12 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13 ##
14
15 import re
16 from func.minion.modules import func_module
17 from func.minion.modules.netapp.common import *
18
19 class Clone(func_module.FuncModule):
20
21 # Update these if need be.
22 version = "0.0.1"
23 api_version = "0.0.1"
24 description = "Interface to the 'vol' command"
25
26 def create(self, filer, vol, parent, snap):
27 """
28 TODO: Document me ...
29 """
30 regex = """Creation of clone volume .* has completed."""
31 cmd_opts = ['vol', 'clone', 'create', vol, '-b', parent, snap]
32 output = ssh(filer, cmd_opts)
33 return check_output(regex, output)
34
35 def split(self, filer, vol):
36 """
37 TODO: Document me ...
38 """
39 # only worry about 'start' now, I don't terribly care to automate the rest
40 regex = """Clone volume .* will be split from its parent."""
41 cmd_opts = ['vol', 'clone', 'split', 'start', vol]
42 output = ssh(filer, cmd_opts)
43 return check_output(regex, output)
44
45
46