Skip to content
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
8 changes: 2 additions & 6 deletions internal/uvm/create.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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