-
Notifications
You must be signed in to change notification settings - Fork 180
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
hyperv: expand root partition #3600
base: main
Are you sure you want to change the base?
Conversation
# be grown". In this case, it returns exit code 1 which we can ignore | ||
if cmd_result.exit_code != 0 and "NOCHANGE" not in cmd_result.stdout: | ||
raise LisaException(f"Failed to grow partition: {cmd_result.stdout}") | ||
node.execute(f"resize2fs {device_name}", sudo=True) |
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.
Use expected_exit_code to ensure if command get executed successfully
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.
@smit-gardhariya There is a case where we want to treat a non-zero error code as success. Please read the comment.
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.
Ah, your comment is for the resize2fs command. Never mind.
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.
@smit-gardhariya alright
root_partition = node.tools[Mount].get_partition_info("/")[0] | ||
device_name = root_partition.name | ||
partition = root_partition.disk | ||
root_part_num = device_name[-1] |
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.
Provide example of the name above.
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 looks a regexp is more accurate, in case the number has two or more digits.
@@ -315,6 +315,8 @@ def _deploy_environment(self, environment: Environment, log: Logger) -> None: | |||
address=ip_addr, username=username, password=password | |||
) | |||
|
|||
self._expand_root_partition(node) |
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.
Add a comment here explaining why we need this even though we're doing _resize_vhd_if_needed()
above.
cmd_result = node.execute( | ||
f"growpart /dev/{partition} {root_part_num}", sudo=True | ||
) | ||
# In case, the partition is already expanded to full disk size, the |
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.
# In case, the partition is already expanded to full disk size, the | |
# In case the partition is already expanded to full disk size, the |
9df1ff8
to
52abe12
Compare
# be grown". In this case, it returns exit code 1 which we can ignore | ||
if cmd_result.exit_code != 0 and "NOCHANGE" not in cmd_result.stdout: | ||
raise LisaException(f"Failed to grow partition: {cmd_result.stdout}") | ||
node.execute(f"resize2fs {device_name}", sudo=True, expected_exit_code=0) |
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.
Execute only if it can be grown. Reduce the number of running commands, even it do nothing.
The vm root partition (mounted at /) is not getting expanded to full disk size with dom0 3.0 vhd. With 2.0 vhd, this issue is not seen, resize vhd works as expected.