-
Notifications
You must be signed in to change notification settings - Fork 187
testiso: Support pxe-install test on aarch64 #1700
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
Merged
openshift-merge-robot
merged 2 commits into
coreos:master
from
Prashanth684:aarch64-tests
Sep 8, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // Copyright 2020 Red Hat, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| // The Qemu Machine Protocol - to remotely query and operate a qemu instance (https://wiki.qemu.org/Documentation/QMP) | ||
|
|
||
| package platform | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "fmt" | ||
| "path/filepath" | ||
| "time" | ||
|
|
||
| "github.com/coreos/mantle/util" | ||
| "github.com/pkg/errors" | ||
|
|
||
| "github.com/digitalocean/go-qemu/qmp" | ||
| ) | ||
|
|
||
| type QOMDev struct { | ||
| Return []struct { | ||
| Name string `json:"name"` | ||
| Type string `json:"type"` | ||
| } `json:"return"` | ||
| } | ||
|
|
||
| // Create a new QMP socket connection | ||
| func newQMPMonitor(sockaddr string) (*qmp.SocketMonitor, error) { | ||
| qmpPath := filepath.Join(sockaddr, "qmp.sock") | ||
| var monitor *qmp.SocketMonitor | ||
| var err error | ||
| if err := util.Retry(10, 1*time.Second, func() error { | ||
| monitor, err = qmp.NewSocketMonitor("unix", qmpPath, 2*time.Second) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }); err != nil { | ||
| return nil, errors.Wrapf(err, "Connecting to qemu monitor") | ||
| } | ||
| return monitor, nil | ||
| } | ||
|
|
||
| // Executes a query which provides the list of devices and their names | ||
| func ListQMPDevices(sockaddr string) (*qmp.SocketMonitor, *QOMDev, error) { | ||
| monitor, err := newQMPMonitor(sockaddr) | ||
| if err != nil { | ||
| return nil, nil, errors.Wrapf(err, "Could not open monitor") | ||
| } | ||
|
|
||
| monitor.Connect() | ||
| listcmd := []byte(`{ "execute": "qom-list", "arguments": { "path": "/machine/peripheral-anon" } }`) | ||
| out, err := monitor.Run(listcmd) | ||
| if err != nil { | ||
| return monitor, nil, errors.Wrapf(err, "Running QMP list command") | ||
| } | ||
|
|
||
| var devs QOMDev | ||
| if err = json.Unmarshal(out, &devs); err != nil { | ||
| return monitor, nil, errors.Wrapf(err, "De-serializing QMP output") | ||
| } | ||
| return monitor, &devs, nil | ||
| } | ||
|
|
||
| // Set the bootindex for the particular device | ||
| func SetBootIndexForDevice(monitor *qmp.SocketMonitor, device string, bootindex int) error { | ||
| cmd := fmt.Sprintf(`{ "execute":"qom-set", "arguments": { "path":"%s", "property":"bootindex", "value":%d } }`, device, bootindex) | ||
| if _, err := monitor.Run([]byte(cmd)); err != nil { | ||
| return errors.Wrapf(err, "Running QMP command") | ||
| } | ||
| return nil | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is completely fine for now though I think the functionality would better live in
metal.go- that's intending to be the abstraction over performing an install, whereastestiso.gois just about testing.Concretely eventually we want
kola run -p pxe-install podman.*andcosa run -p pxe-installwhich would run tests/give you ssh after doing a PXE install, rather than howtestiso.gois hardcoded to just a sanity check.Fine for now though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree. I was going to do some refactoring around this and try to move everything to metal. But - for this particular case, is there a better place in
metal.goto figure out that we have started with the installation process and can switch the boot order?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's totally fine as is, feel free to just add a comment for this and we can do it later. Given the size of change here I'd prefer to get it in than force you into rebasing later etc.
But if you want to take a quick shot at it I think what
metal.goshould do is inject its own Ignition to write to a separate virtio channel, distinct from whattestiso.gois doing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah..ok got it ..yes..i'll try to tackle that separately :) i'll stick with these changes for now and probably move some of the QMP bits to its own package.