[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Fix xm commands for inactive domains

The commands 'mem-set' 'mem-max' and 'vcpu-set' are all broken when used 
against an inactive domain. The backend implementation of these commands
typically updates the in-memory config held by XenD, and does a hypercall
or xenstore write to update the live guest. Obviously the latter part fails
with inactive guests. The changes are also not persisted to disk.

The attached patch ensures that the hypercalls/xenstore writes are not
tried for inactive guests. It will also write out the changes to disk
so config changes to inactive guests are preserved across XenD restarts.

Normally memory_dynamic_min/max  and online_vcpus are picked up from the
running domain state. This doesn't apply for inactive guests, so when 
changing config for inactive guests, we also update those 3 parameters to
match the new settings. 

So, at the end of all this, I can do:

1. Define an inactive domain...

  # xm new demo
  # xm list demo
  Name                                      ID   Mem VCPUs      State   Time(s)
  demo                                           410     1                 0.0
  # xm list --long demo | grep mem
      (memory 410)
      (maxmem 800)
      (shadow_memory 0)
      (memory_dynamic_min 410)
      (memory_dynamic_max 800)

2. Change its memory config...

  # xm mem-set demo 500
  # xm mem-max demo 1000
  # xm list --long demo | grep mem
      (memory 500)
      (maxmem 1000)
      (shadow_memory 0)
      (memory_dynamic_min 500)
      (memory_dynamic_max 1000)
  # xm list demo
  Name                                      ID   Mem VCPUs      State   Time(s)
  demo                                           500     1                 0.0

3. Change its cpu config...

  # xm vcpu-set demo 8
  # xm list --long demo | grep vcpu
      (vcpus 8)
      (online_vcpus 8)
  # xm list demo
  Name                                      ID   Mem VCPUs      State   Time(s)
  demo                                           500     8                 0.0

4. Start it with new settings...

  # xm start demo
  # xm list demo
  Name                                      ID   Mem VCPUs      State   Time(s)
  demo                                      22   500     8     -b----      0.7

NB, the patch is structured so there is no functional change for active
guests, to minimise risk of regression in this 3.0.4 freeze. I think this
is really important to get working in 3.0.4 since inactive domain support
is of pretty limited usefullness as it currently stands.  Hopefully in 3.0.5
the XenAPI will make it possible to change all aspects of an inactive guest

  Signed-off-by: Daniel P. Berrange  <berrange@xxxxxxxxxx>

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

Attachment: xen-3.0.4-inactive-config-change.patch
Description: Text document

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.