Fibre Channel¶
Fibre Channel HBA and remote port management via sysfs
(/sys/class/fc_host/, /sys/class/fc_remote_ports/).
sts.fc
¶
Fibre Channel device management.
Handles FC/FCoE host discovery, WWN handling, remote port management, and transport type detection via sysfs.
FcDevice
pydantic-model
¶
Bases: ScsiDevice
Fibre Channel device representation.
Note
Construction performs no I/O. Call discover() to populate
attributes that require system access (sysfs, subprocess calls).
Example
device = FcDevice(name='sda').discover() # Discovers other values
device = FcDevice(wwn='10:00:5c:b9:01:c1:ec:71').discover() # Discovers device from WWN
Show JSON schema:
{
"additionalProperties": false,
"description": "Fibre Channel device representation.\n\nNote:\n Construction performs no I/O. Call `discover()` to populate\n attributes that require system access (sysfs, subprocess calls).\n\nExample:\n ```python\n device = FcDevice(name='sda').discover() # Discovers other values\n device = FcDevice(wwn='10:00:5c:b9:01:c1:ec:71').discover() # Discovers device from WWN\n ```",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"scsi_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Scsi Id"
},
"host_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Host Id"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"transport_type": {
"anyOf": [
{
"enum": [
"FC",
"FCoE"
],
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Transport Type"
}
},
"title": "FcDevice",
"type": "object"
}
Fields:
-
name(str | None) -
path(PathOrStr | None) -
size(int | None) -
model(str | None) -
scsi_id(str | None) -
host_id(str | None) -
wwn(str | None) -
transport_type(TransportType | None)
Validators:
-
_derive_fields
Source code in sts_libs/src/sts/fc.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
remote_ports
property
¶
FC remote ports connected to this host (format: rport-H:B-R).
discover()
¶
Discover FC device attributes from the system.
Populates fields that require I/O (lsscsi, sysfs) which the constructor no longer performs eagerly: 1. SCSI attributes, including host_id, via ScsiDevice.discover() 2. WWN from host information 3. Transport type from host
Raises:
| Type | Description |
|---|---|
DeviceError
|
If discovered WWN format is invalid |
Source code in sts_libs/src/sts/fc.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
get_all()
classmethod
¶
Discover all FC devices by enumerating hosts and their targets.
Source code in sts_libs/src/sts/fc.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
get_host_transport_type(host_id)
classmethod
¶
Determine FC vs FCoE via model name, symbolic name, or driver.
Source code in sts_libs/src/sts/fc.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
get_host_wwn(host_id)
classmethod
¶
Get standardized WWN for an FC host from sysfs.
Source code in sts_libs/src/sts/fc.py
163 164 165 166 167 168 169 | |
get_hosts()
classmethod
¶
Get list of FC host IDs from sysfs.
Source code in sts_libs/src/sts/fc.py
155 156 157 158 159 160 161 | |
get_remote_port_param(port, param)
¶
Get remote port sysfs parameter (e.g. dev_loss_tmo, port_state).
Source code in sts_libs/src/sts/fc.py
143 144 145 146 147 148 | |
get_remote_port_wwn(port)
¶
Get standardized WWN of a remote port from sysfs.
Source code in sts_libs/src/sts/fc.py
136 137 138 139 140 141 | |
is_valid_wwn(wwn)
staticmethod
¶
Check if WWN is valid (8 colon-separated hex pairs).
Source code in sts_libs/src/sts/fc.py
99 100 101 102 | |
set_remote_port_param(port, param, value)
¶
Set remote port sysfs parameter.
Source code in sts_libs/src/sts/fc.py
150 151 152 153 | |
standardize_wwn(wwn)
staticmethod
¶
Standardize WWN to lowercase colon-separated format, or None if invalid.
Handles 0x prefixes, missing colons, and mixed case.
Example
FcDevice.standardize_wwn('500A0981894B8DC5')
'50:0a:09:81:89:4b:8d:c5'
Source code in sts_libs/src/sts/fc.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |