Pure currently does not support direct mounting of snapshots.
As we currently silently ignore the snapname field at least error
out if we receive a non empty snapname. Its unclear if this is
still used as vzdump nowadays does live backups.
Signed-off-by: Peter Lieven <pl@dlhnet.de>
Eliminate scsi_rescan_device()
Add get_device_path_wwn()
Add device_op() to serve as helper for device operations
In scsi_scan_new()
* Use device_op()
In purestorage_get_device_size()
* Rename to get_device_size()
* Drop $class
In remove_block_device()
* Rename it to block_device_action()
* Use common code to remove or rescan devices
* Use device_op() helper to perform a device action
Add block_device_slaves() returning resolved device path and its slaves
In purestorage_get_wwn()
* Use get_device_path_wwn() to simplify the code
Redesign purestorage_resize_volume()
* Avoid extra API call by using volume serial returned by volume resize action
* Use get_device_path_wwn()
* Remove unneeded protocol checks
* Support [unlikely] case when resized volume is not mapped/connected
* Use block_device_slaves() and block_device_action() to simplify the code
Redesign unmap_volume()
* Use block_device_slaves() and block_device_action() to simplify the code
In scsi_scan_new()
* Pass protocol as parameter
* Adjust code to scan hosts for specified protocol
* Count number of scanned hosts, report it in debug mode
In scsi_rescan_new()
* Search for wwid in /sys/class/scsi_disk
* Use stricter search pattern
* Count number of found matches, report it in debug mode
Rename purestorage_unmap_disk() to remove_block_device()
In purestorage_resize_volume()
* Report that volume was resized after its new size is confirmed
* Use scsi_rescan_device() for iscsi
* Change "Info :: New size detected ..." to debug output
In map_volume()
* Use scsi_scan_new() for iscsi
In unmap_volume()
* Remove redundant block device check
* Change info messages to debug output
Include leading "3" into $purestorage_wwn_prefix
In purestorage_get_wwn()
* modify code to use updated $purestorage_wwn_prefix value
* add warning if volume is not found
In exec_command()
* die on error by default, update affected callers
* allow to invert success/failure with warning suppression (e.g. to support "fuser")
* update executables to full path inside of the function
* update affected callers
In wait_for()
* die on timeout instead of returning 0, update affected callers
In purestorage_unmap_disk()
* drop $class
* check that disk is a block device
In unmap_volume()
* improve error checking and logging
* add support for "fuser" check (but leave it commented out)
In scsi_rescan_device()
* remove 'multipath -r' call (there is a 'multipathd resize map' call)
* use multipathd for certain functions
* suppress output of exec_command() by default if $DEBUG value is less than 3
* introduce multipath_check() function
* eliminate purestorage_cleanup_diskmap()
Introduce wait_for() function
* to be used instead of waiting loops
* reduce default timeout and sleep delay
* do not log "Waiting for..." unless it actually waited
* show total time spent while waiting [not counting actual wait checks]
In purestorage_resize_volume()
* replace "multipath -r" call (unneeded reload of *all* multipath maps) with "multipathd resize map" call
* use wait_for() instead of waiting loop
In map_volume()
* remove unneeded "multipath -a" call
* use wait_for() instead of waiting loop
* call "multipathd add map" unless multipath_check() succeeds
In unmap_volume()
* use multipath_check()
* remove unneeded "multipath -w" call
* replace "multipath -f" with "multipathd remove map" call, die on error
* ActiveCluster is enabled by providing comma-separated cluster arrays parameters in "address" and "token"
* retry non-API errors on a second array
* connect/disconnect volumes to host on both arrays
* related code refactoring and improvements
The "podname" value (mutually exclusive with "vgname") specifies Purestorage pod name.
The "vnprefix" value is an optional prefix to prepend to volume names.
The "vnprefix" can be used in combination with "podname" or "vgname".
Examples of volume name "vm-100-disk-0" mapping to PureStorage:
"podname mypod" => mypod::vm-100-disk-0
(same as "vnprefix mypod::")
"vgname mypve" => mypve/vm-100-disk-0
(same as "vnprefix mypve/")
"podname mypod", "vnprefix dev-" => mypod::dev-vm-100-disk-0
(same as "vnprefix mypod::dev-")
"vgname mypve", "vnprefix dev-" => mypve/dev-vm-100-disk-0
(same as "vnprefix mypve/dev-")
Also:
* Made "vgname" parameter optional
* Moved array address parameters check to purestorage_api_request()
* Removed volume info caching (#15), eliminated purestorage_volume_info()
* Modified purestorage_list_volumes() to return only disk names we recognize [ $vmid = undef case ]
* Use substr() instead of regex to strip volume name prefix in purestorage_get_volumes()
* Show PVE volume names in "Info ::" messages
* Added description of new parameters to README.md
Implemented purestorage_volume_restore()
Enabled volume and snapshot cloning
Eliminated purestorage_snap_volume_rollback()
Instant cloning can be done using "qm clone" with --full no
(template cloning would work from GUI too)
Examples:
To clone VM 100 to 123:
qm clone 100 123 --full no
To clone VM 100's snapshot ABCD to VM 123:
qm clone 100 123 --full no --snapname ABCD
* Added prepare_api_params() function to assemble api call parameters
* Redesigned and simplified purestorage_volume_info()
* Adjusted all api calls to have call parameters inside of $action
PVE storage subsystem does not unmap disk before moving it to another guest.
Also added check to make sure the target volume (if specified) does not exist.
Replaced run_command() occurences with exec_command() which takes care of errors
Setting $DEBUG set to 2+ will show shell commands we are executing in the log
There are border cases when volume can remain mapped or connected to array even if the vm is not running.
Ideally, this should be done at the higher level (Storage.pm?), but the current storage implementation does not do it.
Use purestorage_list_volumes2() to return information for the specified volume name.
Exclude destroyed volumes to never return a serial number of a previously destroyed volume with the same name.
After installing the plugin, you need to configure Proxmox VE to use it. Since Proxmox VE does not currently support adding custom storage plugins via the GUI, you will need to manually edit the storage configuration file `/etc/pve/storage.conf`.
After installing the plugin, you need to configure Proxmox VE to use it. Since Proxmox VE does not currently support adding custom storage plugins via the GUI, you will need to open shell and use `pvesm` command to add it:
```bash
pvesm add purestorage <storage_id> \
--nodes <proxmox_node_list> \
--address https://<purestorage_fqdn_or_ip> \
--token <purestorage_api_token> \
--vgname <purestorage_volume_group_name> \
--hgsuffix <purestorage_host_suffix>
--content images
```
Alternatively, you can manually edit the storage configuration file `/etc/pve/storage.cfg`.
```
purestorage: pure
nodes: <proxmox_node_list>
purestorage: <storage_id>
nodes <proxmox_node_list>
address https://<purestorage_fqdn_or_ip>
token <purestorage_api_token>
vgname <purestorage_volume_group_name>
@@ -107,12 +122,16 @@ purestorage: pure
| Parameter | Description |
| --------- | ----------- |
| storage_id | The storage identifier (name under which it will appear in the Storage list) |
| nodes | (`optional`) A comma-separated list of Proxmox node names. Use this parameter to limit the plugin to specific nodes in your cluster. If omitted, the storage is available to all nodes. |
| address | The URL or IP address of the Pure Storage API endpoint. Ensure that the Proxmox VE nodes can reach this address over the network. |
| token | The API token used for authentication with the Pure Storage array. This token must have sufficient permissions to create and manage volumes. |
| vgname | The name of the volume group where new virtual disks will be created. This should match the configuration on your Pure Storage array. |
| vgname | (`optional`, conflicts with `podname`) The volume group name where virtual disks will be stored. This should match the configuration on your Pure Storage array. |
| podname | (`optional`, conflicts with `vgname`) The pod name where virtual disks will be stored. This should match the configuration on your Pure Storage array. |
| vnprefix | (`optional`) The prefix to prepend to name of virtual disks. |
| hgsuffix | (`optional`) A suffix that is appended to the hostname when the plugin interacts with the Pure Storage array. This can help differentiate hosts if necessary. |
| content | Specifies the types of content that can be stored. For virtual machine disk images, use images. |
| protocol | (`optional`, default is `iscsi`) Specifies the storage protocol (iscsi, fc) |
> **_NOTE:_** Ensure that the token and other sensitive information are kept secure and not exposed publicly.
- Verify Network Connectivity: Ensure that the Proxmox VE nodes can reach the Pure Storage array over the network. Check for firewall rules or network issues that might be blocking communication.
- Review Logs: Check the Proxmox VE logs for any error messages related to storage or the plugin. Logs are typically found in /var/log/pve.
These commands are helpful for troubleshooting:
```bash
multipath -ll -v3 #diagnose issues with the multipath service
iscsiadm -m node #list what iscsi nodes are mounted
ls -l /dev/mapper/3624a9370* #list wwids of Pure mapped devices on the system
```
- Multipath Configuration: Verify that your multipath.conf is correctly configured and that multipath devices are recognized. Use multipath -ll to list the current multipath devices.
- API Token Permissions: Ensure that the API token used has the necessary permissions to create and manage volumes on the Pure Storage array.
- Plugin Updates: Ensure you are using the latest version of the plugin. Check the GitHub repository for updates.
### Known issues
- `lvm inside a volume`: If you plan to use LVM inside a volume, it is better to add purestorage volumes to the ignore list to avoid scanning.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.