}
/* add memtune only if there are any */
- if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
- def->mem.swap_hard_limit)
+ if ((def->mem.hard_limit &&
+ def->mem.hard_limit != VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) ||
+ (def->mem.soft_limit &&
+ def->mem.hard_limit != VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) ||
+ (def->mem.swap_hard_limit &&
+ def->mem.hard_limit != VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) ||
+ def->mem.min_guarantee) {
virBufferAddLit(buf, " <memtune>\n");
- if (def->mem.hard_limit) {
- virBufferAsprintf(buf, " <hard_limit unit='KiB'>"
- "%llu</hard_limit>\n", def->mem.hard_limit);
- }
- if (def->mem.soft_limit) {
- virBufferAsprintf(buf, " <soft_limit unit='KiB'>"
- "%llu</soft_limit>\n", def->mem.soft_limit);
- }
- if (def->mem.min_guarantee) {
- virBufferAsprintf(buf, " <min_guarantee unit='KiB'>"
- "%llu</min_guarantee>\n", def->mem.min_guarantee);
- }
- if (def->mem.swap_hard_limit) {
- virBufferAsprintf(buf, " <swap_hard_limit unit='KiB'>"
- "%llu</swap_hard_limit>\n", def->mem.swap_hard_limit);
- }
- if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
- def->mem.swap_hard_limit)
+ if (def->mem.hard_limit) {
+ virBufferAsprintf(buf, " <hard_limit unit='KiB'>"
+ "%llu</hard_limit>\n", def->mem.hard_limit);
+ }
+ if (def->mem.soft_limit) {
+ virBufferAsprintf(buf, " <soft_limit unit='KiB'>"
+ "%llu</soft_limit>\n", def->mem.soft_limit);
+ }
+ if (def->mem.min_guarantee) {
+ virBufferAsprintf(buf, " <min_guarantee unit='KiB'>"
+ "%llu</min_guarantee>\n", def->mem.min_guarantee);
+ }
+ if (def->mem.swap_hard_limit) {
+ virBufferAsprintf(buf, " <swap_hard_limit unit='KiB'>"
+ "%llu</swap_hard_limit>\n", def->mem.swap_hard_limit);
+ }
virBufferAddLit(buf, " </memtune>\n");
+ }
if (def->mem.hugepage_backed || def->mem.nosharepages || def->mem.locked) {
virBufferAddLit(buf, " <memoryBacking>\n");
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='MiB'>214</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <memtune>
+ <hard_limit unit='KiB'>9007199254740991</hard_limit>
+ </memtune>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>