Skip to content

Added the flavor conversion code#1

Open
pkumarex wants to merge 11 commits intov3.3.1/developfrom
flavorconvert
Open

Added the flavor conversion code#1
pkumarex wants to merge 11 commits intov3.3.1/developfrom
flavorconvert

Conversation

@pkumarex
Copy link
Copy Markdown
Owner

Included the flavor convert tool in tools repo.

@pkumarex pkumarex requested a review from ddhawal January 28, 2021 17:52

//writing the new flavor part into the local file
data := []byte(finalFlavorPart)
err = ioutil.WriteFile("/opt/newflavorpart.json", data, 0644)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better if we take this as an argument also the signing keys

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the output flavor part file is only a flavor collection not the signed flavor. So, we did not use any signing keys in flavor convert tool. Let us know your comments on this.

}

for _, template := range templates {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unnecessary line breaks throughout


var rules []hvs.PcrRules

if flavorname == flavor.Flavor.Meta.Description.FlavorPart {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible break functionality in methods\functions

github.com/vmware/govmomi v0.22.2
)

replace github.com/intel-secl/intel-secl/v3 => github.com/isteffyx/intel-secl/v3 v3.2.2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3.4?

func main() {
oldFlavorPartFilePath := flag.String("o", "", "old flavor part json file")
versionFlag := flag.Bool("version", false, "Print the current version and exit")
newFlavorPartFilePath := flag.String("n", "", "old flavor part json file")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update to = newflavor part json file

Copy link
Copy Markdown
Collaborator

@kwtj43 kwtj43 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't build this doing...

  • "cd tools/flavor-convert" and then "make" --> "cp: cannot create directory '/opt/hvs-flavortemplates': No such file or directory"
  • "cd tools/flavor-convert" and then "go build main.go" --> ".\main.go:217:20: undefined: OldFlavorPart"

@@ -0,0 +1,26 @@
{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should duplicate the flavor-templates (they will get out of date with the intel-secl repo). Let's just provide the tool/executable and require that the user of the converter to obtain the flavor-templates.

@ddhawal do you agree?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwtj43 Do we need to provide the flavor template in user command line instead of keeping it in the tools/flavor-convert/flavortemplates folder?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwtj43 Agree but as this is just a file, I doubt if we can import it. Variable can be imported.

@isteffyx Could you please check that up?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddhawal I have tried to import flavor template files from intel-secl repo. But I am getting "no such file or directory" error while reading.

github.com/vmware/govmomi v0.22.2
)

replace github.com/intel-secl/intel-secl/v3 => github.com/isteffyx/intel-secl/v3 v3.4.0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tool should work with the latest Steffy's fork?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here in flavor convert tool, we are using flavor template and new flavor part struct from intel-secl repo. But, Since the new flavor part changes are not present in intel-secl master branch, we have pushed the flavor creation/verification changes in our own repo (isteffyx/intel-secl) and replaced the intel-secl path with this repo path in go mod file. Once the flavor creation/verification changes are merged with intel-secl master branch, we will remove this path from go mod file.

@mshamn6x
Copy link
Copy Markdown

mshamn6x commented Mar 23, 2021

I couldn't build this doing...

  • "cd tools/flavor-convert" and then "make" --> "cp: cannot create directory '/opt/hvs-flavortemplates': No such file or directory"
  • "cd tools/flavor-convert" and then "go build main.go" --> ".\main.go:217:20: undefined: OldFlavorPart"

@kwtj43 To build Flavorconvert tool,

cd tools/flavor-convert and then "make all"

VERSION := $(or ${GITTAG}, v0.0.0)

all:
rm -rf /opt/hvs-flavortemplates
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the flavor-gen, don't build things in the user's /opt directory. Put the output of make in a subdir of the project. On Windows...

$ make all
rm -rf /opt/hvs-flavortemplates
cp -r flavortemplates /opt/hvs-flavortemplates
cp: cannot create directory '/opt/hvs-flavortemplates': No such file or directory

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have read the flavor template files from the flavortemplates folder that is the subdirectory of the project.

@isteffyx
Copy link
Copy Markdown
Collaborator

I couldn't build this doing...

  • "cd tools/flavor-convert" and then "make" --> "cp: cannot create directory '/opt/hvs-flavortemplates': No such file or directory"
  • "cd tools/flavor-convert" and then "go build main.go" --> ".\main.go:217:20: undefined: OldFlavorPart"

@kwtj43 To build Flavorconvert tool,

cd tools/flavor-convert and then "make all"

Included the ESXI flavor templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants