summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/wclayer
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-06-24 21:29:31 +0200
committerValentin Rothberg <rothberg@redhat.com>2019-06-24 21:29:31 +0200
commit2388222e98462fdbbe44f3e091b2b79d80956a9a (patch)
tree17078d861c20a3e48b19c750c6864c5f59248386 /vendor/github.com/Microsoft/hcsshim/internal/wclayer
parenta1a4a75abee2c381483a218e1660621ee416ef7c (diff)
downloadpodman-2388222e98462fdbbe44f3e091b2b79d80956a9a.tar.gz
podman-2388222e98462fdbbe44f3e091b2b79d80956a9a.tar.bz2
podman-2388222e98462fdbbe44f3e091b2b79d80956a9a.zip
update dependencies
Ran a `go get -u` and bumped K8s deps to 1.15.0. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/wclayer')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go25
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go26
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go23
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go25
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go25
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go26
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go24
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go33
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go19
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go28
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go24
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go26
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go4
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go20
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go23
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go25
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go91
17 files changed, 314 insertions, 153 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
index 3a0d4bc58..dcb919268 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
@@ -9,17 +9,24 @@ import (
// For a read/write layer, the mounted filesystem will appear as a volume on the
// host, while a read-only layer is generally expected to be a no-op.
// An activated layer must later be deactivated via DeactivateLayer.
-func ActivateLayer(path string) error {
- title := "hcsshim::ActivateLayer "
- logrus.Debugf(title+"path %s", path)
+func ActivateLayer(path string) (err error) {
+ title := "hcsshim::ActivateLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := activateLayer(&stdDriverInfo, path)
+ err = activateLayer(&stdDriverInfo, path)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+" - succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
index d15817730..be2bc3fd6 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
@@ -7,17 +7,25 @@ import (
// CreateLayer creates a new, empty, read-only layer on the filesystem based on
// the parent layer provided.
-func CreateLayer(path, parent string) error {
- title := "hcsshim::CreateLayer "
- logrus.Debugf(title+"ID %s parent %s", path, parent)
+func CreateLayer(path, parent string) (err error) {
+ title := "hcsshim::CreateLayer"
+ fields := logrus.Fields{
+ "parent": parent,
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := createLayer(&stdDriverInfo, path, parent)
+ err = createLayer(&stdDriverInfo, path, parent)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s parent=%s", path, parent)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"- succeeded path=%s parent=%s", path, parent)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
index bf2fece19..7e3351289 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
@@ -9,9 +9,20 @@ import (
// This requires both the id of the direct parent layer, as well as the full list
// of paths to all parent layers up to the base (and including the direct parent
// whose id was provided).
-func CreateScratchLayer(path string, parentLayerPaths []string) error {
- title := "hcsshim::CreateScratchLayer "
- logrus.Debugf(title+"path %s", path)
+func CreateScratchLayer(path string, parentLayerPaths []string) (err error) {
+ title := "hcsshim::CreateScratchLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
// Generate layer descriptors
layers, err := layerPathsToDescriptors(parentLayerPaths)
@@ -21,11 +32,7 @@ func CreateScratchLayer(path string, parentLayerPaths []string) error {
err = createSandboxLayer(&stdDriverInfo, path, 0, layers)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"- succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
index b998f8a19..2dd5d5715 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
@@ -6,17 +6,24 @@ import (
)
// DeactivateLayer will dismount a layer that was mounted via ActivateLayer.
-func DeactivateLayer(path string) error {
- title := "hcsshim::DeactivateLayer "
- logrus.Debugf(title+"path %s", path)
+func DeactivateLayer(path string) (err error) {
+ title := "hcsshim::DeactivateLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := deactivateLayer(&stdDriverInfo, path)
+ err = deactivateLayer(&stdDriverInfo, path)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+"- failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
index dc14cecc4..4da690c20 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
@@ -7,17 +7,24 @@ import (
// DestroyLayer will remove the on-disk files representing the layer with the given
// path, including that layer's containing folder, if any.
-func DestroyLayer(path string) error {
- title := "hcsshim::DestroyLayer "
- logrus.Debugf(title+"path %s", path)
+func DestroyLayer(path string) (err error) {
+ title := "hcsshim::DestroyLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := destroyLayer(&stdDriverInfo, path)
+ err = destroyLayer(&stdDriverInfo, path)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
index 7832bb452..651676fb2 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
@@ -6,17 +6,25 @@ import (
)
// ExpandScratchSize expands the size of a layer to at least size bytes.
-func ExpandScratchSize(path string, size uint64) error {
- title := "hcsshim::ExpandScratchSize "
- logrus.Debugf(title+"path=%s size=%d", path, size)
+func ExpandScratchSize(path string, size uint64) (err error) {
+ title := "hcsshim::ExpandScratchSize"
+ fields := logrus.Fields{
+ "path": path,
+ "size": size,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := expandSandboxSize(&stdDriverInfo, path, size)
+ err = expandSandboxSize(&stdDriverInfo, path, size)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s size=%d", path, size)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"- succeeded path=%s size=%d", path, size)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
index d43e941ee..0425b3395 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
@@ -14,9 +14,21 @@ import (
// format includes any metadata required for later importing the layer (using
// ImportLayer), and requires the full list of parent layer paths in order to
// perform the export.
-func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) error {
- title := "hcsshim::ExportLayer "
- logrus.Debugf(title+"path %s folder %s", path, exportFolderPath)
+func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) (err error) {
+ title := "hcsshim::ExportLayer"
+ fields := logrus.Fields{
+ "path": path,
+ "exportFolderPath": exportFolderPath,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
// Generate layer descriptors
layers, err := layerPathsToDescriptors(parentLayerPaths)
@@ -26,12 +38,8 @@ func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string
err = exportLayer(&stdDriverInfo, path, exportFolderPath, layers)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s folder=%s", path, exportFolderPath)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s folder=%s", path, exportFolderPath)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
index 8c37549a0..d60b6ed53 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
@@ -11,20 +11,29 @@ import (
// the path at which that layer can be accessed. This path may be a volume path
// if the layer is a mounted read-write layer, otherwise it is expected to be the
// folder path at which the layer is stored.
-func GetLayerMountPath(path string) (string, error) {
- title := "hcsshim::GetLayerMountPath "
- logrus.Debugf(title+"path %s", path)
+func GetLayerMountPath(path string) (_ string, err error) {
+ title := "hcsshim::GetLayerMountPath"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
var mountPathLength uintptr
mountPathLength = 0
// Call the procedure itself.
- logrus.Debugf("Calling proc (1)")
- err := getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
+ logrus.WithFields(fields).Debug("Calling proc (1)")
+ err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
if err != nil {
- err = hcserror.Errorf(err, title, "(first call) path=%s", path)
- logrus.Error(err)
- return "", err
+ return "", hcserror.New(err, title+" - failed", "(first call)")
}
// Allocate a mount path of the returned length.
@@ -35,15 +44,13 @@ func GetLayerMountPath(path string) (string, error) {
mountPathp[0] = 0
// Call the procedure again
- logrus.Debugf("Calling proc (2)")
+ logrus.WithFields(fields).Debug("Calling proc (2)")
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0])
if err != nil {
- err = hcserror.Errorf(err, title, "(second call) path=%s", path)
- logrus.Error(err)
- return "", err
+ return "", hcserror.New(err, title+" - failed", "(second call)")
}
mountPath := syscall.UTF16ToString(mountPathp[0:])
- logrus.Debugf(title+"succeeded path=%s mountPath=%s", path, mountPath)
+ fields["mountPath"] = mountPath
return mountPath, nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
index 10899c68a..dbd83ef2b 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
@@ -10,17 +10,20 @@ import (
// image store and return descriptive info about those images for the purpose
// of registering them with the graphdriver, graph, and tagstore.
func GetSharedBaseImages() (imageData string, err error) {
- title := "hcsshim::GetSharedBaseImages "
+ title := "hcsshim::GetSharedBaseImages"
+ logrus.Debug(title)
+ defer func() {
+ if err != nil {
+ logrus.WithError(err).Error(err)
+ } else {
+ logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
+ }
+ }()
- logrus.Debugf("Calling proc")
var buffer *uint16
err = getBaseImages(&buffer)
if err != nil {
- err = hcserror.New(err, title, "")
- logrus.Error(err)
- return
+ return "", hcserror.New(err, title+" - failed", "")
}
- imageData = interop.ConvertAndFreeCoTaskMemString(buffer)
- logrus.Debugf(title+" - succeeded output=%s", imageData)
- return
+ return interop.ConvertAndFreeCoTaskMemString(buffer), nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
index d86e67827..05735df6c 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
@@ -1,24 +1,30 @@
package wclayer
import (
- "fmt"
-
"github.com/Microsoft/hcsshim/internal/hcserror"
"github.com/sirupsen/logrus"
)
// GrantVmAccess adds access to a file for a given VM
-func GrantVmAccess(vmid string, filepath string) error {
- title := fmt.Sprintf("hcsshim::GrantVmAccess id:%s path:%s ", vmid, filepath)
- logrus.Debugf(title)
+func GrantVmAccess(vmid string, filepath string) (err error) {
+ title := "hcsshim::GrantVmAccess"
+ fields := logrus.Fields{
+ "vm-id": vmid,
+ "path": filepath,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := grantVmAccess(vmid, filepath)
+ err = grantVmAccess(vmid, filepath)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", filepath)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title + " - succeeded")
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
index 486d55470..76a804f2a 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
@@ -15,9 +15,21 @@ import (
// that into a layer with the id layerId. Note that in order to correctly populate
// the layer and interperet the transport format, all parent layers must already
// be present on the system at the paths provided in parentLayerPaths.
-func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) error {
- title := "hcsshim::ImportLayer "
- logrus.Debugf(title+"path %s folder %s", path, importFolderPath)
+func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
+ title := "hcsshim::ImportLayer"
+ fields := logrus.Fields{
+ "path": path,
+ "importFolderPath": importFolderPath,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
// Generate layer descriptors
layers, err := layerPathsToDescriptors(parentLayerPaths)
@@ -27,12 +39,8 @@ func ImportLayer(path string, importFolderPath string, parentLayerPaths []string
err = importLayer(&stdDriverInfo, path, importFolderPath, layers)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s folder=%s", path, importFolderPath)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s folder=%s", path, importFolderPath)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
index 71287ff8a..258167a57 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
@@ -7,19 +7,27 @@ import (
// LayerExists will return true if a layer with the given id exists and is known
// to the system.
-func LayerExists(path string) (bool, error) {
- title := "hcsshim::LayerExists "
- logrus.Debugf(title+"path %s", path)
+func LayerExists(path string) (_ bool, err error) {
+ title := "hcsshim::LayerExists"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
// Call the procedure itself.
var exists uint32
- err := layerExists(&stdDriverInfo, path, &exists)
+ err = layerExists(&stdDriverInfo, path, &exists)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return false, err
+ return false, hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s exists=%d", path, exists)
+ fields["layer-exists"] = exists != 0
return exists != 0, nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
index a1b8b9882..6d0ae8a07 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
@@ -75,13 +75,13 @@ func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR,
for i := 0; i < len(parentLayerPaths); i++ {
g, err := LayerID(parentLayerPaths[i])
if err != nil {
- logrus.Debugf("Failed to convert name to guid %s", err)
+ logrus.WithError(err).Debug("Failed to convert name to guid")
return nil, err
}
p, err := syscall.UTF16PtrFromString(parentLayerPaths[i])
if err != nil {
- logrus.Debugf("Failed conversion of parentLayerPath to pointer %s", err)
+ logrus.WithError(err).Debug("Failed conversion of parentLayerPath to pointer")
return nil, err
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
index 741994ba4..45a63cf65 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
@@ -10,15 +10,25 @@ import (
// Host Compute Service, ensuring GUIDs generated with the same string are common
// across all clients.
func NameToGuid(name string) (id guid.GUID, err error) {
- title := "hcsshim::NameToGuid "
+ title := "hcsshim::NameToGuid"
+ fields := logrus.Fields{
+ "name": name,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
err = nameToGuid(name, &id)
if err != nil {
- err = hcserror.Errorf(err, title, "name=%s", name)
- logrus.Error(err)
+ err = hcserror.New(err, title+" - failed", "")
return
}
-
- logrus.Debugf(title+"name:%s guid:%s", name, id.String())
+ fields["guid"] = id.String()
return
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
index bd4005dc4..2b65b0186 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
@@ -14,9 +14,20 @@ var prepareLayerLock sync.Mutex
// parent layers, and is necessary in order to view or interact with the layer
// as an actual filesystem (reading and writing files, creating directories, etc).
// Disabling the filter must be done via UnprepareLayer.
-func PrepareLayer(path string, parentLayerPaths []string) error {
- title := "hcsshim::PrepareLayer "
- logrus.Debugf(title+"path %s", path)
+func PrepareLayer(path string, parentLayerPaths []string) (err error) {
+ title := "hcsshim::PrepareLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
// Generate layer descriptors
layers, err := layerPathsToDescriptors(parentLayerPaths)
@@ -30,11 +41,7 @@ func PrepareLayer(path string, parentLayerPaths []string) error {
defer prepareLayerLock.Unlock()
err = prepareLayer(&stdDriverInfo, path, layers)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
index 5f1b4f4f4..bccd45969 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
@@ -7,17 +7,24 @@ import (
// UnprepareLayer disables the filesystem filter for the read-write layer with
// the given id.
-func UnprepareLayer(path string) error {
- title := "hcsshim::UnprepareLayer "
- logrus.Debugf(title+"path %s", path)
+func UnprepareLayer(path string) (err error) {
+ title := "hcsshim::UnprepareLayer"
+ fields := logrus.Fields{
+ "path": path,
+ }
+ logrus.WithFields(fields).Debug(title)
+ defer func() {
+ if err != nil {
+ fields[logrus.ErrorKey] = err
+ logrus.WithFields(fields).Error(err)
+ } else {
+ logrus.WithFields(fields).Debug(title + " - succeeded")
+ }
+ }()
- err := unprepareLayer(&stdDriverInfo, path)
+ err = unprepareLayer(&stdDriverInfo, path)
if err != nil {
- err = hcserror.Errorf(err, title, "path=%s", path)
- logrus.Error(err)
- return err
+ return hcserror.New(err, title+" - failed", "")
}
-
- logrus.Debugf(title+"succeeded path=%s", path)
return nil
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go
index 2105703dc..d853ab259 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go
@@ -6,7 +6,6 @@ import (
"syscall"
"unsafe"
- "github.com/Microsoft/hcsshim/internal/interop"
"golang.org/x/sys/windows"
)
@@ -75,7 +74,10 @@ func _activateLayer(info *driverInfo, id *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procActivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -104,7 +106,10 @@ func _copyLayer(info *driverInfo, srcId *uint16, dstId *uint16, descriptors []WC
}
r0, _, _ := syscall.Syscall6(procCopyLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(srcId)), uintptr(unsafe.Pointer(dstId)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -129,7 +134,10 @@ func _createLayer(info *driverInfo, id *uint16, parent *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procCreateLayer.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(parent)))
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -153,7 +161,10 @@ func _createSandboxLayer(info *driverInfo, id *uint16, parent uintptr, descripto
}
r0, _, _ := syscall.Syscall6(procCreateSandboxLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(parent), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -173,7 +184,10 @@ func _expandSandboxSize(info *driverInfo, id *uint16, size uint64) (hr error) {
}
r0, _, _ := syscall.Syscall(procExpandSandboxSize.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(size))
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -193,7 +207,10 @@ func _deactivateLayer(info *driverInfo, id *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procDeactivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -213,7 +230,10 @@ func _destroyLayer(info *driverInfo, id *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procDestroyLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -242,7 +262,10 @@ func _exportLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_L
}
r0, _, _ := syscall.Syscall6(procExportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -262,7 +285,10 @@ func _getLayerMountPath(info *driverInfo, id *uint16, length *uintptr, buffer *u
}
r0, _, _ := syscall.Syscall6(procGetLayerMountPath.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(buffer)), 0, 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -273,7 +299,10 @@ func getBaseImages(buffer **uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procGetBaseImages.Addr(), 1, uintptr(unsafe.Pointer(buffer)), 0, 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -302,7 +331,10 @@ func _importLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_L
}
r0, _, _ := syscall.Syscall6(procImportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -322,7 +354,10 @@ func _layerExists(info *driverInfo, id *uint16, exists *uint32) (hr error) {
}
r0, _, _ := syscall.Syscall(procLayerExists.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(exists)))
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -342,7 +377,10 @@ func _nameToGuid(name *uint16, guid *_guid) (hr error) {
}
r0, _, _ := syscall.Syscall(procNameToGuid.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(guid)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -366,7 +404,10 @@ func _prepareLayer(info *driverInfo, id *uint16, descriptors []WC_LAYER_DESCRIPT
}
r0, _, _ := syscall.Syscall6(procPrepareLayer.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0, 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -386,7 +427,10 @@ func _unprepareLayer(info *driverInfo, id *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procUnprepareLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -406,7 +450,10 @@ func _processBaseImage(path *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procProcessBaseImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -426,7 +473,10 @@ func _processUtilityImage(path *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procProcessUtilityImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}
@@ -451,7 +501,10 @@ func _grantVmAccess(vmid *uint16, filepath *uint16) (hr error) {
}
r0, _, _ := syscall.Syscall(procGrantVmAccess.Addr(), 2, uintptr(unsafe.Pointer(vmid)), uintptr(unsafe.Pointer(filepath)), 0)
if int32(r0) < 0 {
- hr = interop.Win32FromHresult(r0)
+ if r0&0x1fff0000 == 0x00070000 {
+ r0 &= 0xffff
+ }
+ hr = syscall.Errno(r0)
}
return
}