Skip to content

Commit

Permalink
Merge pull request #1001 from dcantah/remove-mergemaps-v2
Browse files Browse the repository at this point in the history
Get rid of mergemaps functionality for v2 codepaths
  • Loading branch information
dcantah committed Apr 13, 2021
2 parents c1d3621 + 442a9aa commit d9474d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
8 changes: 2 additions & 6 deletions internal/uvm/create.go
Expand Up @@ -23,9 +23,8 @@ import (

// Options are the set of options passed to Create() to create a utility vm.
type Options struct {
ID string // Identifier for the uvm. Defaults to generated GUID.
Owner string // Specifies the owner. Defaults to executable name.
AdditionHCSDocumentJSON string // Optional additional JSON to merge into the HCS document prior
ID string // Identifier for the uvm. Defaults to generated GUID.
Owner string // Specifies the owner. Defaults to executable name.

// MemorySizeInMB sets the UVM memory. If `0` will default to platform
// default.
Expand Down Expand Up @@ -105,9 +104,7 @@ func verifyCloneUvmCreateOpts(templateOpts, cloneOpts *OptionsWCOW) bool {
// Save the original values of the fields that we want to ignore and replace them with
// the same values as that of the other object. So that we can simply use `==` operator.
templateIDBackup := templateOpts.ID
templateAdditionalJsonBackup := templateOpts.AdditionHCSDocumentJSON
templateOpts.ID = cloneOpts.ID
templateOpts.AdditionHCSDocumentJSON = cloneOpts.AdditionHCSDocumentJSON

// We can't use `==` operator on structs which include slices in them. So compare the
// Layerfolders separately and then directly compare the Options struct.
Expand All @@ -119,7 +116,6 @@ func verifyCloneUvmCreateOpts(templateOpts, cloneOpts *OptionsWCOW) bool {

// set original values
templateOpts.ID = templateIDBackup
templateOpts.AdditionHCSDocumentJSON = templateAdditionalJsonBackup
return result
}

Expand Down
8 changes: 1 addition & 7 deletions internal/uvm/create_lcow.go
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/Microsoft/hcsshim/internal/gcs"
"github.com/Microsoft/hcsshim/internal/log"
"github.com/Microsoft/hcsshim/internal/logfields"
"github.com/Microsoft/hcsshim/internal/mergemaps"
"github.com/Microsoft/hcsshim/internal/oc"
"github.com/Microsoft/hcsshim/internal/processorinfo"
hcsschema "github.com/Microsoft/hcsshim/internal/schema2"
Expand Down Expand Up @@ -377,12 +376,7 @@ func CreateLCOW(ctx context.Context, opts *OptionsLCOW) (_ *UtilityVM, err error
}
}

fullDoc, err := mergemaps.MergeJSON(doc, ([]byte)(opts.AdditionHCSDocumentJSON))
if err != nil {
return nil, fmt.Errorf("failed to merge additional JSON '%s': %s", opts.AdditionHCSDocumentJSON, err)
}

err = uvm.create(ctx, fullDoc)
err = uvm.create(ctx, doc)
if err != nil {
return nil, fmt.Errorf("error while creating the compute system: %s", err)
}
Expand Down
8 changes: 1 addition & 7 deletions internal/uvm/create_wcow.go
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/Microsoft/hcsshim/internal/gcs"
"github.com/Microsoft/hcsshim/internal/log"
"github.com/Microsoft/hcsshim/internal/logfields"
"github.com/Microsoft/hcsshim/internal/mergemaps"
"github.com/Microsoft/hcsshim/internal/ncproxyttrpc"
"github.com/Microsoft/hcsshim/internal/oc"
"github.com/Microsoft/hcsshim/internal/processorinfo"
Expand Down Expand Up @@ -315,12 +314,7 @@ func CreateWCOW(ctx context.Context, opts *OptionsWCOW) (_ *UtilityVM, err error
uvm.IsTemplate = true
}

fullDoc, err := mergemaps.MergeJSON(doc, ([]byte)(opts.AdditionHCSDocumentJSON))
if err != nil {
return nil, fmt.Errorf("failed to merge additional JSON '%s': %s", opts.AdditionHCSDocumentJSON, err)
}

err = uvm.create(ctx, fullDoc)
err = uvm.create(ctx, doc)
if err != nil {
return nil, fmt.Errorf("error while creating the compute system: %s", err)
}
Expand Down

0 comments on commit d9474d2

Please sign in to comment.