public
Description: ZFS bindings for Ruby
Clone URL: git://github.com/rubaidh/zetta.git
Shift to returning the NFS share name where applicable.  is_nfs_shared? 
can be implemented in terms of that.

git-svn-id: http://repos.rubaidh.com/zetta/trunk@30 
68698aeb-e32f-0410-bc7e-ede830af38d2
mathie (author)
Thu Jun 07 08:01:09 -0700 2007
commit  22b7ac553642e5eabab4fd18c655e96e3a63bb8e
tree    5712ec11cd608dd54e51495bab9798c7ec48b014
parent  8acbf03c8788dcf2a51ebd0ee915a2dfcb6d98c5
...
234
235
236
237
 
238
239
 
240
241
242
 
243
244
245
...
462
463
464
465
 
466
467
468
...
234
235
236
 
237
238
239
240
241
242
 
243
244
245
246
...
463
464
465
 
466
467
468
469
0
@@ -234,12 +234,13 @@ static VALUE my_zfs_unshare(VALUE self)
0
   return INT2NUM(zfs_unshare(zfs_handle));
0
 }
0
 
0
-static VALUE my_zfs_is_shared_nfs(VALUE self)
0
+static VALUE my_zfs_nfs_share_name(VALUE self)
0
 {
0
   zfs_handle_t *zfs_handle;
0
+ char *path;
0
   Data_Get_Struct(self, zfs_handle_t, zfs_handle);
0
   
0
- return zfs_is_shared_nfs(zfs_handle, NULL) ? Qtrue : Qfalse;
0
+ return zfs_is_shared_nfs(zfs_handle, &path) ? rb_str_new2(path) : Qnil;
0
 }
0
 
0
 static VALUE my_zfs_share_nfs(VALUE self)
0
@@ -462,7 +463,7 @@ void Init_libzfs()
0
   rb_define_method(cZFS, "is_shared?", my_zfs_is_shared, 0);
0
   rb_define_method(cZFS, "share!", my_zfs_share, 0);
0
   rb_define_method(cZFS, "unshare!", my_zfs_unshare, 0);
0
- rb_define_method(cZFS, "is_shared_nfs?", my_zfs_is_shared_nfs, 0);
0
+ rb_define_method(cZFS, "nfs_share_name", my_zfs_nfs_share_name, 0);
0
   rb_define_method(cZFS, "share_nfs!", my_zfs_share_nfs, 0);
0
   rb_define_method(cZFS, "unshare_nfs!", my_zfs_unshare_nfs, 0);
0
   rb_define_method(cZFS, "is_shared_iscsi?", my_zfs_is_shared_iscsi, 0);
...
286
287
288
289
 
290
291
 
292
293
 
294
295
296
...
329
330
331
332
 
333
334
 
335
336
 
337
338
339
...
286
287
288
 
289
290
 
291
292
 
293
294
295
296
...
329
330
331
 
332
333
 
334
335
 
336
337
338
339
0
@@ -286,11 +286,11 @@ describe "Given an existing ZFS filesystem called 'pool/shared' which has the sh
0
   it_should_behave_like "a shareable target"
0
 
0
   it "should be shareable and unshareable with the NFS-specific share functions" do
0
- @fs.is_shared_nfs?.should == true
0
+ @fs.nfs_share_name.should == "/#{@fs_name}"
0
     lambda { @fs.unshare_nfs!.should == 0 }.should_not raise_error
0
- @fs.is_shared_nfs?.should == false
0
+ @fs.nfs_share_name.should == nil
0
     lambda { @fs.share_nfs!.should == 0 }.should_not raise_error
0
- @fs.is_shared_nfs?.should == true
0
+ @fs.nfs_share_name.should == "/#{@fs_name}"
0
   end
0
 end
0
 
0
@@ -329,11 +329,11 @@ describe "Given an existing ZFS filesystem called 'pool/unshared'" do
0
     lambda { @fs.share!.should == 0 }.should_not raise_error
0
     @fs.is_shared?.should == false
0
 
0
- @fs.is_shared_nfs?.should == false
0
+ @fs.nfs_share_name.should == nil
0
     lambda { @fs.unshare_nfs!.should == 0 }.should_not raise_error
0
- @fs.is_shared_nfs?.should == false
0
+ @fs.nfs_share_name.should == nil
0
     lambda { @fs.share_nfs!.should == 0 }.should_not raise_error
0
- @fs.is_shared_nfs?.should == false
0
+ @fs.nfs_share_name.should == nil
0
   end
0
 end
0
 

Comments

    No one has commented yet.