Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate "failed" in HCS errors #1139

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hcn/hcnglobals.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func hnsCall(method, path, request string, returnResponse interface{}) error {

err := _hnsCall(method, path, request, &responseBuffer)
if err != nil {
return hcserror.New(err, "hnsCall ", "")
return hcserror.New(err, "hnsCall", "")
}
response := interop.ConvertAndFreeCoTaskMemString(responseBuffer)

Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/activatelayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ActivateLayer(ctx context.Context, path string) (err error) {

err = activateLayer(&stdDriverInfo, path)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/createlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func CreateLayer(ctx context.Context, path, parent string) (err error) {

err = createLayer(&stdDriverInfo, path, parent)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/createscratchlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func CreateScratchLayer(ctx context.Context, path string, parentLayerPaths []str

err = createSandboxLayer(&stdDriverInfo, path, 0, layers)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/destroylayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func DestroyLayer(ctx context.Context, path string) (err error) {

err = destroyLayer(&stdDriverInfo, path)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/expandscratchsize.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ExpandScratchSize(ctx context.Context, path string, size uint64) (err error

err = expandSandboxSize(&stdDriverInfo, path, size)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}

// Manually expand the volume now in order to work around bugs in 19H1 and
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/exportlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ExportLayer(ctx context.Context, path string, exportFolderPath string, pare

err = exportLayer(&stdDriverInfo, path, exportFolderPath, layers)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/wclayer/getlayermountpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetLayerMountPath(ctx context.Context, path string) (_ string, err error) {
log.G(ctx).Debug("Calling proc (1)")
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
if err != nil {
return "", hcserror.New(err, title+" - failed", "(first call)")
return "", hcserror.New(err, title, "(first call)")
}

// Allocate a mount path of the returned length.
Expand All @@ -41,7 +41,7 @@ func GetLayerMountPath(ctx context.Context, path string) (_ string, err error) {
log.G(ctx).Debug("Calling proc (2)")
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0])
if err != nil {
return "", hcserror.New(err, title+" - failed", "(second call)")
return "", hcserror.New(err, title, "(second call)")
}

mountPath := syscall.UTF16ToString(mountPathp[0:])
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/getsharedbaseimages.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
var buffer *uint16
err = getBaseImages(&buffer)
if err != nil {
return "", hcserror.New(err, title+" - failed", "")
return "", hcserror.New(err, title, "")
}
imageData := interop.ConvertAndFreeCoTaskMemString(buffer)
span.AddAttributes(trace.StringAttribute("imageData", imageData))
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/grantvmaccess.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func GrantVmAccess(ctx context.Context, vmid string, filepath string) (err error

err = grantVmAccess(vmid, filepath)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/importlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ImportLayer(ctx context.Context, path string, importFolderPath string, pare

err = importLayer(&stdDriverInfo, path, importFolderPath, layers)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/layerexists.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func LayerExists(ctx context.Context, path string) (_ bool, err error) {
var exists uint32
err = layerExists(&stdDriverInfo, path, &exists)
if err != nil {
return false, hcserror.New(err, title+" - failed", "")
return false, hcserror.New(err, title, "")
}
span.AddAttributes(trace.BoolAttribute("layer-exists", exists != 0))
return exists != 0, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/nametoguid.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NameToGuid(ctx context.Context, name string) (_ guid.GUID, err error) {
var id guid.GUID
err = nameToGuid(name, &id)
if err != nil {
return guid.GUID{}, hcserror.New(err, title+" - failed", "")
return guid.GUID{}, hcserror.New(err, title, "")
}
span.AddAttributes(trace.StringAttribute("guid", id.String()))
return id, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/wclayer/preparelayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func PrepareLayer(ctx context.Context, path string, parentLayerPaths []string) (
defer prepareLayerLock.Unlock()
err = prepareLayer(&stdDriverInfo, path, layers)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}
2 changes: 1 addition & 1 deletion internal/wclayer/unpreparelayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func UnprepareLayer(ctx context.Context, path string) (err error) {

err = unprepareLayer(&stdDriverInfo, path)
if err != nil {
return hcserror.New(err, title+" - failed", "")
return hcserror.New(err, title, "")
}
return nil
}