Class: LXCWrapper::Command
- Inherits:
 - 
      Object
      
        
- Object
 - LXCWrapper::Command
 
 - Defined in:
 - lib/distem/wrapper/lxc/command.rb
 
Constant Summary
- LS_WAIT_TIME =
 1- MAX_WAIT_CYCLES =
 16- @@lxc =
 Mutex.new
Class Method Summary (collapse)
- + (Object) clean(wait = false)
 - + (Object) create(contname, configfile, wait = true)
 - + (Object) destroy(contname, wait = true)
 - + (Object) freeze(contname)
 - + (Object) start(contname, daemon = true)
 - + (Object) stop(contname, wait = true)
 - + (Object) unfreeze(contname)
 
Class Method Details
+ (Object) clean(wait = false)
      44 45 46 47 48 49 50 51  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 44 def self.clean(wait=false) @@lxc.synchronize { _stopall(wait) _destroyall(wait) str = Distem::Lib::Shell.run('pidof lxc-wait || true') Distem::Lib::Shell.run('killall lxc-wait') if str and !str.empty? } end  | 
  
+ (Object) create(contname, configfile, wait = true)
      9 10 11 12 13 14  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 9 def self.create(contname, configfile, wait=true) @@lxc.synchronize { _destroy(contname,wait) Distem::Lib::Shell.run("lxc-create -n #{contname} -f #{configfile}",true) } end  | 
  
+ (Object) destroy(contname, wait = true)
      53 54 55 56 57  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 53 def self.destroy(contname,wait=true) @@lxc.synchronize { _destroy(contname, wait) } end  | 
  
+ (Object) freeze(contname)
      26 27 28 29 30  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 26 def self.freeze(contname) @@lxc.synchronize { _freeze(contname) } end  | 
  
+ (Object) start(contname, daemon = true)
      16 17 18 19 20 21 22 23 24  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 16 def self.start(contname,daemon=true) debugfile = File.join(Distem::Node::Admin::PATH_DISTEM_LOGS,"lxc","lxc-debug-#{contname}") @@lxc.synchronize { _stop(contname,true) if _status(contname) == Status::RUNNING FileUtils.rm_f(debugfile) Distem::Lib::Shell.run("lxc-start -n #{contname} -o #{debugfile} #{(daemon ? '-d' : '')}",true) _wait(contname,Status::RUNNING) } end  | 
  
+ (Object) stop(contname, wait = true)
      38 39 40 41 42  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 38 def self.stop(contname,wait=true) @@lxc.synchronize { _stop(contname,wait) } end  | 
  
+ (Object) unfreeze(contname)
      32 33 34 35 36  | 
    
      # File 'lib/distem/wrapper/lxc/command.rb', line 32 def self.unfreeze(contname) @@lxc.synchronize { _unfreeze(contname) } end  |