Merge pull request #48741 from mtanino/issue/48639

Automatic merge from submit-queue

FC volume plugin: Support WWID for volume identifier

**What this PR does / why we need it**:

This PR adds World Wide Identifier (WWID) parameter to FCVolumeSource as an unique volume identifier.

**Which issue this PR fixes**: fixes #48639 

**Special notes for your reviewer**:

/cc @rootfs @jsafrane @msau42 

**Release note**:

```
FC volume plugin: Support WWID for volume identifier
```
This commit is contained in:
Kubernetes Submit Queue
2017-08-10 17:55:08 -07:00
committed by GitHub
35 changed files with 1449 additions and 956 deletions

View File

@@ -57094,17 +57094,13 @@
},
"io.k8s.api.core.v1.FCVolumeSource": {
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"fsType": {
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"type": "string"
},
"lun": {
"description": "Required: FC target lun number",
"description": "Optional: FC target lun number",
"type": "integer",
"format": "int32"
},
@@ -57113,7 +57109,14 @@
"type": "boolean"
},
"targetWWNs": {
"description": "Required: FC target worldwide names (WWNs)",
"description": "Optional: FC target worldwide names (WWNs)",
"type": "array",
"items": {
"type": "string"
}
},
"wwids": {
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.",
"type": "array",
"items": {
"type": "string"

View File

@@ -4631,22 +4631,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -4655,6 +4651,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -5786,22 +5786,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -5810,6 +5806,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -2213,22 +2213,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -2237,6 +2233,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -2268,22 +2268,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -2292,6 +2288,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -7323,22 +7323,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -7347,6 +7343,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -2031,22 +2031,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -2055,6 +2051,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -19216,22 +19216,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -19240,6 +19236,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -4985,15 +4985,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -5011,6 +5011,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -5244,15 +5244,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -5270,6 +5270,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -4063,15 +4063,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -4089,6 +4089,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -4070,15 +4070,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -4096,6 +4096,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -5710,15 +5710,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -5736,6 +5736,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -1152,15 +1152,15 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -1178,6 +1178,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -6696,15 +6696,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -6722,6 +6722,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -10377,17 +10377,13 @@
},
"io.k8s.api.core.v1.FCVolumeSource": {
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"fsType": {
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"type": "string"
},
"lun": {
"description": "Required: FC target lun number",
"description": "Optional: FC target lun number",
"type": "integer",
"format": "int32"
},
@@ -10396,7 +10392,14 @@
"type": "boolean"
},
"targetWWNs": {
"description": "Required: FC target worldwide names (WWNs)",
"description": "Optional: FC target worldwide names (WWNs)",
"type": "array",
"items": {
"type": "string"
}
},
"wwids": {
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.",
"type": "array",
"items": {
"type": "string"

View File

@@ -5682,22 +5682,18 @@
"v1.FCVolumeSource": {
"id": "v1.FCVolumeSource",
"description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"required": [
"targetWWNs",
"lun"
],
"properties": {
"targetWWNs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Required: FC target worldwide names (WWNs)"
"description": "Optional: FC target worldwide names (WWNs)"
},
"lun": {
"type": "integer",
"format": "int32",
"description": "Required: FC target lun number"
"description": "Optional: FC target lun number"
},
"fsType": {
"type": "string",
@@ -5706,6 +5702,13 @@
"readOnly": {
"type": "boolean",
"description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts."
},
"wwids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously."
}
}
},

View File

@@ -5272,15 +5272,15 @@ Examples:<br>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">targetWWNs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target worldwide names (WWNs)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lun</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC target lun number</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@@ -5298,6 +5298,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">wwids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

View File

@@ -715,9 +715,11 @@ type ISCSIVolumeSource struct {
// Fibre Channel volumes can only be mounted as read/write once.
// Fibre Channel volumes support ownership management and SELinux relabeling.
type FCVolumeSource struct {
// Required: FC target worldwide names (WWNs)
// Optional: FC target worldwide names (WWNs)
// +optional
TargetWWNs []string
// Required: FC target lun number
// Optional: FC target lun number
// +optional
Lun *int32
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
@@ -729,6 +731,10 @@ type FCVolumeSource struct {
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool
// Optional: FC volume World Wide Identifiers (WWIDs)
// Either WWIDs or TargetWWNs and Lun must be set, but not both simultaneously.
// +optional
WWIDs []string
}
// FlexVolume represents a generic volume resource that is

View File

@@ -1596,6 +1596,7 @@ func autoConvert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource,
out.Lun = (*int32)(unsafe.Pointer(in.Lun))
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
out.WWIDs = *(*[]string)(unsafe.Pointer(&in.WWIDs))
return nil
}
@@ -1605,14 +1606,11 @@ func Convert_v1_FCVolumeSource_To_api_FCVolumeSource(in *v1.FCVolumeSource, out
}
func autoConvert_api_FCVolumeSource_To_v1_FCVolumeSource(in *api.FCVolumeSource, out *v1.FCVolumeSource, s conversion.Scope) error {
if in.TargetWWNs == nil {
out.TargetWWNs = make([]string, 0)
} else {
out.TargetWWNs = *(*[]string)(unsafe.Pointer(&in.TargetWWNs))
}
out.TargetWWNs = *(*[]string)(unsafe.Pointer(&in.TargetWWNs))
out.Lun = (*int32)(unsafe.Pointer(in.Lun))
out.FSType = in.FSType
out.ReadOnly = in.ReadOnly
out.WWIDs = *(*[]string)(unsafe.Pointer(&in.WWIDs))
return nil
}

View File

@@ -84,6 +84,7 @@ go_test(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
"//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",

View File

@@ -648,15 +648,21 @@ func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, fldPath *field.Path
func validateFCVolumeSource(fc *api.FCVolumeSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(fc.TargetWWNs) < 1 {
allErrs = append(allErrs, field.Required(fldPath.Child("targetWWNs"), ""))
if len(fc.TargetWWNs) < 1 && len(fc.WWIDs) < 1 {
allErrs = append(allErrs, field.Required(fldPath.Child("targetWWNs"), "must specify either targetWWNs or wwids, but not both"))
}
if fc.Lun == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("lun"), ""))
} else {
if *fc.Lun < 0 || *fc.Lun > 255 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("lun"), fc.Lun, validation.InclusiveRangeError(0, 255)))
if len(fc.TargetWWNs) != 0 && len(fc.WWIDs) != 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetWWNs"), fc.TargetWWNs, "targetWWNs and wwids can not be specified simultaneously"))
}
if len(fc.TargetWWNs) != 0 {
if fc.Lun == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("lun"), "lun is required if targetWWNs is specified"))
} else {
if *fc.Lun < 0 || *fc.Lun > 255 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("lun"), fc.Lun, validation.InclusiveRangeError(0, 255)))
}
}
}
return allErrs

View File

@@ -27,6 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/api"
@@ -2099,7 +2100,7 @@ func TestValidateVolumes(t *testing.T) {
},
// FC
{
name: "valid FC",
name: "FC valid targetWWNs and lun",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
@@ -2113,23 +2114,56 @@ func TestValidateVolumes(t *testing.T) {
},
},
{
name: "fc empty wwn",
name: "FC valid wwids",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
FC: &api.FCVolumeSource{
WWIDs: []string{"some_wwid"},
FSType: "ext4",
ReadOnly: false,
},
},
},
},
{
name: "FC empty targetWWNs and wwids",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
FC: &api.FCVolumeSource{
TargetWWNs: []string{},
Lun: newInt32(1),
WWIDs: []string{},
FSType: "ext4",
ReadOnly: false,
},
},
},
errtype: field.ErrorTypeRequired,
errfield: "fc.targetWWNs",
errtype: field.ErrorTypeRequired,
errfield: "fc.targetWWNs",
errdetail: "must specify either targetWWNs or wwids",
},
{
name: "fc empty lun",
name: "FC invalid: both targetWWNs and wwids simultaneously",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
FC: &api.FCVolumeSource{
TargetWWNs: []string{"some_wwn"},
Lun: newInt32(1),
WWIDs: []string{"some_wwid"},
FSType: "ext4",
ReadOnly: false,
},
},
},
errtype: field.ErrorTypeInvalid,
errfield: "fc.targetWWNs",
errdetail: "targetWWNs and wwids can not be specified simultaneously",
},
{
name: "FC valid targetWWNs and empty lun",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
@@ -2141,8 +2175,26 @@ func TestValidateVolumes(t *testing.T) {
},
},
},
errtype: field.ErrorTypeRequired,
errfield: "fc.lun",
errtype: field.ErrorTypeRequired,
errfield: "fc.lun",
errdetail: "lun is required if targetWWNs is specified",
},
{
name: "FC valid targetWWNs and invalid lun",
vol: api.Volume{
Name: "fc",
VolumeSource: api.VolumeSource{
FC: &api.FCVolumeSource{
TargetWWNs: []string{"wwn"},
Lun: newInt32(256),
FSType: "ext4",
ReadOnly: false,
},
},
},
errtype: field.ErrorTypeInvalid,
errfield: "fc.lun",
errdetail: validation.InclusiveRangeError(0, 255),
},
// FlexVolume
{

View File

@@ -2084,6 +2084,11 @@ func (in *FCVolumeSource) DeepCopyInto(out *FCVolumeSource) {
**out = **in
}
}
if in.WWIDs != nil {
in, out := &in.WWIDs, &out.WWIDs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/golang/glog"
@@ -167,18 +168,27 @@ func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMoun
if err != nil {
return nil, err
}
if fc.Lun == nil {
return nil, fmt.Errorf("empty lun")
var lun string
var wwids []string
if fc.Lun != nil && len(fc.TargetWWNs) != 0 {
lun = strconv.Itoa(int(*fc.Lun))
} else if len(fc.WWIDs) != 0 {
for _, wwid := range fc.WWIDs {
wwids = append(wwids, strings.Replace(wwid, " ", "_", -1))
}
} else {
return nil, fmt.Errorf("fc: no fc disk information found. failed to make a new mounter")
}
lun := strconv.Itoa(int(*fc.Lun))
return &fcDiskMounter{
fcDisk: &fcDisk{
plugin: &fcPlugin{
host: host,
},
wwns: fc.TargetWWNs,
lun: lun,
io: &osIOHandler{},
wwns: fc.TargetWWNs,
lun: lun,
wwids: wwids,
io: &osIOHandler{},
},
fsType: fc.FSType,
readOnly: readOnly,

View File

@@ -19,12 +19,13 @@ package fc
import (
"fmt"
"strconv"
"strings"
"github.com/golang/glog"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings"
utilstrings "k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
@@ -62,8 +63,15 @@ func (plugin *fcPlugin) GetVolumeName(spec *volume.Spec) (string, error) {
return "", err
}
// TargetWWNs are the FibreChannel target worldwide names
return fmt.Sprintf("%v", volumeSource.TargetWWNs), nil
if len(volumeSource.TargetWWNs) != 0 {
// TargetWWNs are the FibreChannel target worldwide names
return fmt.Sprintf("%v", volumeSource.TargetWWNs), nil
} else if len(volumeSource.WWIDs) != 0 {
// WWIDs are the FibreChannel World Wide Identifiers
return fmt.Sprintf("%v", volumeSource.WWIDs), nil
}
return "", err
}
func (plugin *fcPlugin) CanSupport(spec *volume.Spec) bool {
@@ -106,18 +114,25 @@ func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
return nil, err
}
if fc.Lun == nil {
return nil, fmt.Errorf("empty lun")
var lun string
var wwids []string
if fc.Lun != nil && len(fc.TargetWWNs) != 0 {
lun = strconv.Itoa(int(*fc.Lun))
} else if len(fc.WWIDs) != 0 {
for _, wwid := range fc.WWIDs {
wwids = append(wwids, strings.Replace(wwid, " ", "_", -1))
}
} else {
return nil, fmt.Errorf("fc: no fc disk information found. failed to make a new mounter")
}
lun := strconv.Itoa(int(*fc.Lun))
return &fcDiskMounter{
fcDisk: &fcDisk{
podUID: podUID,
volName: spec.Name(),
wwns: fc.TargetWWNs,
lun: lun,
wwids: wwids,
manager: manager,
io: &osIOHandler{},
plugin: plugin},
@@ -166,6 +181,7 @@ type fcDisk struct {
portal string
wwns []string
lun string
wwids []string
plugin *fcPlugin
// Utility interface that provides API calls to the provider to attach/detach disks.
manager diskManager
@@ -177,7 +193,7 @@ type fcDisk struct {
func (fc *fcDisk) GetPath() string {
name := fcPluginName
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
return fc.plugin.host.GetPodVolumeDir(fc.podUID, strings.EscapeQualifiedNameForDisk(name), fc.volName)
return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilstrings.EscapeQualifiedNameForDisk(name), fc.volName)
}
type fcDiskMounter struct {

View File

@@ -193,13 +193,39 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
}
func doTestPluginNilMounter(t *testing.T, spec *volume.Spec) {
tmpDir, err := utiltesting.MkTmpdir("fc_test")
if err != nil {
t.Fatalf("error creating temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
plug, err := plugMgr.FindPluginByName("kubernetes.io/fc")
if err != nil {
t.Errorf("Can't find the plugin by name")
}
fakeManager := NewFakeDiskManager()
defer fakeManager.Cleanup()
fakeMounter := &mount.FakeMounter{}
mounter, err := plug.(*fcPlugin).newMounterInternal(spec, types.UID("poduid"), fakeManager, fakeMounter)
if err == nil {
t.Errorf("Error failed to make a new Mounter is expected: %v", err)
}
if mounter != nil {
t.Errorf("A nil Mounter is expected: %v", err)
}
}
func TestPluginVolume(t *testing.T) {
lun := int32(0)
vol := &v1.Volume{
Name: "vol1",
VolumeSource: v1.VolumeSource{
FC: &v1.FCVolumeSource{
TargetWWNs: []string{"some_wwn"},
TargetWWNs: []string{"500a0981891b8dc5"},
FSType: "ext4",
Lun: &lun,
},
@@ -217,7 +243,7 @@ func TestPluginPersistentVolume(t *testing.T) {
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
FC: &v1.FCVolumeSource{
TargetWWNs: []string{"some_wwn"},
TargetWWNs: []string{"500a0981891b8dc5"},
FSType: "ext4",
Lun: &lun,
},
@@ -227,6 +253,64 @@ func TestPluginPersistentVolume(t *testing.T) {
doTestPlugin(t, volume.NewSpecFromPersistentVolume(vol, false))
}
func TestPluginVolumeWWIDs(t *testing.T) {
vol := &v1.Volume{
Name: "vol1",
VolumeSource: v1.VolumeSource{
FC: &v1.FCVolumeSource{
WWIDs: []string{"3600508b400105e210000900000490000"},
FSType: "ext4",
},
},
}
doTestPlugin(t, volume.NewSpecFromVolume(vol))
}
func TestPluginPersistentVolumeWWIDs(t *testing.T) {
vol := &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: "vol1",
},
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
FC: &v1.FCVolumeSource{
WWIDs: []string{"3600508b400105e21 000900000490000"},
FSType: "ext4",
},
},
},
}
doTestPlugin(t, volume.NewSpecFromPersistentVolume(vol, false))
}
func TestPluginVolumeNoDiskInfo(t *testing.T) {
vol := &v1.Volume{
Name: "vol1",
VolumeSource: v1.VolumeSource{
FC: &v1.FCVolumeSource{
FSType: "ext4",
},
},
}
doTestPluginNilMounter(t, volume.NewSpecFromVolume(vol))
}
func TestPluginPersistentVolumeNoDiskInfo(t *testing.T) {
vol := &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: "vol1",
},
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
FC: &v1.FCVolumeSource{
FSType: "ext4",
},
},
},
}
doTestPluginNilMounter(t, volume.NewSpecFromPersistentVolume(vol, false))
}
func TestPersistentClaimReadOnlyFlag(t *testing.T) {
tmpDir, err := utiltesting.MkTmpdir("fc_test")
if err != nil {

View File

@@ -89,6 +89,40 @@ func findDisk(wwn, lun string, io ioHandler) (string, string) {
return "", ""
}
// given a wwid, find the device and associated devicemapper parent
func findDiskWWIDs(wwid string, io ioHandler) (string, string) {
// Example wwid format:
// 3600508b400105e210000900000490000
// <VENDOR NAME> <IDENTIFIER NUMBER>
// Example of symlink under by-id:
// /dev/by-id/scsi-3600508b400105e210000900000490000
// /dev/by-id/scsi-<VENDOR NAME>_<IDENTIFIER NUMBER>
// The wwid could contain white space and it will be replaced
// underscore when wwid is exposed under /dev/by-id.
fc_path := "scsi-" + wwid
dev_id := "/dev/disk/by-id/"
if dirs, err := io.ReadDir(dev_id); err == nil {
for _, f := range dirs {
name := f.Name()
if name == fc_path {
disk, err := io.EvalSymlinks(dev_id + name)
if err != nil {
glog.V(2).Infof("fc: failed to find a corresponding disk from symlink[%s], error %v", dev_id+name, err)
return "", ""
}
arr := strings.Split(disk, "/")
l := len(arr) - 1
dev := arr[l]
dm := findMultipathDeviceMapper(dev, io)
return disk, dm
}
}
}
glog.V(2).Infof("fc: failed to find a disk [%s]", dev_id+fc_path)
return "", ""
}
// Removes a scsi device based upon /dev/sdX name
func removeFromScsiSubsystem(deviceName string, io ioHandler) {
fileName := "/sys/block/" + deviceName + "/device/delete"
@@ -110,27 +144,46 @@ func scsiHostRescan(io ioHandler) {
}
// make a directory like /var/lib/kubelet/plugins/kubernetes.io/pod/fc/target-lun-0
func makePDNameInternal(host volume.VolumeHost, wwns []string, lun string) string {
return path.Join(host.GetPluginDir(fcPluginName), wwns[0]+"-lun-"+lun)
func makePDNameInternal(host volume.VolumeHost, wwns []string, lun string, wwids []string) string {
if len(wwns) != 0 {
return path.Join(host.GetPluginDir(fcPluginName), wwns[0]+"-lun-"+lun)
} else {
return path.Join(host.GetPluginDir(fcPluginName), wwids[0])
}
}
type FCUtil struct{}
func (util *FCUtil) MakeGlobalPDName(fc fcDisk) string {
return makePDNameInternal(fc.plugin.host, fc.wwns, fc.lun)
return makePDNameInternal(fc.plugin.host, fc.wwns, fc.lun, fc.wwids)
}
func searchDisk(wwns []string, lun string, io ioHandler) (string, string) {
disk := ""
dm := ""
func searchDisk(b fcDiskMounter) (string, string) {
var diskIds []string
var disk string
var dm string
io := b.io
wwids := b.wwids
wwns := b.wwns
lun := b.lun
if len(wwns) != 0 {
diskIds = wwns
} else {
diskIds = wwids
}
rescaned := false
// two-phase search:
// first phase, search existing device path, if a multipath dm is found, exit loop
// otherwise, in second phase, rescan scsi bus and search again, return with any findings
for true {
for _, wwn := range wwns {
disk, dm = findDisk(wwn, lun, io)
for _, diskId := range diskIds {
if len(wwns) != 0 {
disk, dm = findDisk(diskId, lun, io)
} else {
disk, dm = findDiskWWIDs(diskId, io)
}
// if multipath device is found, break
if dm != "" {
break
@@ -150,10 +203,9 @@ func searchDisk(wwns []string, lun string, io ioHandler) (string, string) {
func (util *FCUtil) AttachDisk(b fcDiskMounter) (string, error) {
devicePath := ""
wwns := b.wwns
lun := b.lun
io := b.io
disk, dm := searchDisk(wwns, lun, io)
var disk, dm string
disk, dm = searchDisk(b)
// if no disk matches input wwn and lun, exit
if disk == "" && dm == "" {
return "", fmt.Errorf("no fc disk found")

View File

@@ -63,6 +63,11 @@ func (handler *fakeIOHandler) ReadDir(dirname string) ([]os.FileInfo, error) {
name: "dm-1",
}
return []os.FileInfo{f}, nil
case "/dev/disk/by-id/":
f := &fakeFileInfo{
name: "scsi-3600508b400105e210000900000490000",
}
return []os.FileInfo{f}, nil
}
return nil, nil
}
@@ -79,13 +84,31 @@ func (handler *fakeIOHandler) WriteFile(filename string, data []byte, perm os.Fi
return nil
}
func TestIoHandler(t *testing.T) {
io := &fakeIOHandler{}
wwns := []string{"500a0981891b8dc5"}
lun := "0"
disk, dm := searchDisk(wwns, lun, io)
func TestSearchDisk(t *testing.T) {
fakeMounter := fcDiskMounter{
fcDisk: &fcDisk{
wwns: []string{"500a0981891b8dc5"},
lun: "0",
io: &fakeIOHandler{},
},
}
disk, dm := searchDisk(fakeMounter)
// if no disk matches input wwn and lun, exit
if disk == "" && dm == "" {
t.Errorf("no fc disk found")
}
}
func TestSearchDiskWWID(t *testing.T) {
fakeMounter := fcDiskMounter{
fcDisk: &fcDisk{
wwids: []string{"3600508b400105e210000900000490000"},
io: &fakeIOHandler{},
},
}
disk, dm := searchDisk(fakeMounter)
// if no disk matches input wwid, exit
if disk == "" && dm == "" {
t.Errorf("no fc disk found")
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1014,10 +1014,12 @@ message ExecAction {
// Fibre Channel volumes can only be mounted as read/write once.
// Fibre Channel volumes support ownership management and SELinux relabeling.
message FCVolumeSource {
// Required: FC target worldwide names (WWNs)
// Optional: FC target worldwide names (WWNs)
// +optional
repeated string targetWWNs = 1;
// Required: FC target lun number
// Optional: FC target lun number
// +optional
optional int32 lun = 2;
// Filesystem type to mount.
@@ -1031,6 +1033,11 @@ message FCVolumeSource {
// the ReadOnly setting in VolumeMounts.
// +optional
optional bool readOnly = 4;
// Optional: FC volume world wide identifiers (wwids)
// Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.
// +optional
repeated string wwids = 5;
}
// FlexVolume represents a generic volume resource that is

View File

@@ -17212,16 +17212,19 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [4]bool
var yyq2 [5]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = len(x.TargetWWNs) != 0
yyq2[1] = x.Lun != nil
yyq2[2] = x.FSType != ""
yyq2[3] = x.ReadOnly != false
yyq2[4] = len(x.WWIDs) != 0
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(4)
r.EncodeArrayStart(5)
} else {
yynn2 = 2
yynn2 = 0
for _, b := range yyq2 {
if b {
yynn2++
@@ -17232,57 +17235,69 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.TargetWWNs == nil {
r.EncodeNil()
} else {
yym4 := z.EncBinary()
_ = yym4
if false {
if yyq2[0] {
if x.TargetWWNs == nil {
r.EncodeNil()
} else {
z.F.EncSliceStringV(x.TargetWWNs, false, e)
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
z.F.EncSliceStringV(x.TargetWWNs, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("targetWWNs"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.TargetWWNs == nil {
r.EncodeNil()
} else {
yym5 := z.EncBinary()
_ = yym5
if false {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("targetWWNs"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.TargetWWNs == nil {
r.EncodeNil()
} else {
z.F.EncSliceStringV(x.TargetWWNs, false, e)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
z.F.EncSliceStringV(x.TargetWWNs, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.Lun == nil {
r.EncodeNil()
} else {
yy7 := *x.Lun
yym8 := z.EncBinary()
_ = yym8
if false {
if yyq2[1] {
if x.Lun == nil {
r.EncodeNil()
} else {
r.EncodeInt(int64(yy7))
yy7 := *x.Lun
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
r.EncodeInt(int64(yy7))
}
}
} else {
r.EncodeNil()
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("lun"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Lun == nil {
r.EncodeNil()
} else {
yy9 := *x.Lun
yym10 := z.EncBinary()
_ = yym10
if false {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("lun"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Lun == nil {
r.EncodeNil()
} else {
r.EncodeInt(int64(yy9))
yy9 := *x.Lun
yym10 := z.EncBinary()
_ = yym10
if false {
} else {
r.EncodeInt(int64(yy9))
}
}
}
}
@@ -17336,6 +17351,39 @@ func (x *FCVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
if x.WWIDs == nil {
r.EncodeNil()
} else {
yym18 := z.EncBinary()
_ = yym18
if false {
} else {
z.F.EncSliceStringV(x.WWIDs, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("wwids"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.WWIDs == nil {
r.EncodeNil()
} else {
yym19 := z.EncBinary()
_ = yym19
if false {
} else {
z.F.EncSliceStringV(x.WWIDs, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@@ -17449,6 +17497,18 @@ func (x *FCVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
*((*bool)(yyv10)) = r.DecodeBool()
}
}
case "wwids":
if r.TryDecodeAsNil() {
x.WWIDs = nil
} else {
yyv12 := &x.WWIDs
yym13 := z.DecBinary()
_ = yym13
if false {
} else {
z.F.DecSliceStringX(yyv12, false, d)
}
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@@ -17460,16 +17520,16 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj12 int
var yyb12 bool
var yyhl12 bool = l >= 0
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
var yyj14 int
var yyb14 bool
var yyhl14 bool = l >= 0
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -17477,21 +17537,21 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.TargetWWNs = nil
} else {
yyv13 := &x.TargetWWNs
yym14 := z.DecBinary()
_ = yym14
yyv15 := &x.TargetWWNs
yym16 := z.DecBinary()
_ = yym16
if false {
} else {
z.F.DecSliceStringX(yyv13, false, d)
z.F.DecSliceStringX(yyv15, false, d)
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -17504,20 +17564,20 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if x.Lun == nil {
x.Lun = new(int32)
}
yym16 := z.DecBinary()
_ = yym16
yym18 := z.DecBinary()
_ = yym18
if false {
} else {
*((*int32)(x.Lun)) = int32(r.DecodeInt(32))
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -17525,21 +17585,21 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.FSType = ""
} else {
yyv17 := &x.FSType
yym18 := z.DecBinary()
_ = yym18
yyv19 := &x.FSType
yym20 := z.DecBinary()
_ = yym20
if false {
} else {
*((*string)(yyv17)) = r.DecodeString()
*((*string)(yyv19)) = r.DecodeString()
}
}
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -17547,26 +17607,48 @@ func (x *FCVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.ReadOnly = false
} else {
yyv19 := &x.ReadOnly
yym20 := z.DecBinary()
_ = yym20
yyv21 := &x.ReadOnly
yym22 := z.DecBinary()
_ = yym22
if false {
} else {
*((*bool)(yyv19)) = r.DecodeBool()
*((*bool)(yyv21)) = r.DecodeBool()
}
}
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb14 = r.CheckBreak()
}
if yyb14 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.WWIDs = nil
} else {
yyv23 := &x.WWIDs
yym24 := z.DecBinary()
_ = yym24
if false {
} else {
z.F.DecSliceStringX(yyv23, false, d)
}
}
for {
yyj12++
if yyhl12 {
yyb12 = yyj12 > l
yyj14++
if yyhl14 {
yyb14 = yyj14 > l
} else {
yyb12 = r.CheckBreak()
yyb14 = r.CheckBreak()
}
if yyb12 {
if yyb14 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj12-1, "")
z.DecStructFieldNotFound(yyj14-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}

View File

@@ -1102,10 +1102,12 @@ type ISCSIVolumeSource struct {
// Fibre Channel volumes can only be mounted as read/write once.
// Fibre Channel volumes support ownership management and SELinux relabeling.
type FCVolumeSource struct {
// Required: FC target worldwide names (WWNs)
TargetWWNs []string `json:"targetWWNs" protobuf:"bytes,1,rep,name=targetWWNs"`
// Required: FC target lun number
Lun *int32 `json:"lun" protobuf:"varint,2,opt,name=lun"`
// Optional: FC target worldwide names (WWNs)
// +optional
TargetWWNs []string `json:"targetWWNs,omitempty" protobuf:"bytes,1,rep,name=targetWWNs"`
// Optional: FC target lun number
// +optional
Lun *int32 `json:"lun,omitempty" protobuf:"varint,2,opt,name=lun"`
// Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
@@ -1116,6 +1118,10 @@ type FCVolumeSource struct {
// the ReadOnly setting in VolumeMounts.
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"`
// Optional: FC volume world wide identifiers (wwids)
// Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.
// +optional
WWIDs []string `json:"wwids,omitempty" protobuf:"bytes,5,rep,name=wwids"`
}
// AzureFile represents an Azure File Service mount on the host and bind mount to the pod.

View File

@@ -541,10 +541,11 @@ func (ExecAction) SwaggerDoc() map[string]string {
var map_FCVolumeSource = map[string]string{
"": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.",
"targetWWNs": "Required: FC target worldwide names (WWNs)",
"lun": "Required: FC target lun number",
"targetWWNs": "Optional: FC target worldwide names (WWNs)",
"lun": "Optional: FC target lun number",
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
"readOnly": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
"wwids": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.",
}
func (FCVolumeSource) SwaggerDoc() map[string]string {

View File

@@ -2084,6 +2084,11 @@ func (in *FCVolumeSource) DeepCopyInto(out *FCVolumeSource) {
**out = **in
}
}
if in.WWIDs != nil {
in, out := &in.WWIDs, &out.WWIDs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}