[PATCH] Support for VMware Workstation to koan
by Rob Crittenden
Attached is a patch to add support for VMware Workstation to koan. This
builds on work done by Lee Faust last March and is mostly housekeeping
and other cleanups.
I've created a new virtualization type to distinguish it from VMware
Server, vmwarew.
I'm not sure if I got the guestOS part correct but I suspect that it
will work for the majority of cases, at least enough to get the
installation done. At a minimum it will prevent errors about installing
a 64-bit OS on a 32-bit VM.
I'm also sticking all files for a given VM into one directory,
/var/lib/vmware/%name. I did this so that in the VMware Workstation UI
you can select Delete from Disk and actually have everything removed.
The only other sticking point is the MAC address. In order to PXE boot
you need to have the address assigned in advance in cobbler from the
VMware range. For this to work with cobbler you need to change it to
allocate from this range (patch attached). That's fine if all you want
to do use run VMware VMs. It would be nice if cobbler could use the
koan-provided random_mac() method provided for each virtualization type.
I'm using the VMware dhcp server which is why the Ethernet0 device is
set to custom and the Ethernet0.vnet is set to vmnet1. It may be
possible to pass device info this along via the cmd-line but I haven't
investigated how.
My /etc/vmware/vmnet1/dhcpd/dhcpd.conf looks like:
allow unknown-clients;
default-lease-time 1800; # 30 minutes
max-lease-time 7200; # 2 hours
subnet 192.168.166.0 netmask 255.255.255.0 {
option routers 192.168.166.1;
range 192.168.166.128 192.168.166.254;
option broadcast-address 192.168.166.255;
option domain-name-servers 192.168.166.1;
option domain-name "example.com";
option subnet-mask 255.255.255.0;
next-server 192.168.0.26;
allow bootp;
allow booting;
filename "/pxelinux.0";
}
rob
15 years, 9 months
[PATCH] Added support for images to the Ruby bindings.
by Darryl L. Pierce
Also fixed some of the decoding for interfaces returned for systems. But I'm not happy with that binding still.
Signed-off-by: Darryl L. Pierce <dpierce(a)redhat.com>
---
contrib/ruby/examples/create_system.rb | 6 ++-
contrib/ruby/examples/has_image.rb | 65 ++++++++++++++++++++
contrib/ruby/examples/has_system.rb | 18 +++---
contrib/ruby/examples/list_images.rb | 52 ++++++++++++++++
contrib/ruby/examples/list_systems.rb | 19 +++++-
contrib/ruby/lib/cobbler.rb | 1 +
contrib/ruby/lib/cobbler/base.rb | 30 ++++++---
contrib/ruby/lib/cobbler/image.rb | 55 +++++++++++++++++
contrib/ruby/lib/cobbler/network_interface.rb | 4 +-
contrib/ruby/lib/cobbler/system.rb | 43 +++++++-------
contrib/ruby/test/test_image.rb | 80 +++++++++++++++++++++++++
contrib/ruby/test/test_system.rb | 28 ++++++---
12 files changed, 344 insertions(+), 57 deletions(-)
mode change 100644 => 100755 contrib/ruby/examples/create_system.rb
mode change 100644 => 100755 contrib/ruby/examples/has_distro.rb
create mode 100755 contrib/ruby/examples/has_image.rb
mode change 100644 => 100755 contrib/ruby/examples/has_profile.rb
mode change 100644 => 100755 contrib/ruby/examples/has_system.rb
mode change 100644 => 100755 contrib/ruby/examples/list_distros.rb
create mode 100755 contrib/ruby/examples/list_images.rb
mode change 100644 => 100755 contrib/ruby/examples/list_profiles.rb
mode change 100644 => 100755 contrib/ruby/examples/list_systems.rb
mode change 100644 => 100755 contrib/ruby/examples/remove_distro.rb
mode change 100644 => 100755 contrib/ruby/examples/remove_system.rb
create mode 100644 contrib/ruby/lib/cobbler/image.rb
create mode 100644 contrib/ruby/test/test_image.rb
diff --git a/contrib/ruby/examples/create_system.rb b/contrib/ruby/examples/create_system.rb
old mode 100644
new mode 100755
index 0196573..43a8fc4
--- a/contrib/ruby/examples/create_system.rb
+++ b/contrib/ruby/examples/create_system.rb
@@ -60,9 +60,13 @@ end
if name && profile
+ System.hostname = hostname if hostname
+ System.username = username if username
+ System.password = password if password
+
system = System.new('name' => name,'profile' => profile)
- system.interfaces=[ NetworkInterface.new('mac_address' => '00:11:22:33:44:55:66:77') ]
+ system.interfaces=[NetworkInterface.new(["intf",{'mac_address' => '00:11:22:33:44:55:66:77'}])]
puts "Saving a new system with name #{system.name} based on the profile #{system.profile}."
diff --git a/contrib/ruby/examples/has_distro.rb b/contrib/ruby/examples/has_distro.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/examples/has_image.rb b/contrib/ruby/examples/has_image.rb
new file mode 100755
index 0000000..8442f6e
--- /dev/null
+++ b/contrib/ruby/examples/has_image.rb
@@ -0,0 +1,65 @@
+#!/usr/bin/ruby
+#
+# has_image.rb - example of using rubygem-cobbler to check if an image exists.
+#
+# Copyright (C) 2008 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierceredhat.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.
+
+base = File.expand_path(File.join(File.dirname(__FILE__), ".."))
+$LOAD_PATH << File.join(base, "lib")
+$LOAD_PATH << File.join(base, "examples")
+
+require 'getoptlong'
+
+require 'cobbler'
+
+include Cobbler
+
+opts = GetoptLong.new(
+ ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--image", "-i", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--help", "-h", GetoptLong::NO_ARGUMENT]
+)
+
+hostname = nil
+image = nil
+
+opts.each do |opt, arg|
+ case opt
+ when '--server' then hostname = arg
+ when '--image' then image = arg
+ when '--help' then
+ puts "Usage: #{$0} --server hostname --image image-name\n"
+ end
+end
+
+SystemExit.new('No hostname specified.') unless hostname
+
+if hostname
+ Base.hostname = hostname
+
+ puts "Finding any system that matches \"#{image}\""
+
+ result = Image.find_one(image)
+
+ if result
+ puts "#{result.name} exists, and uses #{result.file}."
+ else
+ puts "No such system: #{image}"
+ end
+end
\ No newline at end of file
diff --git a/contrib/ruby/examples/has_profile.rb b/contrib/ruby/examples/has_profile.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/examples/has_system.rb b/contrib/ruby/examples/has_system.rb
old mode 100644
new mode 100755
index 9088666..69c52a9
--- a/contrib/ruby/examples/has_system.rb
+++ b/contrib/ruby/examples/has_system.rb
@@ -50,16 +50,14 @@ end
SystemExit.new('No hostname specified.') unless hostname
-if hostname
- Base.hostname = hostname
+Base.hostname = hostname if hostname
- puts "Finding any system that matches \"#{system}\""
+puts "Finding any system that matches \"#{system}\""
- result = System.find_one(system)
+result = System.find_one(system)
- if result
- puts "#{result.name} exists, and is owned by #{result.owners}."
- else
- puts "No such system: #{system}"
- end
-end
\ No newline at end of file
+if result
+ puts "#{result.name} exists, and is owned by #{result.owners}."
+else
+ puts "No such system: #{system}"
+end
diff --git a/contrib/ruby/examples/list_distros.rb b/contrib/ruby/examples/list_distros.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/examples/list_images.rb b/contrib/ruby/examples/list_images.rb
new file mode 100755
index 0000000..0df5611
--- /dev/null
+++ b/contrib/ruby/examples/list_images.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/ruby
+#
+# list_images.rb - example of using rubygem-cobbler to list images.
+#
+# Copyright (C) 2008 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce(a)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.
+
+base = File.expand_path(File.join(File.dirname(__FILE__), ".."))
+$LOAD_PATH << File.join(base, "lib")
+$LOAD_PATH << File.join(base, "examples")
+
+require 'getoptlong'
+
+require 'cobbler'
+
+include Cobbler
+
+opts = GetoptLong.new(
+ ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--help", "-h", GetoptLong::NO_ARGUMENT]
+)
+
+hostname = nil
+
+opts.each do |opt, arg|
+ case opt
+ when '--server' then hostname = arg
+ when '--help' then
+ puts "Usage: #{$0} --server hostname\n"
+ end
+end
+
+
+Base.hostname = hostname if hostname
+
+puts "Results:"
+Image.find { |image| puts "\"#{image.name}\" uses \"#{image.file}\"."}
diff --git a/contrib/ruby/examples/list_profiles.rb b/contrib/ruby/examples/list_profiles.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/examples/list_systems.rb b/contrib/ruby/examples/list_systems.rb
old mode 100644
new mode 100755
index d614460..fbee42c
--- a/contrib/ruby/examples/list_systems.rb
+++ b/contrib/ruby/examples/list_systems.rb
@@ -31,15 +31,18 @@ require 'cobbler'
include Cobbler
opts = GetoptLong.new(
- ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
- ["--help", "-h", GetoptLong::NO_ARGUMENT]
+ ["--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
+ ["--details", "-d", GetoptLong::NO_ARGUMENT ],
+ ["--help", "-h", GetoptLong::NO_ARGUMENT ]
)
hostname = nil
+details = false
opts.each do |opt, arg|
case opt
- when '--server' then hostname = arg
+ when '--server' then hostname = arg
+ when '--details' then details = true
when '--help' then
puts "Usage: #{$0} --server hostname\n"
end
@@ -49,4 +52,12 @@ end
Base.hostname = hostname if hostname
puts "Results:"
-System.find { |system| puts "\"#{system.name}\" is based on \"#{system.profile}\"."}
+System.find do |system|
+ puts "\"#{system.name}\" is based on \"#{system.profile}\"."
+
+ if details
+ puts "\tOwner: #{system.owners}"
+ system.interfaces.each { |nic| puts "\tNIC: #{nic.mac_address}"}
+ end
+
+end
\ No newline at end of file
diff --git a/contrib/ruby/examples/remove_distro.rb b/contrib/ruby/examples/remove_distro.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/examples/remove_system.rb b/contrib/ruby/examples/remove_system.rb
old mode 100644
new mode 100755
diff --git a/contrib/ruby/lib/cobbler.rb b/contrib/ruby/lib/cobbler.rb
index 379d746..1247a63 100644
--- a/contrib/ruby/lib/cobbler.rb
+++ b/contrib/ruby/lib/cobbler.rb
@@ -20,6 +20,7 @@
require 'cobbler/base'
require 'cobbler/distro'
+require 'cobbler/image'
require 'cobbler/network_interface'
require 'cobbler/profile'
require 'cobbler/system'
diff --git a/contrib/ruby/lib/cobbler/base.rb b/contrib/ruby/lib/cobbler/base.rb
index a2b3e83..ea75ef3 100644
--- a/contrib/ruby/lib/cobbler/base.rb
+++ b/contrib/ruby/lib/cobbler/base.rb
@@ -30,9 +30,10 @@ module Cobbler
# Child classes can define fields that will be retrieved from Cobbler by
# using the +cobbler_field+ method. For example:
#
- # class Farkle < Base
- # cobbler_field :name, findable => 'get_farkle'
- # cobbler_field :owner
+ # class System < Base
+ # cobbler_lifecycle :find_all => 'get_systems'
+ # cobbler_field :name
+ # cobbler_field :owner, :array => 'String'
# end
#
# declares a class named Farkle that contains two fields. The first, "name",
@@ -106,7 +107,7 @@ module Cobbler
@@connection = nil
end
- def definition(key)
+ def definition(key)
@definitions ? @definitions[key] : nil
end
@@ -203,8 +204,8 @@ module Cobbler
when :findable then
module_eval <<-"end;"
- def self.find_by_#{field.to_s}(name,&block)
- properties = make_call('#{arg[key]}',name)
+ def self.find_by_#{field.to_s}(value,&block)
+ properties = make_call('#{arg[key]}',value)
return create(properties) if properties && !properties.empty?
@@ -232,17 +233,26 @@ module Cobbler
# other class must be provided.
#
def cobbler_collection(field, *args) # :nodoc:
- classname = args[0][:type]
+ classname = 'String'
+ packing = :array
+
+ # process collection definition
+ args.each do |arg|
+ classname = arg[:type] if arg[:type]
+ packing = arg[:packing] if arg[:packing]
+ end
module_eval <<-"end;"
def #{field.to_s}(&block)
+
unless @#{field.to_s}
@#{field.to_s} = Array.new
- definition('#{field.to_s}').values.each do |value|
- @#{field.to_s} << #{classname}.new(value)
+ definition('#{field.to_s}').each do |value|
+ if value
+ @#{field.to_s} << #{classname}.new(value)
+ end
end
-
end
@#{field.to_s}
diff --git a/contrib/ruby/lib/cobbler/image.rb b/contrib/ruby/lib/cobbler/image.rb
new file mode 100644
index 0000000..ce12dac
--- /dev/null
+++ b/contrib/ruby/lib/cobbler/image.rb
@@ -0,0 +1,55 @@
+# image.rb
+#
+# Copyright (C) 2008 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce(a)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.
+
+module Cobbler
+
+ # +Image+ represents an image within Cobbler.
+ #
+ class Image < Base
+
+ cobbler_lifecycle :find_all => 'get_images',
+ :find_one => 'get_image',
+ :remove => 'remove_image'
+
+ cobbler_field :name
+ cobbler_field :owners
+ cobbler_field :depth
+ cobbler_field :virt_file_size
+ cobbler_field :virt_path
+ cobbler_field :xml_file
+ cobbler_field :virt_bridge
+ cobbler_field :virt_ram
+ cobbler_field :file
+ cobbler_field :virt_cpus
+ cobbler_field :parent
+
+ def initialize(definitions)
+ super(definitions)
+ end
+
+ private
+
+ # Creates a new instance of +System+ from a result received from Cobbler.
+ #
+ def self.create(attrs)
+ Image.new(attrs)
+ end
+ end
+end
\ No newline at end of file
diff --git a/contrib/ruby/lib/cobbler/network_interface.rb b/contrib/ruby/lib/cobbler/network_interface.rb
index 5ef4a3b..3437714 100644
--- a/contrib/ruby/lib/cobbler/network_interface.rb
+++ b/contrib/ruby/lib/cobbler/network_interface.rb
@@ -30,8 +30,8 @@ module Cobbler
cobbler_field :virt_bridge
cobbler_field :ip_address
- def initialize(definitions)
- @definitions = definitions
+ def initialize(args)
+ @definitions = args[1]
end
# A hack for getting the NIC's details over the wire.
diff --git a/contrib/ruby/lib/cobbler/system.rb b/contrib/ruby/lib/cobbler/system.rb
index acfa3f5..c15d225 100644
--- a/contrib/ruby/lib/cobbler/system.rb
+++ b/contrib/ruby/lib/cobbler/system.rb
@@ -28,24 +28,23 @@ module Cobbler
:find_one => 'get_system',
:remove => 'remove_system'
- cobbler_field :name
- cobbler_field :parent
- cobbler_field :profile
- cobbler_field :depth
- cobbler_field :kernel_options
- cobbler_field :kickstart
- cobbler_field :ks_meta
- cobbler_field :netboot_enabled
- cobbler_field :owners
- cobbler_field :server
- cobbler_field :virt_cpus
- cobbler_field :virt_file_size
- cobbler_field :virt_path
- cobbler_field :virt_ram
- cobbler_field :virt_type
- cobbler_field :virt_bridge
-
- cobbler_collection :interfaces, :type => 'NetworkInterface'
+ cobbler_field :name
+ cobbler_field :parent
+ cobbler_field :profile
+ cobbler_field :depth
+ cobbler_field :kernel_options
+ cobbler_field :kickstart
+ cobbler_field :ks_meta
+ cobbler_field :netboot_enabled
+ cobbler_collection :owners
+ cobbler_field :server
+ cobbler_field :virt_cpus
+ cobbler_field :virt_file_size
+ cobbler_field :virt_path
+ cobbler_field :virt_ram
+ cobbler_field :virt_type
+ cobbler_field :virt_bridge
+ cobbler_collection :interfaces, :type => 'NetworkInterface', :packing => :hash
def initialize(definitions)
super(definitions)
@@ -62,13 +61,13 @@ module Cobbler
Base.make_call('modify_system',sysid,'name',self.name,token)
Base.make_call('modify_system',sysid,'profile',profile,token)
- unless interfaces.empty?
+ if @interfaces
count = 0
- interfaces.each do |interface|
+ @interfaces.each do |interface|
- values = interface.bundle_for_saving(count)
+ values = interface.bundle_for_saving(count)
- unless values.empty?
+ unless values.empty?
Base.make_call('modify_system',sysid,'modify-interface',values,token)
count = count + 1
end
diff --git a/contrib/ruby/test/test_image.rb b/contrib/ruby/test/test_image.rb
new file mode 100644
index 0000000..02b2776
--- /dev/null
+++ b/contrib/ruby/test/test_image.rb
@@ -0,0 +1,80 @@
+# test_image.rb - Tests the Image class.
+#
+# Copyright (C) 2008 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce(a)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.
+
+
+$:.unshift File.join(File.dirname(__FILE__),'..','lib')
+
+require 'test/unit'
+require 'flexmock/test_unit'
+require 'cobbler'
+
+module Cobbler
+ class TestImage < Test::Unit::TestCase
+ def setup
+ @connection = flexmock('connection')
+ Image.connection = @connection
+ Image.hostname = "localhost"
+
+ @username = 'dpierce'
+ @password = 'farkle'
+ Image.username = @username
+ Image.password = @password
+
+ @images = Array.new
+ @images << {
+ 'name' => 'Fedora-9-LiveCD-KDE',
+ 'owners' => 'admin',
+ 'depth' => '2',
+ 'virt_file_size' => '<<inherit>>',
+ 'virt_path' => '<<inherit>>',
+ 'virt_bridge' => '<<inherit>>',
+ 'virt_ram' => '<<inherit>>',
+ 'virt_cpus' => '<<inherit>>',
+ 'file' => '/var/ftp/pub/Fedora-9-i686-Live-KDE.iso',
+ 'parent' => nil,
+ }
+
+ @images << {
+ 'name' => 'Fedora-9-LiveCD-GNOME',
+ 'owners' => 'admin',
+ 'depth' => '2',
+ 'virt_file_size' => '<<inherit>>',
+ 'virt_path' => '<<inherit>>',
+ 'virt_bridge' => '<<inherit>>',
+ 'virt_ram' => '<<inherit>>',
+ 'virt_cpus' => '<<inherit>>',
+ 'file' => '/var/ftp/pub/Fedora-9-i686-Live.iso',
+ 'parent' => nil,
+ }
+
+ end
+
+ # Ensures that an attempt to find all profiles works as expected.
+ #
+ def test_find
+ @connection.should_receive(:call).with('get_images').once.returns(@images)
+
+ result = Image.find
+
+ assert result, 'Expected a result set.'
+ assert_equal 2, result.size, 'Did not receive the right number of results'
+ end
+ end
+end
diff --git a/contrib/ruby/test/test_system.rb b/contrib/ruby/test/test_system.rb
index b56d564..cc64e84 100644
--- a/contrib/ruby/test/test_system.rb
+++ b/contrib/ruby/test/test_system.rb
@@ -23,6 +23,7 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
require 'test/unit'
require 'flexmock/test_unit'
+require 'flexmock/argument_matchers'
require 'cobbler'
module Cobbler
@@ -43,20 +44,25 @@ module Cobbler
@profile = 'profile1'
@nics = Array.new
@nic_details = {'mac_address' => '00:11:22:33:44:55:66:77'}
- @nics <<
- NetworkInterface.new(@nic_details)
+ @nic = NetworkInterface.new(['intf0',@nic_details])
+ @nics << @nic
@systems = Array.new
@systems << {
'name' => 'Web-Server',
- 'owners' => 'admin',
+ 'owners' => ['admin','dpierce','mpdehaan'],
'profile' => 'Fedora-9-i386',
'depth' => '2',
'virt_file_size' => '<<inherit>>',
'virt_path' => '<<inherit>>',
'virt_type' => '<<inherit>>',
'server' => '<<inherit>>',
- 'interfaces' => 'intf0dhcp_tagmac_address00:11:22:33:44:55subnetgatewayhostnamevirt_bridgeip_address',
+ 'interfaces' => {
+ 'intf0' => {
+ 'mac_address' => '00:11:22:33:44:55'},
+ 'intf1' => {
+ 'mac_address' => '00:11:22:33:44:55'}
+ },
'virt_bridge' => '<<inherit>>',
'virt_ram' => '<<inherit>>',
'ks_meta' => nil,
@@ -76,7 +82,9 @@ module Cobbler
'virt_path' => '<<inherit>>',
'virt_type' => '<<inherit>>',
'server' => '<<inherit>>',
- 'interfaces' => 'intf0dhcp_tagmac_address00:11:22:33:44:55subnetgatewayhostnamevirt_bridgeip_address',
+ 'interfaces' => {
+ 'intf0' => {
+ 'mac_address' => 'AA:BB:CC:DD:EE:FF'}},
'virt_bridge' => '<<inherit>>',
'virt_ram' => '<<inherit>>',
'ks_meta' => nil,
@@ -97,7 +105,10 @@ module Cobbler
result = System.find
assert result, 'Expected a result set.'
- assert_equal 2, result.size, 'Did not receive the right number of results'
+ assert_equal 2, result.size, 'Did not receive the right number of results.'
+ assert_equal 2, result[0].interfaces.size, 'Did not parse the NICs correctly.'
+ result[0].interfaces.collect do |nic| assert_equal "00:11:22:33:44:55", nic.mac_address end
+ assert_equal 3, result[0].owners.size, 'Did not parse the owners correctly.'
end
# Ensures that saving a system works as expected.
@@ -117,12 +128,13 @@ module Cobbler
# Ensures that saving a system works as expected even when network interfaces
# are involved.
#
- def test_save
+ def test_save_with_new_nics
@connection.should_receive(:call).with('login',@username,@password).once.returns((a)auth_token)
@connection.should_receive(:call).with('new_system',@auth_token).once.returns((a)system_id)
@connection.should_receive(:call).with('modify_system',@system_id,'name',@system_name,(a)auth_token).once.returns(true)
@connection.should_receive(:call).with('modify_system',@system_id,'profile',@profile_name,(a)auth_token).once.returns(true)
- @connection.should_receive(:call).with('modify_system',@system_id,'modify-interface',any,(a)auth_token).once.returns(true)
+ @connection.should_receive(:call).with("modify_system",@system_id,'modify-interface',
+ @nic.bundle_for_saving(0),(a)auth_token).once.returns(true)
@connection.should_receive(:call).with('save_system',@system_id,(a)auth_token).once.returns(true)
system = System.new(:name => @system_name, :profile => @profile_name)
--
1.5.5.1
15 years, 9 months
Cannot hardlink across devices?
by Rainer Duffner
Hi,
something changed in the dev-version from yesterday to today.
[root@zeus1 ~]# cobbler sync
Cannot hardlink across devices.
[root@zeus1 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6856200 1258412 5243896 20% /
/dev/mapper/VolGroup00-LogVol02
4062912 239940 3613260 7% /var
/dev/mapper/VolGroup00-LogVol03
4062912 167600 3685600 5% /var/log
/dev/mapper/VolGroup00-LogVol04
49644228 17780192 29302012 38% /var/www
/dev/cciss/c0d0p1 147764 11638 128497 9% /boot
tmpfs 647708 0 647708 0% /dev/shm
cobbler repo-stuff is in /var/www ...
What to do now?
Regards,
Rainer
15 years, 9 months
Setting Kickstart network details for Koan virtual install?
by HARRIS Jimmy (AXA-Tech-AU)
Can anyone explain how to specify network details for Kickstart when
using koan to do a virtual install? I am working in an environment
without DHCP and while the install works well, I am being prompted for
network details every time.
The command I'm using is:
koan --virt --server=[cobbler server] --system=[system name]
I've tried setting kickstart metadata parameters for "ip=... netmask=...
etc." in the Cobbler system record but they don't seem to get passed
through to the installation.
James
*********************************************************************************
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege. If you are not
the intended recipient you must not use, distribute or copy this
email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA-Tech Australia. Thank you.
**********************************************************************************
15 years, 9 months
Clearing encrypted partitions
by Steven W. Carter
Here's an interesting question: I have an encrypted filesystem on a hard
drive, and then when the kickstart tries to run "clearpart --all" it still
asks me for the passphrase to unlock the old partition. Is there a
"correct" way around this, or should I insert a command before that to clear
it with fdisk?
15 years, 9 months
Do the per-profile and per-system snippets override the "default" snippet?
by Rainer Duffner
Hi,
the per-profile and per-system snippet stuff is cool - but it seems the
custom snippet overrides the default one.
While I can see that this is something people may also want, it's not
what I need.
The per-profile or per-system snippets I want are in 99% of the cases
additions to what the "standard" snippet delivers.
Can this be implemented?
cheers,
Rainer
15 years, 9 months
Updated Wiki article about "Image Support"
by Michael DeHaan
This rolls up all the image work being done so far and what is doable,
which use "cobbler distro add" and which use "cobbler image", and how
these things work:
https://fedorahosted.org/cobbler/wiki/AllAboutImages
I'm sure this will get refined over time so this should be considered
experimental for 1.1/1.2
Comments welcome as always.
We had talked about the cloning idea, and even though that is a live CD
based "image" it turns out that livecd-iso-to-pxe creates a
kernel/initrd file. Given it does this, technically that uses "cobbler
distro add" and not "cobbler image add".
The Wiki article should straighten things out.
--Michael
15 years, 9 months
Simple Cobbler install - suggestions for docs
by Alex Davies
Hi All,
I've been looking at Cobbler for some time, and i've finally had cause
to use it to provision a relatively small number of machines (~50).
Its an ace tool, and has worked really well. I've only just started
looking into its more advanced features, and i'm already amazed!
During the course of installing Cobbler, I found some paths at
http://cobbler.et.redhat.com/cobbler-dhcp.php (at least incorrect on a
RHEL5 machine). I'd have thought that RHEL5/FC6 would be the standard
"stable" distribution to install Cobbler onto, so thought it might be
worth updating the paragraph "Enabling DHCP Management" to read the
following:
"Change /etc/cobbler/settings so that manage_dhcp has the value of 1.
Edit /etc/cobbler/cobbler/dhcp.template to taste -- mainly just making
sure that the DHCP information is correct."
I also wondered if it would be sensible to include the variations from
the sample kickstarts that are required to kickstart RHEL{3,4,5}
perhaps in comments inside sample.ks? I couldnt find it documented
anywhere (i'm sure it is, but I ended up working this out by trial end
error):
For RHEL5
# Add activation Keys - Otherwise hangs waiting for activation key
key --skip
For RHEL4
# Add System language - Otherwise hangs waiting for default language choice
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
For RHEL3:
# Remove --onboot=on from the network line
# Remove selinux --disabled
# Add mouse:
mouse genericps/2 --device psaux --emulthree
I'll try to add some of this to the Wiki, but there doesent seem to be
an obvious place - any suggestions?
Alex
15 years, 9 months
Duplicating a Golden Client
by Guy Tel-Zur
I would appreciate seeing an example how to duplicate an already installed
node (a "Golden Client")
and then PXE booting other nodes with the Golden Client image using Cobbler.
(I am familiar with "system-config-netboot", this tool relies on using
"rsync" first)
Regards,
Guy
15 years, 9 months