Memory DR Examples
The following examples show how to perform memory DR operations. For information about the related CLI commands, see the ldm
(8) man page.
Example 15-7 Memory DR Operations on Active Domains
This example shows how to dynamically add memory to and remove it from an active domain, ldom1
.
The ldm list
output shows the memory for each domain in the Memory field.
primary# ldm list
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME
primary active -n-cv- SP 4 27392M 0.4% 1d 22h 53m
ldom1 active -n---- 5000 2 2G 0.4% 1d 1h 23m
ldom2 bound ------ 5001 2 200M
The following ldm add-mem
command exits with an error because you must specify memory in multiples of 256 Mbytes. The next ldm add-mem
command uses the --auto-adj
option so that even though you specify 200M
as the amount of memory to add, the amount is rounded up to 256 Mbytes.
primary# ldm add-mem 200M ldom1 The size of memory must be a multiple of 256MB. primary# ldm add-mem --auto-adj 200M ldom1 Adjusting request size to 256M. The ldom1 domain has been allocated 56M more memory than requested because of memory alignment constraints. primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 5.0% 8m ldom1 active -n---- 5000 2 2304M 0.5% 1m ldom2 bound ------ 5001 2 200M
The ldm remove-mem
command exits with an error because you must specify memory in multiples of 256 Mbytes. When you add the --auto-adj
option to the same command, the memory removal succeeds because the amount of memory is rounded down to the next 256-Mbyte boundary.
primary# ldm remove-mem --auto-adj 300M ldom1 Adjusting requested size to 256M. The ldom1 domain has been allocated 44M more memory than requested because of memory alignment constraints. primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 0.3% 8m ldom1 active -n---- 5000 2 2G 0.2% 2m ldom2 bound ------ 5001 2 200M
Example 15-8 Memory DR Operations on Bound Domains
This example shows how to add memory to and remove it from a bound domain, ldom2
.
The ldm list
output shows the memory for each domain in the Memory field. The first ldm add-mem
command adds 100 Mbytes of memory to the ldom2
domain. The next ldm add-mem
command specifies the --auto-adj
option, which causes an additional 112 Mbytes of memory to be dynamically added to ldom2
.
The ldm remove-mem
command dynamically removes 100 Mbytes from the ldom2
domain. If you specify the --auto-adj
option to the same command to remove 300 Mbytes of memory, the amount of memory is rounded down to the next 256-Mbyte boundary.
primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 0.4% 1d 22h 53m ldom1 active -n---- 5000 2 2G 0.4% 1d 1h 23m ldom2 bound ------ 5001 2 200M primary# ldm add-mem 100M ldom2 primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 0.5% 1d 22h 54m ldom1 active -n---- 5000 2 2G 0.2% 1d 1h 25m ldom2 bound ------ 5001 2 300M primary# ldm add-mem --auto-adj 100M ldom2 Adjusting request size to 256M. The ldom2 domain has been allocated 112M more memory than requested because of memory alignment constraints. primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 0.4% 1d 22h 55m ldom1 active -n---- 5000 2 2G 0.5% 1d 1h 25m ldom2 bound ------ 5001 2 512M primary# ldm remove-mem 100M ldom2 primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 3.3% 1d 22h 55m ldom1 active -n---- 5000 2 2G 0.2% 1d 1h 25m ldom2 bound ------ 5001 2 412M primary# ldm remove-mem --auto-adj 300M ldom2 Adjusting request size to 256M. The ldom2 domain has been allocated 144M more memory than requested because of memory alignment constraints. primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 27392M 0.5% 1d 22h 55m ldom1 active -n---- 5000 2 2G 0.2% 1d 1h 26m ldom2 bound ------ 5001 2 256M
Example 15-9 Setting Domain Memory Sizes
This example shows how to use the ldm set-memory
command to add memory to and remove it from a domain.
The ldm list
output shows the memory for each domain in the Memory field.
primary# ldm list
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME
primary active -n-cv- SP 4 27392M 0.5% 1d 22h 55m
ldom1 active -n---- 5000 2 2G 0.2% 1d 1h 26m
ldom2 bound ------ 5001 2 256M
The following ldm set-mem
command attempts to set the primary
domain's size to 3400 Mbytes. The resulting error states that the specified value is not on a 256-Mbyte boundary. Adding the --auto-adj
option to the same command enables you to successfully remove some memory and stay on the 256-Mbyte boundary. This command also issues a warning to state that not all of the requested memory could be removed as the domain is using that memory.
primary# ldm set-mem 3400M primary An ldm set-mem 3400M command would remove 23992MB, which is not a multiple of 256MB. Instead, run ldm rm-mem 23808MB to ensure a 256MB alignment. primary# ldm set-mem --auto-adj 3400M primary Adjusting request size to 3.4G. The primary domain has been allocated 184M more memory than requested because of memory alignment constraints. Only 9472M of memory could be removed from the primary domain because the rest of the memory is in use.
The next ldm set-mem
command sets the memory size of the ldom2
domain, which is in the bound state, to 690 Mbytes. If you add the --auto-adj
option to the same command, an additional 78 Mbytes of memory is dynamically added to ldom2
to stay on a 256-Mbyte boundary.
primary# ldm set-mem 690M ldom2 primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 17920M 0.5% 1d 22h 56m ldom1 active -n---- 5000 2 2G 0.6% 1d 1h 27m ldom2 bound ------ 5001 2 690M primary# ldm set-mem --auto-adj 690M ldom2 Adjusting request size to 256M. The ldom2 domain has been allocated 78M more memory than requested because of memory alignment constraints. primary# ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 4 17920M 2.1% 1d 22h 57m ldom1 active -n---- 5000 2 2G 0.2% 1d 1h 27m ldom2 bound ------ 5001 2 768M