Class: Dcmgr::Cli::Storage
- Includes:
- Models
- Defined in:
- lib/dcmgr/cli/storage.rb
Instance Method Summary collapse
Instance Method Details
#add(node_id) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dcmgr/cli/storage.rb', line 21 def add(node_id) unless ([:force] || Isono::Models::NodeState.find(:node_id=>node_id)) abort("Node ID is not registered yet: #{node_id}") end fields = {:node_id=>node_id, :offering_disk_space=>[:disk_space], :transport_type=>[:transport_type], :storage_type=>[:storage_type], :export_path=>[:base_path], :snapshot_base_path => [:snapshot_base_path], :ipaddr=>[:ipaddr], :account_id=>[:account_id], } fields.merge!({:uuid => [:uuid]}) unless [:uuid].nil? puts super(StorageNode,fields) end |
#del(uuid) ⇒ Object
41 42 43 |
# File 'lib/dcmgr/cli/storage.rb', line 41 def del(uuid) super(StorageNode,uuid) end |
#show(uuid = nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/dcmgr/cli/storage.rb', line 46 def show(uuid=nil) if uuid st = StorageNode[uuid] || UnknownUUIDError.raise(uuid) puts ERB.new(<<__END, nil, '-').result(binding) UUID: <%= st.canonical_uuid %> Node ID: <%= st.node_id %> Disk space (offerring): <%= st.offering_disk_space %>MB Storage: <%= st.storage_type %> Transport: <%= st.transport_type %> IP Address: <%= st.ipaddr %> Export path: <%= st.export_path %> Snapshot base path: <%= st.snapshot_base_path %> __END else cond = {} all = StorageNode.filter(cond).all puts ERB.new(<<__END, nil, '-').result(binding) <%- all.each { |row| -%> <%= "%-15s %-20s %-10s" % [row.canonical_uuid, row.node_id, row.status] %> <%- } -%> __END end end |
#shownodes ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/dcmgr/cli/storage.rb', line 79 def shownodes nodes = Isono::Models::NodeState.filter.all puts ERB.new(<<__END, nil, '-').result(binding) <%- nodes.each { |row| -%> <%= "%-20s %-10s" % [row.node_id, row.state] %> <%- } -%> __END end |