Difference between revisions of "OpenStack Configuration Example"

From Xen
(Recipes files)
(Recipes files)
Line 16: Line 16:
 
default_boot = 0
 
default_boot = 0
 
current_default = nil
 
current_default = nil
  +
 
# parse menu.lst, to find boot index for selected flavor
 
# parse menu.lst, to find boot index for selected flavor
 
File.open('/boot/grub/menu.lst') do |f|
 
File.open('/boot/grub/menu.lst') do |f|
 
f.lines.each do |line|
 
f.lines.each do |line|
 
current_default = line.scan(/\d/).first.to_i if line.start_with?('default')
 
current_default = line.scan(/\d/).first.to_i if line.start_with?('default')
  +
 
if line.start_with?('title')
 
if line.start_with?('title')
 
if flavor.eql?('xen')
 
if flavor.eql?('xen')
Line 28: Line 30:
 
break unless line.include?('Xen')
 
break unless line.include?('Xen')
 
end
 
end
  +
 
default_boot += 1
 
default_boot += 1
 
end
 
end
  +
 
end
 
end
 
end
 
end

Revision as of 09:18, 22 November 2014

The SUSE Cloud project contains a fully operational OpenStack implementation for Xen Project. It is an example of how to successfully employ Xen Project in OpenStack. This page attempts to document the Xen Project-specific configuration elements as an example of what a functional implementation might look like. As such, this page is less a "How To" and more a "What Is".

Where to Find the Configuration Files

The bulk of the Xen Project-specific entries will be in the Barclamp section of the Nova project within OpenStack. Most of these files can be found in the following trees:

Recipes files

The following are the Xen Project-specific segments from compute.rb configuration file:

def set_boot_kernel_and_trigger_reboot(flavor='default')
# only default and xen flavor is supported by this helper right now
 default_boot = 0
 current_default = nil

 # parse menu.lst, to find boot index for selected flavor
  File.open('/boot/grub/menu.lst') do |f|
  f.lines.each do |line|
   current_default = line.scan(/\d/).first.to_i if line.start_with?('default')

   if line.start_with?('title')
   if flavor.eql?('xen')
    # found boot index
    break if line.include?('Xen')
   else
    # take first non-xen kernel as default
    break unless line.include?('Xen')
   end

  default_boot += 1
  end

 end
end