2 ## Overlord library to interface with minion-side netapp operations
4 ## Most of this is just wrappers to create some cleaner, earier to use
5 ## interfaces. Also allows users to get function signatures and use
6 ## nice things like kwargs client side, for those of us who can't live
7 ## without ipython introspection.
9 ## Copyright 2008, Red Hat, Inc
10 ## John Eckersberg <jeckersb@redhat.com>
12 ## This software may be freely redistributed under the terms of the GNU
13 ## general public license.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 from func
.overlord
.client
import Client
22 class RemoteError(Exception): pass
25 if type(res
) == type([]) and res
[0] == 'REMOTE_ERROR':
26 raise RemoteError
, res
[2]
31 def __init__(self
, filer
, admin_host
):
32 Client
.__init
__(self
, admin_host
)
34 self
.admin_host
= admin_host
36 def create_volume(self
, vol
, aggr
, size
):
37 return _(self
.netapp
.vol
.create(self
.filer
, vol
, aggr
, size
)[self
.admin_host
])
39 def destroy_volume(self
, vol
):
42 self
.netapp
.vol
.offline(self
.filer
, vol
)
45 return _(self
.netapp
.vol
.destroy(self
.filer
, vol
)[self
.admin_host
])
47 def offline_volume(self
, vol
):
48 return _(self
.netapp
.vol
.offline(self
.filer
, vol
)[self
.admin_host
])
50 def online_volume(self
, vol
):
51 return _(self
.netapp
.vol
.online(self
.filer
, vol
)[self
.admin_host
])
53 def get_volume_size(self
, vol
):
54 return _(self
.netapp
.vol
.size(self
.filer
, vol
)[self
.admin_host
])
56 def resize_volume(self
, vol
, delta
):
57 return _(self
.netapp
.vol
.size(self
.filer
, vol
, delta
)[self
.admin_host
])
59 def create_snapshot(self
, vol
, snap
):
60 return _(self
.netapp
.snap
.create(self
.filer
, vol
, snap
)[self
.admin_host
])
62 def delete_snapshot(self
, vol
, snap
):
63 return _(self
.netapp
.snap
.delete(self
.filer
, vol
, snap
)[self
.admin_host
])
65 def create_clone_volume(self
, vol
, parent
, snap
):
66 return _(self
.netapp
.vol
.clone
.create(self
.filer
, vol
, parent
, snap
)[self
.admin_host
])
68 def split_clone_volume(self
, vol
):
69 return _(self
.netapp
.vol
.clone
.split(self
.filer
, vol
)[self
.admin_host
])
71 def list_volumes(self
):
72 vols
= _(self
.netapp
.vol
.status(self
.filer
))
75 return_list
.append(vol
['name'])
78 def volume_details(self
, vol
=None):
80 return _(self
.netapp
.vol
.status(self
.filer
, vol
)[self
.admin_host
])
82 return _(self
.netapp
.vol
.status(self
.filer
)[self
.admin_host
])