Class: Dcmgr::Cli::Image::AddOperation
- Defined in:
- lib/dcmgr/cli/image.rb
Instance Method Summary collapse
-
#local(location) ⇒ Object
method_option :state, :type => :string, :default => “init”, :desc => “The state for the new machine image”.
-
#volume(snapshot_id) ⇒ Object
method_option :state, :type => :string, :default => “init”, :desc => “The state for the new machine image”.
Instance Method Details
#local(location) ⇒ Object
method_option :state, :type => :string, :default => “init”, :desc => “The state for the new machine image”
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dcmgr/cli/image.rb', line 20 def local(location) UnknownUUIDError.raise([:account_id]) if M::Account[[:account_id]].nil? UnsupportedArchError.raise([:arch]) unless M::HostNode::SUPPORTED_ARCH.member?([:arch]) full_path = File.(location) File.exists?(full_path) || Error.raise("File not found: #{full_path}",100) #TODO: Check if :state is a valid state fields = .dup fields[:boot_dev_type]=M::Image::BOOT_DEV_LOCAL fields[:source] = { :uri => "file://#{full_path}", } puts add(M::Image, fields) end |
#volume(snapshot_id) ⇒ Object
method_option :state, :type => :string, :default => “init”, :desc => “The state for the new machine image”
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dcmgr/cli/image.rb', line 44 def volume(snapshot_id) UnknownUUIDError.raise([:account_id]) if M::Account[[:account_id]].nil? UnsupportedArchError.raise([:arch]) unless M::HostNode::SUPPORTED_ARCH.member?([:arch]) UnknownUUIDError.raise(snapshot_id) if M::VolumeSnapshot[snapshot_id].nil? #TODO: Check if :state is a valid state fields = .dup fields[:boot_dev_type]=M::Image::BOOT_DEV_SAN fields[:source] = { :snapshot_id => snapshot_id, } puts add(M::Image, fields) end |