Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2396970
  • 博文数量: 328
  • 博客积分: 4302
  • 博客等级: 上校
  • 技术积分: 5486
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-01 11:14
个人简介

悲剧,绝对的悲剧,悲剧中的悲剧。

文章分类

全部博文(328)

文章存档

2017年(6)

2016年(18)

2015年(28)

2014年(73)

2013年(62)

2012年(58)

2011年(55)

2010年(28)

分类: 服务器与存储

2015-07-26 21:15:05

ZFSSA是Oracle的一站式存储解决方案,尤其在NAS方面有比较广泛的应用。其的操作和使用比较方便,管理员可以通过命令行CLI或者WEB方式进行相关设置。另外,ZFSSA提供了多种接口给第三方软件进行操作,最近比较新并且强大的是REST接口,本文介绍其早前就一直支持的基于CLI的Javascript编程接口。

先来看一下ZFSSA的CLI标准用法:
  1. $ ssh root@192.168.56.101
  2. Password:
  3. Last login: Mon Feb 14 16:09:05 2011 from 192.168.56.1
  4. 7000ppc1:> show
  5. Properties:
  6.                       showcode = false
  7.                      showstack = false
  8.                   exitcoverage = false
  9.                    showmessage = true
  10.                     asserterrs = false

  11. Children:
  12.                     configuration => Perform configuration actions
  13.                       maintenance => Perform maintenance actions
  14.                               raw => Make raw XML-RPC calls
  15.                         analytics => Manage appliance analytics
  16.                            status => View appliance status
  17.                            shares => Manage shares

再来看一下如何在其中运行Javascript
  1. $ ssh root@192.168.0.140
  2. Password:
  3. Last login: Mon Feb 14 16:09:05 2011 from 192.168.56.1
  4. script
  5. run('cd /');
  6. run('configuration storage');
  7. var projects = choices('pool');
  8. printf( projects);
  9. printf( "\n");
  10. .
  11. pool-h1,pool-h2

这里的Javascript其实和标准的Javascript没有区别,另外ZFSSA还提供了一些方便的扩展函数

Function Description
run Runs the specified command in the shell, returning any output as a string. Note that if the output contains multiple lines, the returned string will contain embedded newlines.
props Returns an array of the property names for the current context.
get Gets the value of the specified property. Note that this function returns the value in native form. For example, dates are returned as Date objects.
set Takes two string arguments, setting the specified property to the specified value.
list Returns an array of tokens corresponding to the dynamic children of the current context.
choices("para") Returns an array of tokens corresponding to the possible values for para

更多的介绍可以参考这个文档
阅读(1778) | 评论(0) | 转发(0) |
0

上一篇:Java 反射

下一篇:CYGWIN SSH Server 安装

给主人留下些什么吧!~~