feat(host): create disk from encrypted snapshot (#14256)

support create disk from encrypted snapshot, new disk encrypt info must
same with snapshot, and should used with libqemuio2.12.

area: host,host-image,fetcherfs
Signed-off-by: wanyaoqi <wanyaoqi1995@163.com>
This commit is contained in:
wanyaoqi
2022-05-16 00:34:37 +08:00
committed by GitHub
parent 68b517b1ab
commit 913aec9f7f
7 changed files with 158 additions and 35 deletions
+7 -1
View File
@@ -63,7 +63,7 @@ func initFetcherFs() (*FetcherFs, error) {
url: opt.Url,
}
if err := fetcherFs.fetchMetaInfo(); err != nil {
return nil, err
return nil, errors.Wrapf(err, "fetch meta info")
}
segs := strings.Split(opt.Url, "/")
if len(segs[len(segs)-1]) == 0 {
@@ -271,5 +271,11 @@ func (fs *FetcherFs) destory() error {
func NewRequestHeader() http.Header {
header := http.Header{}
header.Set("X-Auth-Token", opt.Token)
if len(opt.EncryptKey) > 0 {
header.Set("X-Encrypt-Key", opt.EncryptKey)
}
if len(opt.EncryptAlg) > 0 {
header.Set("X-Encrypt-Alg", opt.EncryptAlg)
}
return header
}
+4
View File
@@ -31,6 +31,10 @@ type Options struct {
MountPoint string `help:"mount path of fuse fs" required:"true"`
Debug bool `help:"enable debug go fuse"`
Foreground bool `help:"run in foreground"`
// image encrypt info
EncryptAlg string `help:"image encrypt alg"`
EncryptKey string `help:"image encrypt password"`
}
var opt = &Options{}