where vm obeject be deleted from vmContainer when shutdown

Hi, Guys I am studying ovirt, and now I am checking how vdsm manage VM. But now I have a trouble about the process "shutdown VM". I know that when start up a VM, a vm object will be added to the vmContainer. And I think the vm object will be deleted from vmContainer when shutdown/poweroff since the code will check whether the vm object exist in vmContainer when start up VM. --------------------------------- # cat vdsm/API.py def create(self, vmParams): """ Start up a virtual machine. :param vmParams: required and optional VM parameters. :type vmParams: dict """ vmParams['vmId'] = self._UUID try: if vmParams.get('vmId') in self._cif.vmContainer: self.log.warning('vm %s already exists' % vmParams['vmId']) return errCode['exist'] ... snip ... --------------------------------- I found the vm object will be deleted from vmContainer when poweroff. but I did not find where vm obeject be deleted from vmContainer when shutdown. Does someone can help me? --------------------------------- # cat vdsm/virt/vm.py def destroy(self): self.log.debug('destroy Called') response = self.doDestroy() if response['status']['code']: return response # Clean VM from the system self.deleteVm() ... snip ... def deleteVm(self): """ Clean VM from the system """ try: del self.cif.vmContainer[self.conf['vmId']] self.log.debug("Total desktops after destroy of %s is %d", self.conf['vmId'], len(self.cif.vmContainer)) except Exception: self.log.error("Failed to delete VM %s", self.conf['vmId'], exc_info=True) ... snip ... --------------------------------- Regards, Jian -- -------------------------------------------------- Zhang Jian Development Dept.I Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No.6 Wenzhu Road, Nanjing, 210012, China TEL: +86+25-86630566-8526 FUJITSU INTERNAL: 7998-8526 FAX: +86+25-83317685 MAIL: zhangjian2011@cn.fujitsu.com --------------------------------------------------

Hi, ----- Original Message -----
From: "zhangjian2011" <zhangjian2011@cn.fujitsu.com> To: devel@ovirt.org Sent: Thursday, December 11, 2014 10:58:22 AM Subject: [ovirt-devel] where vm obeject be deleted from vmContainer when shutdown
Hi, Guys
I am studying ovirt, and now I am checking how vdsm manage VM. But now I have a trouble about the process "shutdown VM".
I know that when start up a VM, a vm object will be added to the vmContainer. And I think the vm object will be deleted from vmContainer when shutdown/poweroff since the code will check whether the vm object exist in vmContainer when start up VM.
There is one caveat. When The VM is powered off for whatever reason, will be still kept in Down status, to let the oVirt Engine collect the data and make informed decision about how to do next. "How to do next" could be just report to the user or spawn a new VM instance elsewhere, or maybe something else. Up to Engine. Once Engine collected the data, it sends 'destroy' to VDSM, which must now drop the remainings of the VM and free the entry from vmContainer. Bests, -- Francesco Romani RedHat Engineering Virtualization R & D Phone: 8261328 IRC: fromani
participants (2)
-
Francesco Romani
-
zhangjian2011