[ovirt-devel] where vm obeject be deleted from vmContainer when shutdown

zhangjian2011 zhangjian2011 at cn.fujitsu.com
Thu Dec 11 09:58:22 UTC 2014


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 at cn.fujitsu.com
--------------------------------------------------




More information about the Devel mailing list