Bug 1312387

Summary: [RFE] pvresize option not available with ssm (system-storage-manager)
Product: Red Hat Enterprise Linux 7 Reporter: Ranjith ML <rmadhuso>
Component: system-storage-managerAssignee: Lukáš Czerner <lczerner>
Status: CLOSED WONTFIX QA Contact: Boyang Xue <bxue>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: agk, dwysocha, nyewale, prajnoha, xzhou, zkabelac
Target Milestone: rcKeywords: FutureFeature, Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-07 05:13:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851    
Attachments:
Description Flags
with pvresize option and corrected indentation error.
none
Keep PVsInfo accessible even after changes in Device/DeviceInfo structure in man.py.
none
Infrastructure-to-resize-PV.patch
none
Add functionality to resize PV none

Description Ranjith ML 2016-02-26 15:32:06 UTC
1. Proposed title of this feature request  

 pvresize  option not available with ssm (system-storage-manager)

2. Who is the customer behind the request?  

Account: name and acct # Fleishman Hillard /   1478499
  
TAM customer: no  
SRM customer: no  
Strategic: no  

This features is required for all customers who want to extended underlying disk and its pv online using ssm utility.

3. What is the nature and description of the request?  

Need to resize PV size using "ssm" after resizing underlying disk.

4. Why does the customer need this?  

For re-sizing PV size online without any downtime.

5. Is there already an existing RFE upstream or in Red Hat Bugzilla?  
No

6. Does the customer have any specific timeline dependencies and which release would they like to target?
No

7. Is the sales team involved in this request and do they have any additional input? 
No.

8. List any affected packages or components.  
 system-storage-manager
      
9. Would the customer be able to assist in testing this functionality if implemented?
Yes.

Comment 4 Jan Tulak 2018-01-30 07:39:15 UTC
*** Bug 1312386 has been marked as a duplicate of this bug. ***

Comment 6 Nitin Yewale 2018-07-02 13:01:43 UTC
(In reply to Nitin Yewale from comment #5)
> Created attachment 1455956 [details]
> Patch to add pvresize option.
> 
> Patch to add pvresize option mentioned in the BZ.

Attached patch worked for me as follows

[root@stest ~]# pvs
  PV         VG             Fmt  Attr PSize   PFree 
  /dev/sda2  rhel_vm252-140 lvm2 a--  <80.13g  4.00m
  /dev/sda3  vg1            lvm2 a--   <5.00g <3.00g
  /dev/sdd1  testvg         lvm2 a--   <6.00g  4.82g

[root@stest ~]# lvs
  LV   VG             Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel_vm252-140 -wi-ao---- 78.12g                                                    
  swap rhel_vm252-140 -wi-ao----  2.00g                                                    
  lv1  testvg         -wi-a-----  1.17g                                                    
  lv1  vg1            -wi-a-----  2.00g                                                    
[root@stest ~]# 



# ssm resize -s +200M testvg/lv1

[root@stest ssmlib]# lvs
  LV   VG             Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel_vm252-140 -wi-ao---- 78.12g                                                    
  swap rhel_vm252-140 -wi-ao----  2.00g                                                    
  lv1  testvg         -wi-a----- <1.37g                                                    
  lv1  vg1            -wi-a-----  2.00g 

# ssm resize /dev/sdd1
[root@stest ssmlib]# pvs
  PV         VG             Fmt  Attr PSize   PFree 
  /dev/sda2  rhel_vm252-140 lvm2 a--  <80.13g  4.00m
  /dev/sda3  vg1            lvm2 a--   <5.00g <3.00g
  /dev/sdd1  testvg         lvm2 a--   <7.00g <5.63g

Not implemented (-s --setphysicalvolumesize) as in my testing the original size of the PV is equal to underlying size of the device in the current scenario.

Comment 7 Nitin Yewale 2018-07-02 13:28:52 UTC
Created attachment 1455961 [details]
with pvresize option and corrected indentation error.

with pvresize option and corrected indentation error.

Comment 9 Alasdair Kergon 2018-07-02 13:33:30 UTC
(In reply to Nitin Yewale from comment #6)

> Not implemented (-s --setphysicalvolumesize) as in my testing the original
> size of the PV is equal to underlying size of the device in the current
> scenario.

Indeed - it's best not to expose that option to ssm users.

Comment 10 Jan Tulak 2018-07-16 12:16:26 UTC
(In reply to Alasdair Kergon from comment #9)
> (In reply to Nitin Yewale from comment #6)
> 
> > Not implemented (-s --setphysicalvolumesize) as in my testing the original
> > size of the PV is equal to underlying size of the device in the current
> > scenario.
> 
> Indeed - it's best not to expose that option to ssm users.

That would prevent the user from shrinking the PV, so the option should be there. I'm working with Nitin on another iteration of the patch.

Comment 12 Eric Sandeen 2019-06-17 14:06:53 UTC
Lukas, please set the disposition on this bug as you see fit.
Thanks,
-Eric

Comment 13 Lukáš Czerner 2019-06-20 16:36:16 UTC
Hi Nitin,

Jan has left the company and I know you've been working with him on this feature request. Could you please send the up-to-date version of you patches to the ssm list ?

Thanks!
-Lukas

Comment 14 Nitin Yewale 2019-06-28 09:41:42 UTC
Hello Lukas,

Sorry for late response.

The patches are ready just need some cleanup. I shall sent them by Monday.

Thank you,
Nitin Yewale

Comment 15 Nitin Yewale 2019-07-01 16:02:32 UTC
Hello Lukas,

I have sent two patches (could be made 3) to the ssm list today.

I would soon make them 3 as suggested by Jan, however sending two was easy for me at the moment. Sorry for the inconvenience.

There are some TODOs in it for which I would need some guidance.

Thank you,
Nitin Yewale

Comment 16 Nitin Yewale 2019-07-18 10:01:15 UTC
Hello Lukas,

I have submitted patches to the ssm list in the format

Keep-PVsInfo-accessible-even-after-changes-in-Device
Infrastructure-to-resize-PV
Add-functionality-to-resize-PV

Please let me know your thoughts.

Sorry for the delay.

Thank you,
Nitin Yewale

Comment 17 Nitin Yewale 2019-11-11 12:05:39 UTC
Created attachment 1634855 [details]
Keep PVsInfo accessible even after changes in  Device/DeviceInfo structure in man.py.

Keep PVsInfo accessible even after changes in Device/DeviceInfo structure in man.py.

Comment 18 Nitin Yewale 2019-11-11 12:06:35 UTC
Created attachment 1634856 [details]
Infrastructure-to-resize-PV.patch

Infrastructure-to-resize-PV.

Comment 19 Nitin Yewale 2019-11-11 12:07:47 UTC
Created attachment 1634857 [details]
Add functionality to resize PV

Add functionality to resize PV

Comment 20 Nitin Yewale 2019-11-11 12:15:53 UTC
Hello,

Please find the three patches which should help in using ssm for resizing PV as per the customer requirement through this BZ.

Created three patches as per the functionality they provide and per the instructions from Jan Tulak.

These patches help to resize the PV in following ways

Let the device size be 1G and PV size is 500M. PV used is 200M or in other words,
PV free is 300M.

1. ssm command would allow to resize the PV to resize the PV to 1G
ssm -f resize device

2. It could reduce the size of PV as well not below the used size
ssm -f resize -s"-300M" device  <--- pass
ssm -f resize -s"350M" device  <--- fails

3. It could extend the size of PV to 800M as well
ssm -f resize -s 800M device
OR
ssm -f resize -s +300M device

4. ssm command would not allow the size of PV greater than underlying device size or to negative value. 
So below commands should fail
ssm -f resize -s"-2000M" device
ssm -f resize -s +2000M device
ssm -f resize -s 2000M device
ssm -f resize -s 150M device 

Not all of these functionality seems could be added in the tests.

For the bash tests, I have added all the possible tests known and feasible to me.

The only "TO DO" I think remaining is to move the function "get_pv_size" from misc.py to lvm.py. If could take out some time, I will need help on this.

Please let me know if anything is missing.

I shall clone this BZ for RHEL8 ssm as well as we would need this functionality in RHEL8.

Thank you,
Nitin Yewale

Comment 21 Lukáš Czerner 2020-05-07 05:13:18 UTC
It's too late in the rhel7 cycle, we're not going to introduce new functionality to ssm at this stage.