Revision 104387a7 src/cli/onevm

View differences:

src/cli/onevm
68 68
        :desc => "CPU percentage used by the VM",
69 69
        :size => 3,
70 70
        :proc => lambda {|d,e|
71
            d["cpu"]
71
            d["CPU"]
72 72
        }
73 73
    },
74 74
    :mem => {
75 75
        :name => "MEM",
76 76
        :desc => "Memory used by the VM",
77 77
        :size => 7,
78
        :proc => lambda {|d,e| d["memory"] }
78
        :proc => lambda {|d,e| d["MEMORY"] }
79 79
    },
80 80
    :hostname => {
81 81
        :name => "HOSTNAME",
......
100 100
        :name => "ID",
101 101
        :desc => "ONE identifier for the VM",
102 102
        :size => 4,
103
        :proc => lambda {|d,e| d["id"] }
103
        :proc => lambda {|d,e| d["ID"] }
104 104
    },
105 105
    :seq => {
106 106
        :name => "SEQ",
107 107
        :desc => "Sequence number",
108 108
        :size => 3,
109
        :proc => lambda {|d,e| d["seq"] }
109
        :proc => lambda {|d,e| d["SEQ"] }
110 110
    },
111 111
    :hostname => {
112 112
        :name => "HOSTNAME",
113 113
        :desc => "Name of the host where the VM was submited",
114 114
        :size => 15,
115
        :proc => lambda {|d,e| d["host_name"] }
115
        :proc => lambda {|d,e| d["HOST_NAME"] }
116 116
    },
117 117
    :stime => {
118 118
        :name => "STIME",
119 119
        :desc => "Start time",
120 120
        :size => 14,
121 121
        :proc => lambda {|d,e|
122
            t=Time.at(d["stime"].to_i)
122
            t=Time.at(d["STIME"].to_i)
123 123
            t.strftime("%m/%d %H:%M:%S")
124 124
        }
125 125
    },
......
128 128
        :desc => "End time",
129 129
        :size => 14,
130 130
        :proc => lambda {|d,e|
131
            if d["etime"].to_i==0
131
            if d["ETIME"].to_i==0
132 132
                "--"
133 133
            else
134
                t=Time.at(d["etime"].to_i)
134
                t=Time.at(d["ETIME"].to_i)
135 135
                t.strftime("%m/%d %H:%M:%S")
136 136
            end
137 137
        }
......
141 141
        :desc => "Total time",
142 142
        :size => 11,
143 143
        :proc => lambda {|d,e|
144
            d["time"]
144
            d["TIME"]
145 145
        }
146 146
    },
147 147
    :reason => {
......
149 149
        :desc => "Reason for state change",
150 150
        :size => "6",
151 151
        :proc => lambda {|d,e|
152
            OpenNebula::VirtualMachine.get_reason(d["reason"])
152
            OpenNebula::VirtualMachine.get_reason(d["REASON"])
153 153
        }
154 154
    },
155 155

  
......
234 234
    def get_vm_history(vm)
235 235
        {
236 236
            'id'        => vm.id,
237
            'seq'       => vm['history/seq'],
238
            'host_name' => vm['history/hostname'],
239
            'stime'     => vm['history/stime'],
240
            'etime'     => vm['history/etime'],
237
            'seq'       => vm['HISTORY/SEQ'],
238
            'host_name' => vm['HISTORY/HOSTNAME'],
239
            'stime'     => vm['HISTORY/STIME'],
240
            'etime'     => vm['HISTORY/ETIME'],
241 241
            'time'      => str_running_time(vm),
242
            'reason'    => vm['history/reason']
242
            'reason'    => vm['HISTORY/REASON']
243 243
        }
244 244
    end
245 245

  
......
274 274

  
275 275
    def list_vm_history_array(ids, options=nil)
276 276
        get_vms_history(ids).each {|vm|
277
            puts "History for VM #{vm['id']}"
277
            puts "History for VM #{vm['ID']}"
278 278
            puts
279 279
            list_vm_history(vm, options)
280 280
            puts

Also available in: Unified diff