Skip to content

lib/vdi: Add VDI resize support and integrate into VM & linstor operations #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rushikeshjadhav
Copy link
Contributor

@rushikeshjadhav rushikeshjadhav commented Feb 12, 2025

  • Added resize method to VDI class to allow resizing of VDIs via xe vdi-resize.
  • Introduced vdi_resize method in VM class to support 2x VDI resizing.
  • Implemented test_resize_vdi in Linstor and basic VM tests, verifying VDI resize functionality and ensuring VM boot post-resize.
  • Refactored VM operations to include wait_for_vm_running.

@rushikeshjadhav rushikeshjadhav marked this pull request as ready for review February 14, 2025 13:10
@stormi
Copy link
Member

stormi commented Feb 17, 2025

When marking a PR ready for review, please also add a comment, as Github apparently doesn't always notify of this kind of change.

@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-684 branch from f7ff4b3 to 88b5273 Compare February 19, 2025 15:22
@rushikeshjadhav rushikeshjadhav changed the title feat(vdi): Add VDI resize support and integrate into VM & linstor operations lib/vdi: Add VDI resize support and integrate into VM & linstor operations Feb 19, 2025
Comment on lines 83 to 89
def test_resize_vdi(self, vm_on_linstor_sr):
vm = vm_on_linstor_sr
if vm.is_running():
vm.shutdown(verify=True, force_if_fails=True)
logging.info("* VDI Resize started *")
for vdi_uuid in vm.vdi_uuids():
vm.vdi_resize(vdi_uuid)
logging.info("* VDI Resize completed *")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a test we might want to add to tests of all other SRs (in a separate PR once this one is merged?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this one is generally applicable to all storage tests that we have.

@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-684 branch 2 times, most recently from f70b1ae to 57ee6c2 Compare February 20, 2025 06:53
@Wescoeur Wescoeur requested review from Nambrok and removed request for ydirson February 21, 2025 13:11
Copy link
Member

@stormi stormi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I already gave a quick look to the latest changes. Trusting Ronan or Damien with their complementary review.

@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-684 branch 3 times, most recently from 1766c1c to ddcc865 Compare February 27, 2025 13:59
…uring availability across all hosts and handling "auto" selection dynamically.

Signed-off-by: Rushikesh Jadhav <[email protected]>
…collectively, refining vgcreate and pvcreate logic.

Signed-off-by: Rushikesh Jadhav <[email protected]>
…, reducing setup time.

Signed-off-by: Rushikesh Jadhav <[email protected]>
…namically configure storage provisioning (thin or thick).

Refactored Linstor SR test cases to use the new fixtures, improving test coverage across provisioning types.

Signed-off-by: Rushikesh Jadhav <[email protected]>
…ia `xe vdi-resize` in `vdi.py`

Signed-off-by: Rushikesh Jadhav <[email protected]>
…zing.

- VM operations to include `wait_for_vm_running` method.

Signed-off-by: Rushikesh Jadhav <[email protected]>
- Implemented `test_resize_vdi` in Linstor, verifying VDI resize functionality and ensuring VM boot post-resize.

Signed-off-by: Rushikesh Jadhav <[email protected]>
@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-684 branch from ddcc865 to fdc4d32 Compare March 7, 2025 08:35
@rushikeshjadhav rushikeshjadhav requested a review from stormi March 7, 2025 08:36
Copy link
Contributor

@ydirson ydirson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget an empty line after the commit summary. For some reason GitHub makes a wrong interpretation here, see how e.g. git shortlog interpret this not a paragraph break

Also, commit summary for last commit is wrong.

# MIN_VHD_SIZE = 1 * 1024 * 1024 # 1MB

# Following assert may be removed in future if we support online vdi resize
assert not self.is_running(), f"Expected halted, got running"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more states than just "running" and halted, that would probably need assert self.is_halted() here

# Following assert may be removed in future if we support online vdi resize
assert not self.is_running(), f"Expected halted, got running"

vdi_obj = VDI(vdi_uuid, sr=self.get_sr())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just vdi would be suitable, no need for _obj

if new_size is None:
# Resize by double, ideally it should be within min and max limits reference
vdi_size = int(vdi_obj.param_get("virtual-size"))
new_size = str(vdi_size * 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be cleaner to use integers to manipulate size objects. Host.xe() already handles the conversion to string anyway.
To make such things more visible, it would be great to add type hints to new methods, eg:

def vdi_resize(self, vdi_uuid: str, new_size: Optional[int] = None) -> None:
    ...

new_size = str(vdi_size * 2)

vdi_obj.resize(new_size)
resized_vdi_size = vdi_obj.param_get("virtual-size")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same idea, better convert to int directly here

@pytest.mark.big_vm
def test_resize_vdi(self, vm_on_linstor_sr):
vm = vm_on_linstor_sr
logging.info("* VDI Resize started *")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want * marker in the logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants