Revision ea876146 src/im/MonitorThread.cc

View differences:

src/im/MonitorThread.cc
184 184

  
185 185
    set<int>        lost;
186 186
    map<int,string> found;
187
    set<int>        found_twice;
187 188

  
188 189
    ostringstream   oss;
189 190

  
......
194 195
        return;
195 196
    }
196 197

  
197
    rc = host->update_info(tmpl, vm_poll, lost, found, non_shared_ds,
198
                reserved_cpu, reserved_mem);
198
    rc = host->update_info(tmpl, vm_poll, lost, found, found_twice,
199
                non_shared_ds, reserved_cpu, reserved_mem);
199 200

  
200 201
    hpool->update(host);
201 202

  
......
252 253

  
253 254
        for (itm = found.begin(); itm != found.end(); itm++)
254 255
        {
255
            VirtualMachineManagerDriver::process_poll(itm->first, itm->second);
256
            VirtualMachine * vm = vmpool->get(itm->first, true);
257

  
258
            if (vm == 0)
259
            {
260
                continue;
261
            }
262

  
263
            // When a VM in poweroff is found again, it may be because of
264
            // outdated poll information. To make sure, we check if VM was
265
            // reported twice
266
            if (vm->get_state() == VirtualMachine::POWEROFF &&
267
                found_twice.count(itm->first) == 0)
268
            {
269
                vm->unlock();
270
                continue;
271
            }
272

  
273
            VirtualMachineManagerDriver::process_poll(vm, itm->second);
274

  
275
            vm->unlock();
256 276
        }
257 277
    }
258 278
};

Also available in: Unified diff