logs: pass call context to Zetabyte zpool
This commit is contained in:
		
							parent
							
								
									8557e1f0c1
								
							
						
					
					
						commit
						29b7c05bd6
					
				|  | @ -238,7 +238,7 @@ class Zetabyte { | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        * @param {*} vdevs |        * @param {*} vdevs | ||||||
|        */ |        */ | ||||||
|       add: function (pool, vdevs) { |       add: function (callContext, pool, vdevs) { | ||||||
|         // -f force
 |         // -f force
 | ||||||
|         // -n noop
 |         // -n noop
 | ||||||
|       }, |       }, | ||||||
|  | @ -250,7 +250,7 @@ class Zetabyte { | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        * @param {*} new_device |        * @param {*} new_device | ||||||
|        */ |        */ | ||||||
|       attach: function (pool, device, new_device) { |       attach: function (callContext, pool, device, new_device) { | ||||||
|         // -f      Forces use of new_device, even if its appears to be in use.
 |         // -f      Forces use of new_device, even if its appears to be in use.
 | ||||||
|       }, |       }, | ||||||
| 
 | 
 | ||||||
|  | @ -259,7 +259,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       checkpoint: function (pool) {}, |       checkpoint: function (callContext, pool) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool clear [-F [-n]] pool [device] |        * zpool clear [-F [-n]] pool [device] | ||||||
|  | @ -267,7 +267,7 @@ class Zetabyte { | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        */ |        */ | ||||||
|       clear: function (pool, device) {}, |       clear: function (callContext, pool, device) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool create [-fnd] [-o property=value] ... [-O |        * zpool create [-fnd] [-o property=value] ... [-O | ||||||
|  | @ -278,8 +278,8 @@ class Zetabyte { | ||||||
|        * zpool create command, including log devices, cache devices, and hot spares. |        * zpool create command, including log devices, cache devices, and hot spares. | ||||||
|        * The input is an object of the form produced by the disklayout library. |        * The input is an object of the form produced by the disklayout library. | ||||||
|        */ |        */ | ||||||
|       create: function (pool, options) { |       create: function (callContext, pool, options) { | ||||||
|         if (arguments.length != 2) |         if (arguments.length != 3) | ||||||
|           throw Error("Invalid arguments, 2 arguments required"); |           throw Error("Invalid arguments, 2 arguments required"); | ||||||
| 
 | 
 | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|  | @ -357,8 +357,8 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       destroy: function (pool) { |       destroy: function (callContext, pool) { | ||||||
|         if (arguments.length != 1) throw Error("Invalid arguments"); |         if (arguments.length != 2) throw Error("Invalid arguments"); | ||||||
| 
 | 
 | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|  | @ -384,8 +384,8 @@ class Zetabyte { | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        */ |        */ | ||||||
|       detach: function (pool, device) { |       detach: function (callContext, pool, device) { | ||||||
|         if (arguments.length != 2) throw Error("Invalid arguments"); |         if (arguments.length != 3) throw Error("Invalid arguments"); | ||||||
| 
 | 
 | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|  | @ -410,7 +410,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       export: function (pool) { |       export: function (callContext, pool) { | ||||||
|         if (arguments.length != 2) throw Error("Invalid arguments"); |         if (arguments.length != 2) throw Error("Invalid arguments"); | ||||||
| 
 | 
 | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|  | @ -440,14 +440,14 @@ class Zetabyte { | ||||||
|       /** |       /** | ||||||
|        * zpool get [-Hp] [-o field[,...]] all | property[,...] pool ... |        * zpool get [-Hp] [-o field[,...]] all | property[,...] pool ... | ||||||
|        */ |        */ | ||||||
|       get: function () {}, |       get: function (callContext) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool history [-il] [pool] ... |        * zpool history [-il] [pool] ... | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       history: function (pool) { |       history: function (callContext, pool) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("history"); |           args.push("history"); | ||||||
|  | @ -486,7 +486,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} options |        * @param {*} options | ||||||
|        */ |        */ | ||||||
|       import: function (options = {}) { |       import: function (callContext, options = {}) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("import"); |           args.push("import"); | ||||||
|  | @ -511,14 +511,14 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} options |        * @param {*} options | ||||||
|        */ |        */ | ||||||
|       iostat: function (options = {}) {}, |       iostat: function (callContext, options = {}) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool labelclear [-f] device |        * zpool labelclear [-f] device | ||||||
|        * |        * | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        */ |        */ | ||||||
|       labelclear: function (device) {}, |       labelclear: function (callContext, device) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool list [-Hpv] [-o property[,...]] [-T d|u] [pool] ... [inverval |        * zpool list [-Hpv] [-o property[,...]] [-T d|u] [pool] ... [inverval | ||||||
|  | @ -527,8 +527,8 @@ class Zetabyte { | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        * @param {*} options |        * @param {*} options | ||||||
|        */ |        */ | ||||||
|       list: function (pool, properties, options = {}) { |       list: function (callContext, pool, properties, options = {}) { | ||||||
|         if (!(arguments.length >= 1)) throw Error("Invalid arguments"); |         if (!(arguments.length >= 2)) throw Error("Invalid arguments"); | ||||||
|         if (!properties) properties = zb.DEFAULT_ZPOOL_LIST_PROPERTIES; |         if (!properties) properties = zb.DEFAULT_ZPOOL_LIST_PROPERTIES; | ||||||
| 
 | 
 | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|  | @ -594,7 +594,7 @@ class Zetabyte { | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        * @param {*} options |        * @param {*} options | ||||||
|        */ |        */ | ||||||
|       offline: function (pool, device, options = {}) { |       offline: function (callContext, pool, device, options = {}) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("offline"); |           args.push("offline"); | ||||||
|  | @ -621,7 +621,7 @@ class Zetabyte { | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        * @param {*} options |        * @param {*} options | ||||||
|        */ |        */ | ||||||
|       online: function (pool, device, options = {}) { |       online: function (callContext, pool, device, options = {}) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("online"); |           args.push("online"); | ||||||
|  | @ -646,7 +646,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       reguid: function (pool) { |       reguid: function (callContext, pool) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("reguid"); |           args.push("reguid"); | ||||||
|  | @ -672,7 +672,7 @@ class Zetabyte { | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        */ |        */ | ||||||
|       remove: function (pool, device, options = {}) { |       remove: function (callContext, pool, device, options = {}) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("remove"); |           args.push("remove"); | ||||||
|  | @ -701,7 +701,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       reopen: function (pool) { |       reopen: function (callContext, pool) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("reopen"); |           args.push("reopen"); | ||||||
|  | @ -726,7 +726,7 @@ class Zetabyte { | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        * @param {*} new_device |        * @param {*} new_device | ||||||
|        */ |        */ | ||||||
|       replace: function (pool, device, new_device) { |       replace: function (callContext, pool, device, new_device) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("replace"); |           args.push("replace"); | ||||||
|  | @ -754,7 +754,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       scrub: function (pool) { |       scrub: function (callContext, pool) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("scrub"); |           args.push("scrub"); | ||||||
|  | @ -787,7 +787,7 @@ class Zetabyte { | ||||||
|        * @param {*} property |        * @param {*} property | ||||||
|        * @param {*} value |        * @param {*} value | ||||||
|        */ |        */ | ||||||
|       set: function (pool, property, value) { |       set: function (callContext, pool, property, value) { | ||||||
|         value = escapeShell(value); |         value = escapeShell(value); | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|  | @ -815,12 +815,12 @@ class Zetabyte { | ||||||
|        * @param {*} newpool |        * @param {*} newpool | ||||||
|        * @param {*} device |        * @param {*} device | ||||||
|        */ |        */ | ||||||
|       split: function (pool, newpool, device) {}, |       split: function (callContext, pool, newpool, device) {}, | ||||||
| 
 | 
 | ||||||
|       /** |       /** | ||||||
|        * zpool status [-vx] [-T d|u] [pool] ... [interval [count]] |        * zpool status [-vx] [-T d|u] [pool] ... [interval [count]] | ||||||
|        */ |        */ | ||||||
|       status: function (pool, options = {}) { |       status: function (callContext, pool, options = {}) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           if (!("parse" in options)) options.parse = true; |           if (!("parse" in options)) options.parse = true; | ||||||
|  | @ -874,7 +874,7 @@ class Zetabyte { | ||||||
|        * |        * | ||||||
|        * @param {*} pool |        * @param {*} pool | ||||||
|        */ |        */ | ||||||
|       upgrade: function (pool) { |       upgrade: function (callContext, pool) { | ||||||
|         return new Promise((resolve, reject) => { |         return new Promise((resolve, reject) => { | ||||||
|           let args = []; |           let args = []; | ||||||
|           args.push("upgrade"); |           args.push("upgrade"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue