I have tested the proposed patch locally against ec2-hibinit-agent
1.0.9-0ubuntu1 on an arm64 EC2 m9g.8xlarge instance.

The original configuration remains unchanged:

```ini
percentage-of-ram = 100
target-size-mb = 4000
```

After modifying SwapInitializer.__init__() to calculate the allocation
size using the maximum of the configured target size and the specified
percentage of RAM, the agent now correctly allocates the required swap
space.

Before patch: 4194304000 bytes (3.91 GiB)
After patch: 132609261568 bytes (123.5 GiB)

Relevant log output:

```
Will check if swap is at least: 126466 megabytes
Allocating 132609261568 bytes in /swap-hibinit
Setting up swapspace version 1, size = 123.5 GiB (132609257472 bytes)
```

Swap initialisation, activation, GRUB configuration, kernel resume
offset updates and swap deactivation all completed successfully.

The proposed patch therefore fixes the reported allocation defect.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2178491

Title:
  ec2-hibinit-agent 1.0.9 ignores percentage-of-ram when allocating
  hibernation swap file

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2178491/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to