Skip to content

Commit

Permalink
qga/commands-posix: Send CCW address on s390x with the fsinfo data
Browse files Browse the repository at this point in the history
We need the CCW address on the libvirt side to correctly identify
the disk, so add this information to the GuestDiskAddress on s390x.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Michael Roth <michael.roth@amd.com>
Message-Id: <20201127082353.448251-1-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
  • Loading branch information
huth authored and cohuck committed Dec 21, 2020
1 parent 99eaf13 commit 5b723a5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
34 changes: 34 additions & 0 deletions qga/commands-posix.c
Expand Up @@ -1029,6 +1029,38 @@ static bool build_guest_fsinfo_for_nonpci_virtio(char const *syspath,
return true;
}

/*
* Store disk device info for CCW devices (s390x channel I/O devices).
* Returns true if information has been stored, or false for failure.
*/
static bool build_guest_fsinfo_for_ccw_dev(char const *syspath,
GuestDiskAddress *disk,
Error **errp)
{
unsigned int cssid, ssid, subchno, devno;
char *p;

p = strstr(syspath, "/devices/css");
if (!p || sscanf(p + 12, "%*x/%x.%x.%x/%*x.%*x.%x/",
&cssid, &ssid, &subchno, &devno) < 4) {
g_debug("could not parse ccw device sysfs path: %s", syspath);
return false;
}

disk->has_ccw_address = true;
disk->ccw_address = g_new0(GuestCCWAddress, 1);
disk->ccw_address->cssid = cssid;
disk->ccw_address->ssid = ssid;
disk->ccw_address->subchno = subchno;
disk->ccw_address->devno = devno;

if (strstr(p, "/virtio")) {
build_guest_fsinfo_for_nonpci_virtio(syspath, disk, errp);
}

return true;
}

/* Store disk device info specified by @sysfs into @fs */
static void build_guest_fsinfo_for_real_device(char const *syspath,
GuestFilesystemInfo *fs,
Expand Down Expand Up @@ -1081,6 +1113,8 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,

if (strstr(syspath, "/devices/pci")) {
has_hwinf = build_guest_fsinfo_for_pci_dev(syspath, disk, errp);
} else if (strstr(syspath, "/devices/css")) {
has_hwinf = build_guest_fsinfo_for_ccw_dev(syspath, disk, errp);
} else if (strstr(syspath, "/virtio")) {
has_hwinf = build_guest_fsinfo_for_nonpci_virtio(syspath, disk, errp);
} else {
Expand Down
20 changes: 19 additions & 1 deletion qga/qapi-schema.json
Expand Up @@ -846,6 +846,22 @@
'data': {'domain': 'int', 'bus': 'int',
'slot': 'int', 'function': 'int'} }

##
# @GuestCCWAddress:
#
# @cssid: channel subsystem image id
# @ssid: subchannel set id
# @subchno: subchannel number
# @devno: device number
#
# Since: 6.0
##
{ 'struct': 'GuestCCWAddress',
'data': {'cssid': 'int',
'ssid': 'int',
'subchno': 'int',
'devno': 'int'} }

##
# @GuestDiskAddress:
#
Expand All @@ -856,14 +872,16 @@
# @unit: unit id
# @serial: serial number (since: 3.1)
# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
# @ccw-address: CCW address on s390x (since: 6.0)
#
# Since: 2.2
##
{ 'struct': 'GuestDiskAddress',
'data': {'pci-controller': 'GuestPCIAddress',
'bus-type': 'GuestDiskBusType',
'bus': 'int', 'target': 'int', 'unit': 'int',
'*serial': 'str', '*dev': 'str'} }
'*serial': 'str', '*dev': 'str',
'*ccw-address': 'GuestCCWAddress'} }

##
# @GuestDiskInfo:
Expand Down

0 comments on commit 5b723a5

Please sign in to comment.