fix(glance): image can't removed when size is 0

This commit is contained in:
Zexi Li
2021-04-21 20:59:08 +08:00
parent 0a72fc6fe4
commit 61f06ee3ca
+4 -1
View File
@@ -1171,9 +1171,12 @@ func (self *SImage) Remove() error {
for i := 0; i < len(subimgs); i += 1 {
err := subimgs[i].RemoveFiles()
if err != nil {
return err
return errors.Wrapf(err, "remove subimg %s", subimgs[i].GetName())
}
}
if self.Location == "" {
return nil
}
if strings.HasPrefix(self.Location, LocalFilePrefix) {
return self.RemoveFile()
} else {