@@ -302,6 +302,27 @@ function clone(vmname, clonevmname, /*optional*/ snapshot, callback) {
302302 vboxmanage ( cmd , callback ) ;
303303}
304304
305+ var storage = {
306+ addCtl : function ( options , callback ) {
307+ var vm = options . vm || options . name || options . vmname || options . title ,
308+ device_name = options . perhiperal_name || "IDE" ,
309+ type = options . type || "ide" ;
310+ logging . info ( 'Adding "%s" controller named "%s" to %s' , type , name , vm ) ;
311+ var cmd = [ 'storagectl' , vm , '--name' , device_name , "--add" , type ] ;
312+ vboxmanage ( cmd , callback ) ;
313+ } ,
314+ attach : function ( options , callback ) {
315+ var vm = options . vm || options . name || options . vmname || options . title ,
316+ device_name = options . perhiperal_name ,
317+ port = options . port || "0" ,
318+ device = options . device || "0" ,
319+ type = options . type || "dvddrive" ;
320+ logging . info ( 'Adding "%s" controller named "%s" to %s' , type , name , vm ) ;
321+ var cmd = [ 'storageattach' , vm , '--storagectl' , device_name , "--port" , port , "--device" , device , "--type" , type , "--medium" , "medium" ] ;
322+ vboxmanage ( cmd , callback ) ;
323+ }
324+ }
325+
305326function isRunning ( vmname , callback ) {
306327 vboxmanage ( [ 'list' , 'runningvms' ] , function ( error , stdout ) {
307328 logging . info ( 'Checking virtual machine "%s" is running or not' , vmname ) ;
@@ -523,6 +544,7 @@ module.exports = {
523544 'isRunning' : isRunning ,
524545 'extradata' : extradata ,
525546 'clone' : clone ,
547+ 'storage' : storage ,
526548
527549 'SCAN_CODES' : require ( './scan-codes' )
528550} ;
0 commit comments