Skip to content

Fix: Exit on e4defrag failure and add verbose logging#20

Closed
saurabh-sengar wants to merge 1 commit intomicrosoft:mainfrom
saurabh-sengar:fix-e4defrag-error-handling
Closed

Fix: Exit on e4defrag failure and add verbose logging#20
saurabh-sengar wants to merge 1 commit intomicrosoft:mainfrom
saurabh-sengar:fix-e4defrag-error-handling

Conversation

@saurabh-sengar
Copy link
Copy Markdown

Created by CoPilot - Testing it.

Copy link
Copy Markdown
Contributor

@shradhagupta6 shradhagupta6 left a comment

Choose a reason for hiding this comment

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

Verified the patch, and it throws following error as expected:
root@lisa--286-e0-n0:/home/lisatest/lisa_working/20250505/20250505-053125-286/tool/hibernationsetup/hibernation-setup-tool# ./hibernation-setup-tool
INFO: VM supports hibernation with platform-supported events.
INFO: IMDS Request:
GET /metadata/instance/compute/additionalCapabilities/hibernationEnabled?api-version=2021-11-01&format=text HTTP/1.1
Host: 169.254.169.254
Metadata:true

INFO: IMDS Response:
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Server: IMDS/150.870.65.1544
x-ms-request-id: c80fc720-66ab-4c95-a061-362defdda540
Date: Mon, 05 May 2025 05:54:36 GMT
Content-Length: 4

true

INFO: Hibernation is allowed for this VM
hibernation-setup-tool: INFO: System has 7937 MB of RAM; needs a swap area of 15874 MB
hibernation-setup-tool: INFO: Swap file not found
hibernation-setup-tool: INFO: Creating swap file with 15874 MB
hibernation-setup-tool: INFO: Creating hibernation file at /hibfile.sys with 15874 MB.
hibernation-setup-tool: INFO: Ensuring /hibfile.sys has no holes in it.
hibernation-setup-tool: INFO: Waiting for e4defrag (pid 1453) to finish.
e4defrag 1.47.0 (5-Feb-2023)
ext4 defragmentation for /hibfile.sys
[1/1] "/hibfile.sys" extents: 66 -> 66
Defrag size is larger than filesystem's free space [ NG ]
Success: [0/1]
hibernation-setup-tool: INFO: e4defrag ended with unexpected exit code 1
hibernation-setup-tool: ERROR: e4defrag failed for /hibfile.sys. Exiting.

@saurabh-sengar
Copy link
Copy Markdown
Author

@pavanrachapudy90 @younghyun5756 Can you please review ?

@pavanrachapudy90
Copy link
Copy Markdown
Collaborator

Should we also handle for btrfs as well? - try_spawn_and_wait("btrfs", 3, "filesystem", "defragment", path);

@shradhagupta6
Copy link
Copy Markdown
Contributor

Should we also handle for btrfs as well? - try_spawn_and_wait("btrfs", 3, "filesystem", "defragment", path);

yes, let me try to push changes for the same

@shradhagupta6
Copy link
Copy Markdown
Contributor

I won't be able to update the PR with my commit. I am creating a new PR to take care of this

@shradhagupta6
Copy link
Copy Markdown
Contributor

new PR: #23

@saurabh-sengar
Copy link
Copy Markdown
Author

closing this PR

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.

3 participants