Merge pull request #666 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-conflict-resolve-2.4.0-20181204 to release/2.4.0

* commit 'f5c98090b2358577b97a556b894838e2f8280a95':
  fix: region delete guest panic when host is nil
This commit is contained in:
邱剑
2018-12-04 23:39:50 +08:00
+1 -1
View File
@@ -26,7 +26,7 @@ func init() {
func (self *GuestDeleteTask) OnInit(ctx context.Context, obj db.IStandaloneModel, data jsonutils.JSONObject) {
guest := obj.(*models.SGuest)
host := guest.GetHost()
if guest.Hypervisor == models.HYPERVISOR_BAREMETAL && host.HostType != models.HOST_TYPE_BAREMETAL {
if guest.Hypervisor == models.HYPERVISOR_BAREMETAL && host != nil && host.HostType != models.HOST_TYPE_BAREMETAL {
// if a fake server for converted hypervisor, then just skip stop
self.OnGuestStopComplete(ctx, obj, data)
return