mirror of
https://github.com/rancher/plugins.git
synced 2025-09-04 12:32:08 +00:00
Windows: Updates Windows Vendoring
Updates windows dependent libraries for vendoing.
This commit is contained in:
46
vendor/github.com/Microsoft/hcsshim/internal/lcow/tar2vhd.go
generated
vendored
Normal file
46
vendor/github.com/Microsoft/hcsshim/internal/lcow/tar2vhd.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
package lcow
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/Microsoft/hcsshim/internal/uvm"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// TarToVhd streams a tarstream contained in an io.Reader to a fixed vhd file
|
||||
func TarToVhd(lcowUVM *uvm.UtilityVM, targetVHDFile string, reader io.Reader) (int64, error) {
|
||||
logrus.Debugf("hcsshim: TarToVhd: %s", targetVHDFile)
|
||||
|
||||
if lcowUVM == nil {
|
||||
return 0, fmt.Errorf("no utility VM passed")
|
||||
}
|
||||
|
||||
//defer uvm.DebugLCOWGCS()
|
||||
|
||||
outFile, err := os.Create(targetVHDFile)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("tar2vhd failed to create %s: %s", targetVHDFile, err)
|
||||
}
|
||||
defer outFile.Close()
|
||||
// BUGBUG Delete the file on failure
|
||||
|
||||
tar2vhd, byteCounts, err := CreateProcess(&ProcessOptions{
|
||||
HCSSystem: lcowUVM.ComputeSystem(),
|
||||
Process: &specs.Process{Args: []string{"tar2vhd"}},
|
||||
CreateInUtilityVm: true,
|
||||
Stdin: reader,
|
||||
Stdout: outFile,
|
||||
CopyTimeout: 2 * time.Minute,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to start tar2vhd for %s: %s", targetVHDFile, err)
|
||||
}
|
||||
defer tar2vhd.Close()
|
||||
|
||||
logrus.Debugf("hcsshim: TarToVhd: %s created, %d bytes", targetVHDFile, byteCounts.Out)
|
||||
return byteCounts.Out, err
|
||||
}
|
Reference in New Issue
Block a user