fix(host): rbd save image use /opt/cloud temp dir (#21154)

This commit is contained in:
wanyaoqi
2024-09-04 10:43:32 +08:00
committed by GitHub
parent 5d69bdfbdf
commit f0927f0aba
+9 -2
View File
@@ -532,10 +532,17 @@ func (s *SRbdStorage) saveToGlance(ctx context.Context, imageId, imagePath strin
return err
}
tmpFileDir, err := os.MkdirTemp(options.HostOptions.TempPath, "ceph_save_images")
tmpPath := "/opt/cloud/tmp"
err = os.MkdirAll(tmpPath, 0755)
if err != nil {
log.Errorf("failed mkdir %s", tmpPath)
return errors.Wrap(err, "os.MkdirAll")
}
tmpFileDir, err := os.MkdirTemp(tmpPath, "ceph_save_images")
if err != nil {
log.Errorf("fail to obtain tempFile for ceph save glance image: %s", err)
return errors.Wrap(err, "ioutil.TempDir")
return errors.Wrap(err, "os.MkdirTemp")
}
defer func() {
log.Debugf("clean up temp dir for glance image save %s", tmpFileDir)