[Ovirt-devel] Re: [PATCH server] provide default vm allocated cpu and memory values

Jason Guiditta jguiditt at redhat.com
Fri Jul 24 18:27:42 UTC 2009


On Fri, 2009-07-24 at 14:02 -0400, Mohammed Morsi wrote:
> ---
>  src/db/migrate/041_vm_cpu_and_memory_defaults.rb |   29 ++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
>  create mode 100644 src/db/migrate/041_vm_cpu_and_memory_defaults.rb
> 
> diff --git a/src/db/migrate/041_vm_cpu_and_memory_defaults.rb b/src/db/migrate/041_vm_cpu_and_memory_defaults.rb
> new file mode 100644
> index 0000000..f33bc52
> --- /dev/null
> +++ b/src/db/migrate/041_vm_cpu_and_memory_defaults.rb
> @@ -0,0 +1,29 @@
> +# Copyright (C) 2009 Red Hat, Inc.
> +# Written by Mohammed Morsi <mmorsi at redhat.com>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> +
> +class VmCpuAndMemoryDefaults < ActiveRecord::Migration
> +  def self.up
> +    change_column :vms, :num_vcpus_allocated, :integer, :default => 1
> +    change_column :vms, :memory_allocated, :integer, :default => 262144 #256MB
> +  end
> +
> +  def self.down
> +    change_column :vms, :num_vcpus_allocated, :integer, :default => nil
> +    change_column :vms, :memory_allocated, :integer, :default => nil
> +  end
> +end

ACK, this applies and sets defaults fine.




More information about the ovirt-devel mailing list