Commit Graph

48 Commits

Author SHA1 Message Date
amulet1 ac971e0425 Added support for Veeam snapshots 2025-01-29 16:28:57 -05:00
amulet1 c156355589 Redesigned purestorage_api_request() to handle session expirations 2025-01-29 14:02:50 -05:00
timansky 2f5bc26369 Merge remote-tracking branch 'origin/main' into issue-37 2025-01-29 09:12:49 +05:00
timansky 46ccf11ece Return error if path does not exists 2025-01-29 09:12:08 +05:00
amulet1 d01feb85a8 Added support for "podname" and "vnprefix" parameters (#29)
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
2025-01-27 20:59:51 -05:00
timansky 75625bdbdb return path in map_volume (#37) 2025-01-28 05:10:45 +05:00
amulet1 236ab82740 Added support for volume and snapshot cloning
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
2025-01-27 17:22:38 -05:00
Dmitry Petrov 25aba73428 Merge branch 'main' into dev2 2025-01-27 16:28:39 -05:00
amulet1 c249fe46cb Merged $params into $action in purestorage_api_request()
* 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
2025-01-27 16:16:34 -05:00
amulet1 a0fcb1437c Enabled "sparseinit" feature
This dramatically speeds up copy/restore operations by skipping writing zeroes to unallocated blocks
2025-01-27 09:52:20 -05:00
amulet1 752b6fe06f Merged $body into $action parameter in purestorage_api_request() 2025-01-25 12:22:14 -05:00
amulet1 71542b1b94 Replaced purestorage_request() with purestorage_api_request()
Combined $type and $method parameters into $action hash reference
2025-01-25 12:21:53 -05:00
amulet1 725e99023f Made purestorage_request() static 2025-01-25 12:21:13 -05:00
amulet1 4a1bec377f Started redesign of purestorage_request()
Simplified code, eliminated purestorage_get_auth_token()
2025-01-25 12:19:14 -05:00
amulet1 6474161796 Unmap volume before renaming it
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.
2025-01-16 15:41:31 -05:00
amulet1 829cf63e1f Added purestorage_get_volume_info() and purestorage_get_existing_volume_info()
The functions return first matching volume object.

Use purestorage_get_existing_volume_info() in purestorage_get_wwn()
2025-01-16 15:41:07 -05:00
amulet1 660d9bff76 Make hgsuffix truly optional
Replaced the default value "pve" with ""

Resolves #5
2025-01-16 15:40:30 -05:00
amulet1 246cba516e Added wrapper to run_command() to streamline error handling
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
2025-01-15 12:47:39 -05:00
Dmitry Petrov d2fecfd95a unmap_volume(): Do not die if volume is already unmapped
(accidentally reintroduced the issue in prior commit)
2025-01-14 13:35:00 -05:00
Dmitry Petrov a8de2749c5 unmap_volume(): Use $wwid instead of $path where possible
Other changes:
  * Replaced readlink() with abs_path()
  * Added error check for blockdev call
2025-01-14 11:43:40 -05:00
Dmitry Petrov 4484ff1a01 Simplified rename_volume() 2025-01-13 20:03:35 -05:00
Dmitry Petrov 3f1c997a75 Cleanup: removed unneeded assert_* functions 2025-01-13 15:34:21 -05:00
Dmitry Petrov 13b66fdfaf parse_volume(): return volume format as 'raw'
This fixes an issue with migration of EFI disks.
2025-01-13 14:51:54 -05:00
Dmitry Petrov 01d502007c Show slave disk names on one line in unmap_volume() 2025-01-13 12:30:26 -05:00
Dmitry Petrov c06e2f24c0 Add $storeid to cache key in list_images() and status()
This allows to have multiple instances of the plugin with different parameters.
2025-01-13 12:12:12 -05:00
dpetrov67 ac595ce025 purestorage_volume_connection(): be silent on non-fatal errors
Instead of reporting errors when volume is already connected to/removed from a host, add "was already" to the info output.
2025-01-07 15:11:39 -05:00
dpetrov67 b8199a39de Eliminated purestorage_rescan_diskmap()
Call "multipath -r" on volume resize only.
2025-01-07 08:56:37 -05:00
dpetrov67 3702c5670e purestorage_rescan_diskmap(): rescan node on resize 2025-01-07 08:34:45 -05:00
dpetrov67 8f09da2161 purestorage_volume_connection(): minor clean up and refactoring
Also merged pure_host() into  purestorage_volume_connection().
2025-01-07 08:06:41 -05:00
dpetrov67 d41eddf46a purestorage_resize_volume(): minor clean up and refactoring 2025-01-07 08:02:39 -05:00
dpetrov67 61a60a5203 purestorage_remove_volume(): minor cleanup and frefactoring 2025-01-07 07:55:57 -05:00
dpetrov67 e4f9792f66 purestorage_create_volume(): minor cleanup and refactoring 2025-01-07 07:36:51 -05:00
dpetrov67 791f08b690 alloc_image(): Do not try to remove volume if we failed to create it 2025-01-07 07:31:48 -05:00
dpetrov67 3d23f66fd6 Always try to deactivate volume before removal
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.
2025-01-07 07:28:13 -05:00
dpetrov67 3dc6baaa0c multipath-related clean up
Sew issue #1.
2025-01-06 21:06:00 -05:00
dpetrov67 3ce60e55e4 Simplified purestorage_get_wwn()
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.
2025-01-05 19:45:12 -05:00
dpetrov67 78a67d852c Added purestorage_list_volumes2() allowing to filter by name(s) 2025-01-05 19:26:41 -05:00
dpetrov67 ad11226845 Removed unused $disk_prefix variable 2025-01-05 18:46:52 -05:00
dpetrov67 ea4021a8d0 alloc_image(): Adjust image size to be at least 1024kb 2025-01-04 09:49:20 -05:00
dpetrov67 ccaad9446e Unmap volume before dropping its connection to storage 2024-12-30 16:25:48 -05:00
dpetrov67 5ff29eed5b Correct logging output in deactivate_volume()
deactivate_volume() should not say "... added to host".
2024-12-30 15:25:59 -05:00
dpetrov67 6e184b88e0 Filter fix in purestorage_list_volumes
"qm rescan" was re-adding previously destroyed disks.
2024-12-28 20:10:07 -05:00
dpetrov67 c8737e0e90 Make hgsuffix optional 2024-12-28 16:22:33 -05:00
timansky adcf24c808 fix features 2024-12-26 15:58:35 +05:00
timansky 2654c87bb2 - snapshot eradicate on remove
- allow snapshot state
- logs format
- api http response cache
- add x-request-id header
2024-12-26 10:17:07 +05:00
timansky 01d6947af2 One style prefix output for logs 2024-12-09 19:47:26 +05:00
timansky 06e95aa7e3 Replace hardcoded sleep with loop (fixes #2) 2024-12-09 19:34:44 +05:00
timansky c252c0310f Initial commit 2024-12-04 22:27:16 +05:00