Citrix XenServer: how to add RAM to a guest VM without XenCenter

xenxenserver

Is it possible to add RAM to a guest VM in without using XenCenter, but from the host machine console or a remote machine?

Best Answer

In XenServer 6.0, this can be done with the vm-memory-limits-set command:

[root@localhost 1274]# xe help vm-memory-limits-set
command name            : vm-memory-limits-set
        reqd params     : static-min, static-max, dynamic-min, dynamic-max
        optional params : <vm-selectors>
        description     : Configure the memory limits of a VM. The simplest way to select the VM on which the operation is to be performed is by supplying the argument 'vm=<name or uuid>'. VMs can also be specified by filtering the full list of VMs on the values of fields. For example, specifying 'power-state=halted' will select all VMs whose power-state field is equal to 'halted'. Where multiple VMs are matching, the option '--multiple' must be specified to perform the operation. The full list of fields that can be matched can be obtained by the command 'xe vm-list params=all'. If no parameters to select VMs are given, the operation will be performed on all VMs.

Assuming the VM is powered down, here is an example of actually using it:

[root@localhost 1274]# xe vm-list name-label=Local-PerformanceVM params=all |grep memory
                 memory-actual ( RO): 0
                 memory-target ( RO): <expensive field>
               memory-overhead ( RO): 4194304
             memory-static-max ( RW): 268435456
            memory-dynamic-max ( RW): 268435456
            memory-dynamic-min ( RW): 268435456
             memory-static-min ( RW): 16777216
               recommendations ( RO): <restrictions><restriction field="memory-static-max" max="34359738368" /><restriction field="vcpus-max" max="8" /><restriction property="number-of-vbds" max="7" /><restriction property="number-of-vifs" max="7" /></restrictions>
                        memory (MRO):
[root@localhost 1274]# xe vm-memory-limits-set dynamic-max=300000000 dynamic-min=300000000 static-max=300000000 static-min=16777216 name-label=Local-PerformanceVM
[root@localhost 1274]# xe vm-list name-label=Local-PerformanceVM params=all |grep memory
                 memory-actual ( RO): 0
                 memory-target ( RO): <expensive field>
               memory-overhead ( RO): 5242880
             memory-static-max ( RW): 300000000
            memory-dynamic-max ( RW): 300000000
            memory-dynamic-min ( RW): 300000000
             memory-static-min ( RW): 16777216
               recommendations ( RO): <restrictions><restriction field="memory-static-max" max="34359738368" /><restriction field="vcpus-max" max="8" /><restriction property="number-of-vbds" max="7" /><restriction property="number-of-vifs" max="7" /></restrictions>
                        memory (MRO):
[root@localhost 1274]#