Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Support for virtio-blk-ccw #99

Merged
merged 3 commits into from
Jul 5, 2019

Conversation

alicefr
Copy link
Member

@alicefr alicefr commented Jul 4, 2019

The PR adds the devno parameters and the virtio-blk-ccw support.

Fixes: #98

@alicefr alicefr changed the title Devno blk ccw Support for virtio-blk-ccw Jul 4, 2019
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 79.687% when pulling 120c0ea on alicefr:devno-blk-ccw into 9f389cb on intel:master.

@coveralls
Copy link

coveralls commented Jul 4, 2019

Coverage Status

Coverage decreased (-0.8%) to 79.652% when pulling 713d0d9 on alicefr:devno-blk-ccw into 9f389cb on intel:master.

@@ -1023,13 +1033,13 @@ func (q *QMP) ExecuteNetPCIDeviceAdd(ctx context.Context, netdevID, devID, macAd
// using the device_add command. devID is the id of the device to add.
// Must be valid QMP identifier. netdevID is the id of nic added by previous netdev_add.
// queues is the number of queues of a nic.
func (q *QMP) ExecuteNetCCWDeviceAdd(ctx context.Context, netdevID, devID, macAddr, addr, bus string, queues int) error {
func (q *QMP) ExecuteNetCCWDeviceAdd(ctx context.Context, netdevID, devID, macAddr, bus string, queues int) error {
Copy link

Choose a reason for hiding this comment

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

In general l g t m, @markdryan what do you think about this change ^^ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@devimc addr is the PCI address. For CCW devices we don't have it. The devno param is identifying the device

Copy link
Contributor

@markdryan markdryan left a comment

Choose a reason for hiding this comment

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

A couple of questions

}

// isVirtioCCW returns if the device is a ccw device
func isVirtioCCW(device DeviceDriver) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of this function? There's nothing wrong with it but it is inconistent with the way the checks are handled for the pci driver, where we check the map directly, e.g.,

	if isVirtioPCI[fsdev.Driver] {
		deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", fsdev.ROMFile))			deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", fsdev.ROMFile))
	}		}
	if isVirtioCCW(fsdev.Driver) {

whichlooks a little weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

The purpose of the function is to return false on not-s390x arch. It was a little bit smaller than having a mapping as for isVirtioPCI, but if you prefer for consistency, I can create a mapping in qemu_arch_base.go with false for all the devices.

Copy link
Member Author

Choose a reason for hiding this comment

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

The function identifies the devices that needs the devno parm

Copy link
Contributor

Choose a reason for hiding this comment

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

My Go's a little rusty these days but couldn't you achieve the same by doing

var isVirtioCCW = map[DeviceDriver]bool{}

in qemu_arch_base.go?

Copy link
Contributor

Choose a reason for hiding this comment

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

which would be even smaller

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, no problem. I'm going to update the code accordingly

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the function to map

args := map[string]interface{}{
"id": devID,
"driver": VirtioNetCCW,
"netdev": netdevID,
"mac": macAddr,
"addr": addr,
"devno": bus,
Copy link
Contributor

Choose a reason for hiding this comment

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

What was addr used for previously? Was this only used by s390?

Copy link
Member Author

Choose a reason for hiding this comment

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

See the previous comment. It was not used

Copy link
Contributor

Choose a reason for hiding this comment

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

I see and this is a s390 specific function so I guess we should be okay.

Alice Frosi added 3 commits July 5, 2019 08:08
DevNo is used to identify the ccw device for s390x systems

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
Add test with devno param

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
In order to hotplug virtio-blk, on s390x the CCW device drivers is used
instad of PCI.

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

s390x: add support for virtio-ccw
4 participants