diff options
Diffstat (limited to 'cloudmasterd')
-rw-r--r-- | cloudmasterd/lib/cloudmasterd.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cloudmasterd/lib/cloudmasterd.rb b/cloudmasterd/lib/cloudmasterd.rb index a2dcc22..f5151d1 100644 --- a/cloudmasterd/lib/cloudmasterd.rb +++ b/cloudmasterd/lib/cloudmasterd.rb @@ -108,6 +108,7 @@ module Cloudmasterd::Models t.column :email, :string, :null => false, :limit => 255 t.column :cloud, :string, :null => false, :limit => 255 t.column :state, :string, :null => false, :limit => 255 + #t.column :repo, :string, :null => false, :limit => 255 # Add the repo column capture the origin repo t.column :created_date, :datetime, :null => true end end @@ -140,24 +141,24 @@ module Cloudmasterd::Controllers # run the appropriate koan command to create the given "fqdn" # on the given "host" and "vol_group" - def _koan(host, fqdn, repo) + def _koan(host, system_name, repo) # Run the koan process - output = `func "#{host}" call virt install #{repo} #{fqdn} True #{fqdn} /images` + output = `func "#{host}" call virt install #{repo} #{system_name} True #{system_name} /images` # Throw an exception if the process failed raise output unless $?.success? # Make the new host autostart - `func "#{host}" call command run "ln -s /etc/xen/#{fqdn} /etc/xen/auto/"` + `func "#{host}" call command run "ln -s /etc/xen/#{system_name} /etc/xen/auto/"` end # POST /koan def create - machine_fqdn = input.machine_fqdn + system_name = input.system_name repo = input.repo email = input.email - cobbler_profile = _get_cobbler_profile(machine_fqdn, repo) + cobbler_profile = _get_cobbler_profile(system_name, repo) cobbler_distro = _get_cobbler_distro(cobbler_profile["distro"], repo) # Synchronize access before making the func calls @@ -165,9 +166,9 @@ module Cloudmasterd::Controllers @host = _get_best_host(cobbler_profile["virt_ram"], cobbler_distro["arch"]) begin - _koan(@host, machine_fqdn, repo) + _koan(@host, system_name, repo) - Machine.create :name => machine_fqdn, :email => email, :cloud => @host, :state => "Installing", :created_date => DateTime.now() + Machine.create :name => system_name, :email => email, :cloud => @host, :state => "Installing", :created_date => DateTime.now() render :_koan rescue Exception => e @exception = e |