Permalink
Browse files

OS-913: Add metadata agent to illumos-live

  • Loading branch information...
1 parent e7498be commit 7b183d438048b3a07d7a6fc655ae30f3625b08e7 @orlandov orlandov committed Feb 14, 2012
Showing with 12,635 additions and 2 deletions.
  1. +20 −2 src/Makefile
  2. +40 −0 src/manifest
  3. +19 −0 src/node-zsock/LICENSE
  4. +43 −0 src/node-zsock/README.md
  5. +35 −0 src/node-zsock/demo/server.js
  6. +3,126 −0 src/node-zsock/devtools/cpplint.py
  7. +64 −0 src/node-zsock/lib/zsock.js
  8. +22 −0 src/node-zsock/package.json
  9. +521 −0 src/node-zsock/src/zsock.cc
  10. +108 −0 src/node-zsock/tst/zsock.test.js
  11. +83 −0 src/node-zsock/wscript
  12. +19 −0 src/node-zutil/LICENSE
  13. +50 −0 src/node-zutil/README.md
  14. +33 −0 src/node-zutil/demo/example.js
  15. +3,126 −0 src/node-zutil/devtools/cpplint.py
  16. +3 −0 src/node-zutil/lib/zutil.js
  17. +22 −0 src/node-zutil/package.json
  18. +124 −0 src/node-zutil/src/zone.cc
  19. +24 −0 src/node-zutil/src/zone.h
  20. +267 −0 src/node-zutil/src/zonecfg.cc
  21. +25 −0 src/node-zutil/src/zonecfg.h
  22. +15 −0 src/node-zutil/src/zutil_bindings.cc
  23. +57 −0 src/node-zutil/src/zutil_common.h
  24. +73 −0 src/node-zutil/tst/zone.test.js
  25. +100 −0 src/node-zutil/tst/zonecfg.test.js
  26. +74 −0 src/node-zutil/wscript
  27. +2 −0 src/node_modules/log4js/.npmignore
  28. +5 −0 src/node_modules/log4js/.travis.yml
  29. +231 −0 src/node_modules/log4js/README.md
  30. +14 −0 src/node_modules/log4js/example-connect-logger.js
  31. +50 −0 src/node_modules/log4js/example-socket.js
  32. +22 −0 src/node_modules/log4js/example.js
  33. +20 −0 src/node_modules/log4js/lib/appenders/console.js
  34. +160 −0 src/node_modules/log4js/lib/appenders/file.js
  35. +76 −0 src/node_modules/log4js/lib/appenders/hookio.js
  36. +21 −0 src/node_modules/log4js/lib/appenders/logLevelFilter.js
  37. +77 −0 src/node_modules/log4js/lib/appenders/multiprocess.js
  38. +76 −0 src/node_modules/log4js/lib/appenders/smtp.js
  39. +167 −0 src/node_modules/log4js/lib/connect-logger.js
  40. +60 −0 src/node_modules/log4js/lib/date_format.js
  41. +260 −0 src/node_modules/log4js/lib/layouts.js
  42. +56 −0 src/node_modules/log4js/lib/levels.js
  43. +409 −0 src/node_modules/log4js/lib/log4js.js
  44. +7 −0 src/node_modules/log4js/lib/log4js.json
  45. +27 −0 src/node_modules/log4js/log-rolling.js
  46. +37 −0 src/node_modules/log4js/memory-test.js
  47. +32 −0 src/node_modules/log4js/package.json
  48. +23 −0 src/node_modules/log4js/test/date_format.js
  49. +147 −0 src/node_modules/log4js/test/fileAppender.js
  50. +101 −0 src/node_modules/log4js/test/hookioAppender.js
  51. +208 −0 src/node_modules/log4js/test/layouts.js
  52. +16 −0 src/node_modules/log4js/test/log4js.json
  53. +69 −0 src/node_modules/log4js/test/logLevelFilter.js
  54. +601 −0 src/node_modules/log4js/test/logging.js
  55. +173 −0 src/node_modules/log4js/test/multiprocessAppender.js
  56. +162 −0 src/node_modules/log4js/test/smtpAppender.js
  57. +128 −0 src/node_modules/log4js/test/test-connect-logger.js
  58. +85 −0 src/node_modules/log4js/test/test-global-log-level.js
  59. +260 −0 src/node_modules/log4js/test/test-nolog.js
  60. +11 −0 src/node_modules/log4js/test/with-log-rolling.json
  61. +28 −0 src/node_modules/log4js/test/with-logLevelFilter.json
  62. +415 −0 src/vm/lib/metadata/agent.js
  63. +51 −0 src/vm/lib/metadata/common.js
  64. +58 −0 src/vm/lib/metadata/zone_booted_watcher.js
  65. +51 −0 src/vm/lib/metadata/zwatch.js
  66. +42 −0 src/vm/sbin/metadata.js
  67. +52 −0 src/vm/smf/system-metadata
  68. +52 −0 src/vm/smf/system-metadata.xml
View
@@ -3,7 +3,10 @@ CFLAGS=-Wall
TARGETS=bootparams diskinfo disklist removable_disk disk_size \
node-kstat/build/Release/kstat.node zoneevent \
node-expat/build/Release/node-expat.node \
- node-syslog/build/Release/syslog.node
+ node-syslog/build/Release/syslog.node \
+ node-zsock/build/Release/zsock_bindings.node \
+ node-zutil/build/Release/zutil_bindings.node \
+
SMARTDC_TARGETS=has_hvx
DESTDIR=../proto
NODE_WAF=$(PWD)/../proto/usr/bin/node-waf
@@ -16,12 +19,19 @@ install: $(TARGETS) sysinfo
mkdir -p $(DESTDIR)/smartdc/bin
cp -p $(SMARTDC_TARGETS) $(DESTDIR)/smartdc/bin
mkdir -m 0755 -p $(DESTDIR)/usr/node_modules
- find node_modules -type f -exec cp {} $(DESTDIR)/usr/node_modules/ \;
+ cp -Pr node_modules/* $(DESTDIR)/usr/node_modules
cp node-kstat/build/Release/kstat.node $(DESTDIR)/usr/node_modules/
cp node-syslog/build/Release/syslog.node $(DESTDIR)/usr/node_modules/syslog.node
rm -rf $(DESTDIR)/usr/vm
cp -PR vm $(DESTDIR)/usr/
mkdir -m 0755 -p $(DESTDIR)/usr/vm/node_modules
+ mkdir -p $(DESTDIR)/usr/vm/node_modules/{zsock,zutil}/build/Release
+ cp -Pr node-zsock/{package.json,lib} $(DESTDIR)/usr/vm/node_modules/zsock
+ cp -Pr node-zutil/{package.json,lib} $(DESTDIR)/usr/vm/node_modules/zutil
+ cp node-zsock/build/Release/zsock_bindings.node \
+ $(DESTDIR)/usr/vm/node_modules/zsock/build/Release
+ cp node-zutil/build/Release/zutil_bindings.node \
+ $(DESTDIR)/usr/vm/node_modules/zutil/build/Release
cp node-expat/build/Release/node-expat.node \
$(DESTDIR)/usr/vm/node_modules/expat_binding.node
cat node-expat/lib/node-expat.js | \
@@ -30,8 +40,10 @@ install: $(TARGETS) sysinfo
cp zoneevent $(DESTDIR)/usr/vm/sbin/zoneevent
mkdir -p $(DESTDIR)/lib/svc/manifest/system
cp vm/smf/system-vmadmd.xml $(DESTDIR)/lib/svc/manifest/system/system-vmadmd.xml
+ cp vm/smf/system-metadata.xml $(DESTDIR)/lib/svc/manifest/system/system-metadata.xml
mv $(DESTDIR)/usr/vm/sbin/vmadmd.js $(DESTDIR)/usr/vm/sbin/vmadmd
mv $(DESTDIR)/usr/vm/sbin/vmadm.js $(DESTDIR)/usr/vm/sbin/vmadm
+ mv $(DESTDIR)/usr/vm/sbin/metadata.js $(DESTDIR)/usr/vm/sbin/metadata
mkdir -m 0755 -p $(DESTDIR)/var/db/dsadm
cp -PR ds $(DESTDIR)/usr/
@@ -63,6 +75,12 @@ node-expat/build/Release/node-expat.node: node-expat/node-expat.cc $(NODE_WAF)
node-syslog/build/Release/syslog.node: node-syslog/syslog.cc $(NODE_WAF)
(cd node-syslog && $(NODE_WAF) configure && $(NODE_WAF) build)
+node-zutil/build/Release/zutil_bindings.node: $(NODE_WAF)
+ (cd node-zutil && $(NODE_WAF) configure && $(NODE_WAF) build)
+
+node-zsock/build/Release/zsock_bindings.node: $(NODE_WAF)
+ (cd node-zutil && $(NODE_WAF) configure && $(NODE_WAF) build)
+
disklist:
cp disklist.sh disklist
chmod 0755 disklist
View
@@ -37,6 +37,30 @@ f usr/vm/node_modules/qmp.js 0444 root bin
f usr/vm/node_modules/VM.js 0444 root bin
f usr/vm/smf/system-vmadmd 0555 root bin
f usr/vm/smf/system-vmadmd.xml 0444 root bin
+# metadata daemon
+d usr/vm/lib 0555 root bin
+d usr/vm/lib/metadata 0555 root bin
+f usr/vm/lib/metadata/common.js 0444 root bin
+f usr/vm/lib/metadata/zwatch.js 0444 root bin
+f usr/vm/lib/metadata/agent.js 0444 root bin
+f usr/vm/lib/metadata/zone_booted_watcher.js 0444 root bin
+f usr/vm/sbin/metadata 0555 root bin
+f usr/vm/smf/system-metadata 0555 root bin
+f lib/svc/manifest/system/system-metadata.xml 0444 root bin
+d usr/vm/node_modules/zsock 0555 root bin
+f usr/vm/node_modules/zsock/package.json 0444 root bin
+d usr/vm/node_modules/zsock/lib 0555 root bin
+f usr/vm/node_modules/zsock/lib/zsock.js 0444 root bin
+d usr/vm/node_modules/zsock/build 0555 root bin
+d usr/vm/node_modules/zsock/build/Release 0555 root bin
+f usr/vm/node_modules/zsock/build/Release/zsock_bindings.node 0444 root bin
+d usr/vm/node_modules/zutil 0555 root bin
+f usr/vm/node_modules/zutil/package.json 0444 root bin
+d usr/vm/node_modules/zutil/build 0555 root bin
+d usr/vm/node_modules/zutil/build/Release 0555 root bin
+f usr/vm/node_modules/zutil/build/Release/zutil_bindings.node 0444 root bin
+d usr/vm/node_modules/zutil/lib 0555 root bin
+f usr/vm/node_modules/zutil/lib/zutil.js 0444 root bin
# 0-devpro-stamp
f usr/include/demangle.h 0644 root bin
f usr/lib/libC.so.5 0755 root bin
@@ -66,6 +90,22 @@ f usr/node_modules/onlyif.js 0444 root bin
f usr/node_modules/sprintf.js 0444 root bin
f usr/node_modules/syslog.node 0444 root bin
f usr/node_modules/system.js 0444 root bin
+d usr/node_modules/log4js 0555 root bin
+f usr/node_modules/log4js/package.json 0444 root bin
+d usr/node_modules/log4js/lib 0555 root bin
+f usr/node_modules/log4js/lib/date_format.js 0444 root bin
+f usr/node_modules/log4js/lib/log4js.json 0444 root bin
+f usr/node_modules/log4js/lib/log4js.js 0444 root bin
+d usr/node_modules/log4js/lib/appenders 0555 root bin
+f usr/node_modules/log4js/lib/appenders/multiprocess.js 0444 root bin
+f usr/node_modules/log4js/lib/appenders/console.js 0444 root bin
+f usr/node_modules/log4js/lib/appenders/file.js 0444 root bin
+f usr/node_modules/log4js/lib/appenders/smtp.js 0444 root bin
+f usr/node_modules/log4js/lib/appenders/logLevelFilter.js 0444 root bin
+f usr/node_modules/log4js/lib/appenders/hookio.js 0444 root bin
+f usr/node_modules/log4js/lib/connect-logger.js 0444 root bin
+f usr/node_modules/log4js/lib/layouts.js 0444 root bin
+f usr/node_modules/log4js/lib/levels.js 0444 root bin
# 0-man-stamp
d usr/share/man/man3m 0755 root bin
f usr/share/man/man3m/acos.3m 0444 root bin
View
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Mark Cavage, All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
View
@@ -0,0 +1,43 @@
+node-zsock is a very small library specific to Sun derived operating systems
+(i.e., illumos). This library allows a node server running in the Global
+Zone to open Unix Domain Sockets in other zones, safely, under the same
+FS path in each zone. By using this mechanism, you can enable IPC across zones.
+
+## Usage
+
+The library is very simple, and small, and only exposes you the ability to
+create a new fd socket that can be used with the existing node net API:
+
+ var zsock = require('zsock');
+ zsock.createZoneSocket({
+ zone: 'foo',
+ path: '/tmp/sock'
+ }, function(err, fd) {
+ if (err) throw err;
+
+ var server = net.createServer(function(c) {
+ c.write('hello from the global zone...\r\n');
+ c.pipe(c);
+ });
+
+ server.listenFD(fd);
+ });
+
+Note that this API creates a STREAM socket (i.e., there's no datagram support).
+But that seems to be the general case in node anyway.
+
+## Installation
+
+ npm install zsock
+
+(You can also install it by doing `node-waf configure build` and then
+linking or copying the folder into your project's `node_modules`
+directory.)
+
+## License
+
+MIT. 'Nuff said.
+
+## Bugs
+
+See <https://github.com/mcavage/node-zsock/issues>.
@@ -0,0 +1,35 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+var fs = require('fs');
+var net = require('net');
+
+var zsock = require('../lib/zsock');
+
+var zopts = {
+ zone: process.env.ZSOCK_ZONE,
+ path: '/tmp/.zsock-demo'
+};
+
+zsock.createZoneSocket(zopts, function(err, fd) {
+
+ if (err) throw err;
+
+ var server = net.createServer(function(c) {
+ c.write('hello from the global zone...\r\n');
+ c.pipe(c);
+ });
+
+ server.on('error', function(e) {
+ if (e.code !== 'EINTR') {
+ throw e;
+ }
+ });
+
+ server.listenFD(fd, function() {
+ console.log('Listening in zone %s on %s', zopts.zone, zopts.path);
+ console.log('To test, run the following commands\n');
+ console.log('\nzlogin %s', zopts.zone);
+ console.log('\npkgin -y install gnetcat');
+ console.log('\necho -n -e "foo\\r\\n" | nc -U %s', zopts.path);
+ });
+});
+
Oops, something went wrong.

0 comments on commit 7b183d4

Please sign in to comment.