mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Merge pull request #7958 from wanyaoqi/automated-cherry-pick-of-#7953-upstream-release-3.2
Automated cherry pick of #7953: fix set host image cache properties
This commit is contained in:
@@ -191,8 +191,8 @@ func (l *SLocalImageCache) prepare(ctx context.Context, zone, srcUrl, format str
|
||||
}
|
||||
|
||||
func (l *SLocalImageCache) fetch(ctx context.Context, zone, srcUrl, format string) bool {
|
||||
if (fileutils2.Exists(l.GetPath()) &&
|
||||
l.remoteFile.VerifyIntegrity()) || l.remoteFile.Fetch() {
|
||||
if (fileutils2.Exists(l.GetPath()) && l.remoteFile.VerifyIntegrity()) ||
|
||||
l.remoteFile.Fetch() {
|
||||
if len(l.Manager.GetId()) > 0 {
|
||||
_, err := hostutils.RemoteStoragecacheCacheImage(ctx,
|
||||
l.Manager.GetId(), l.imageId, "ready", l.GetPath())
|
||||
|
||||
@@ -259,7 +259,13 @@ func (r *SRemoteFile) downloadInternal(getData bool, preChksum string) bool {
|
||||
}
|
||||
|
||||
func (r *SRemoteFile) setProperties(header http.Header) {
|
||||
r.chksum = header.Get("X-Image-Meta-Checksum")
|
||||
r.format = header.Get("X-Image-Meta-Disk_format")
|
||||
r.name = header.Get("X-Image-Meta-Name")
|
||||
if chksum := header.Get("X-Image-Meta-Checksum"); len(chksum) > 0 {
|
||||
r.chksum = chksum
|
||||
}
|
||||
if format := header.Get("X-Image-Meta-Disk_format"); len(format) > 0 {
|
||||
r.format = format
|
||||
}
|
||||
if name := header.Get("X-Image-Meta-Name"); len(name) > 0 {
|
||||
r.name = name
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user