host: fix rbd storage cache iso image

This commit is contained in:
wanyaoqi
2020-09-10 23:20:29 +08:00
parent 37e36f5a08
commit f59d56e796
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -24,7 +24,6 @@ import (
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/hostman/hostutils"
"yunion.io/x/onecloud/pkg/hostman/options"
"yunion.io/x/onecloud/pkg/hostman/storageman/remotefile"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/util/procutils"
@@ -75,11 +74,11 @@ func (r *SRbdImageCache) Acquire(ctx context.Context, zone, srcUrl, format strin
}
r.imageName = localImageCache.GetName()
if !r.Load() {
log.Debugf("convert local image %s to rbd pool %s", r.imageId, r.Manager.GetPath())
log.Infof("convert local image %s to rbd pool %s", r.imageId, r.Manager.GetPath())
err := procutils.NewRemoteCommandAsFarAsPossible(qemutils.GetQemuImg(),
"convert", "-O", "raw", localImageCache.GetPath(), r.GetPath()).Run()
if err != nil {
log.Errorf("failed to convert image %s", options.HostOptions.ServersPath)
log.Errorf("failed to convert image %s", err)
return false
}
}
@@ -111,7 +111,7 @@ func (c *SRbdImageCacheManager) PrefetchImageCache(ctx context.Context, data int
if err != nil {
return nil, err
}
format := "qcow2"
format, _ := body.GetString("format")
srcUrl, _ := body.GetString("src_url")
zone, _ := body.GetString("zone")