From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Novotny Subject: [PATCH] Introduce dom0-min-space configuration option Date: Mon, 12 Jul 2010 20:07:58 +0200 Message-ID: <4C3B59FE.2060201@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010507040900020103090101" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "'xen-devel@lists.xensource.com'" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010507040900020103090101 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, This is the patch to introduce configuration option called dom0-min-space since there were some issues with data inflation because of invalid input data stream for zlib decompression. The issue occured because of insufficient free space on the dom0 so this patch checks the free available space for /var/lib/xen and refuses to start up any guests when the space is below specified value. Setting up the value to 0 disables the check which preserves the behaviour before this patch applied and this is the default value for this option. Michal Signed-off-by: Michal Novotny -- Michal Novotny, RHCE Virtualization Team (xen userspace), Red Hat --------------010507040900020103090101 Content-Type: text/x-patch; name="xen-introduce-dom0-min-space.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-introduce-dom0-min-space.patch" diff -r 9f08c4e82037 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Mon Jul 12 18:39:18 2010 +0100 +++ b/tools/examples/xend-config.sxp Mon Jul 12 22:05:56 2010 +0200 @@ -205,6 +205,11 @@ # enable-dom0-ballooning below) and for xm mem-set when applied to dom0. (dom0-min-mem 196) +# Dom0 will need at least specified amount of free space for +# /var/lib/xen otherwise it will refuse to start up any new +# guests. Value is in MB and setting it to 0 disables the check. +(dom0-min-space 0) + # Whether to enable auto-ballooning of dom0 to allow domUs to be created. # If enable-dom0-ballooning = no, dom0 will never balloon out. (enable-dom0-ballooning yes) diff -r 9f08c4e82037 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Mon Jul 12 18:39:18 2010 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Mon Jul 12 22:05:56 2010 +0200 @@ -2837,6 +2837,16 @@ self._configureBootloader() + # Check whether dom0 does have enough free space to create the guest + stat = os.statvfs("/var/lib/xen") + free = int((stat.f_bsize * stat.f_bavail) / 1048576) + log.debug("Free space for Xen files on dom0: %s MiB" % free) + dom0_min_space = xoptions.instance().get_dom0_min_space() + if dom0_min_space > 0 and free < dom0_min_space: + raise XendError('Dom0 requires at least %s MiBs free space for ' + '/var/lib/xen but only %s MiBs is available.' % + (dom0_min_space, free)) + try: self.image = image.create(self, self.info) diff -r 9f08c4e82037 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Mon Jul 12 18:39:18 2010 +0100 +++ b/tools/python/xen/xend/XendOptions.py Mon Jul 12 22:05:56 2010 +0200 @@ -105,6 +105,8 @@ dom0_min_mem_default = 0 + dom0_min_space_default = 0 + reserved_memory_default = 0 dom0_vcpus_default = 0 @@ -359,6 +361,9 @@ def get_dom0_min_mem(self): return self.get_config_int('dom0-min-mem', self.dom0_min_mem_default) + def get_dom0_min_space(self): + return self.get_config_int('dom0-min-space', self.dom0_min_space_default) + def get_enable_dom0_ballooning(self): enable_dom0_ballooning_default = 'yes' if self.get_dom0_min_mem() == 0: --------------010507040900020103090101 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010507040900020103090101--