From 8c8b846ed4dbac8ecdcafc6c8781c2409300f61d Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Mar 2023 10:18:30 +0800 Subject: [PATCH 1/2] * modify the getImageList method in the zahost model, fix bug #32867. --- module/zahost/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zahost/model.php b/module/zahost/model.php index 8244095ee8..3aa0029f42 100644 --- a/module/zahost/model.php +++ b/module/zahost/model.php @@ -193,7 +193,7 @@ class zahostModel extends model */ public function getImageList($hostID, $browseType = 'all', $param = 0, $orderBy = 'id', $pager = null) { - $imageList = json_decode(file_get_contents($this->config->zahost->imageListUrl)); + $imageList = json_decode(commonModel::http($this->config->zahost->imageListUrl, array(), array())); $downloadedImageList = $this->dao->select('*')->from(TABLE_IMAGE) ->where('host')->eq($hostID) @@ -256,7 +256,7 @@ class zahostModel extends model */ public function createImage($hostID, $imageName) { - $imageList = json_decode(file_get_contents($this->config->zahost->imageListUrl)); + $imageList = json_decode(commonModel::http($this->config->zahost->imageListUrl, array(), array())); $imageData = new stdclass; foreach($imageList as $item) if($item->name == $imageName) $imageData = $item; From 01a2c74a7f3a4ed8726f3b7386571063e7087b2e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Thu, 16 Mar 2023 10:43:14 +0800 Subject: [PATCH 2/2] * Remove snapshot when create failed. --- api/v1/entries/hostsubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1/entries/hostsubmit.php b/api/v1/entries/hostsubmit.php index 9aea53faf2..157d329ac1 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -48,7 +48,7 @@ class hostSubmitEntry extends baseEntry { if(in_array($image->status, array('failed', 'completed'))) $image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed'; } - else if($imageInfo->from == 'snapshot' && $imageInfo->status == 'creating') + else if($imageInfo->from == 'snapshot') { if($image->status == 'failed') {