Perry Myers
2008-Sep-24 07:28 UTC
[Ovirt-devel] [PATCH server] Call setup provisioning method from create as well as edit and pass mac as arg
Addition of the edit vm screen broke provisioning of vms on create since the format of the provisioning names changed. The names were no longer being prefixed with the words cobbler or profile. This caused taskomatic to skip the section where the cobbler system create was done meaning the vm would never be provisioned. Fix is to have create vm call the provisioning method the same way edit does. The taskomatic stuff can probably be removed for the time being, but I'm going to leave it in since I'm not sure this is the right way to solve this problem long term. Also, the setup provisioning method did not associate the MAC of the new system to the cobbler system making that call useless. This is also fixed now. This fix is being committed without review since it fixes a major bug and we're wrapping up for a release. Signed-off-by: Perry Myers <pmyers at redhat.com> --- src/app/controllers/vm_controller.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/app/controllers/vm_controller.rb b/src/app/controllers/vm_controller.rb index 6d06b48..b6192e2 100644 --- a/src/app/controllers/vm_controller.rb +++ b/src/app/controllers/vm_controller.rb @@ -54,6 +54,7 @@ class VmController < ApplicationController :state => Task::STATE_QUEUED}) @task.save! end + _setup_vm_provision(params) start_now = params[:start_now] if (start_now) if @vm.get_action_list.include?(VmTask::ACTION_START_VM) @@ -239,6 +240,7 @@ class VmController < ApplicationController # spaces are invalid in the cobbler name name = params[:vm][:description].gsub(" ", "-") provision = params[:vm][:provisioning_and_boot_settings] + mac = params[:vm][:vnic_mac_addr] unless provision == Vm::PXE_OPTION_VALUE or provision == Vm::HD_OPTION_VALUE found = false @@ -252,7 +254,7 @@ class VmController < ApplicationController unless found system = Cobbler::System.create("name" => name, "profile" => provision) - # do we need to set any of the other system attributes? + system.interfaces=[Cobbler::NetworkInterface.new({'mac_address' => mac})] system.save end end -- 1.5.5.1