-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
lib/vdi: Add VDI resize support and integrate into VM & linstor operations #273
Conversation
When marking a PR ready for review, please also add a comment, as Github apparently doesn't always notify of this kind of change. |
f7ff4b3
to
88b5273
Compare
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 *") | ||
|
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.
f70b1ae
to
57ee6c2
Compare
There was a problem hiding this 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.
1766c1c
to
ddcc865
Compare
…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]>
ddcc865
to
fdc4d32
Compare
There was a problem hiding this 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" |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 *") |
There was a problem hiding this comment.
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?
resize
method toVDI
class to allow resizing of VDIs viaxe vdi-resize
.vdi_resize
method in VM class to support 2x VDI resizing.test_resize_vdi
in Linstor and basic VM tests, verifying VDI resize functionality and ensuring VM boot post-resize.wait_for_vm_running
.