Revision 06abfef2

View differences:

src/cli/onevm
400 400
        host_id = args[1]
401 401
        verbose = "migrating to #{host_id}"
402 402

  
403
        params  = [host_id]
404
        params << options[:enforce] if !options[:enforce].nil?
405

  
406 403
        helper.perform_actions(args[0],options,verbose) do |vm|
407
            if options[:live]
408
                vm.live_migrate(*params)
409
            else
410
                vm.migrate(*params)
411
            end
404
            vm.migrate( host_id,
405
                        options[:live]==true,
406
                        options[:enforce]==true)
412 407
        end
413 408
    end
414 409

  
src/oca/ruby/opennebula/virtual_machine.rb
326 326
            action('unresched')
327 327
        end
328 328

  
329
        # Saves a running VM and starts it again in the specified host
329
        # Moves a running VM to the specified host. With live=true the
330
        # migration is done withdout downtime.
330 331
        #
331 332
        # @param host_id [Interger] The host id (hid) of the target host where
332 333
        #   the VM will be migrated.
334
        # @param live [true|false] If true the migration is done without
335
        #   downtime. Defaults to false
333 336
        # @param enforce [true|false] If it is set to true, the host capacity
334 337
        #   will be checked, and the deployment will fail if the host is
335 338
        #   overcommited. Defaults to false
336 339
        #
337 340
        # @return [nil, OpenNebula::Error] nil in case of success, Error
338 341
        #   otherwise
339
        def migrate(host_id, enforce=false)
340
            return call(VM_METHODS[:migrate], @pe_id, host_id.to_i, false, enforce)
342
        def migrate(host_id, live=false, enforce=false)
343
            call(VM_METHODS[:migrate], @pe_id, host_id.to_i, live==true,
344
                enforce)
341 345
        end
342 346

  
343
        # Migrates a running VM to another host without downtime
344
        #
345
        # @param host_id [Interger] The host id (hid) of the target host where
346
        #   the VM will be migrated.
347
        # @param enforce [true|false] If it is set to true, the host capacity
348
        #   will be checked, and the deployment will fail if the host is
349
        #   overcommited. Defaults to false
350
        #
351
        # @return [nil, OpenNebula::Error] nil in case of success, Error
352
        #   otherwise
347
        # @deprecated use {#migrate} instead
353 348
        def live_migrate(host_id, enforce=false)
354
            return call(VM_METHODS[:migrate], @pe_id, host_id.to_i, true, enforce)
349
            migrate(host_id, true, enforce)
355 350
        end
356 351

  
357 352
        # Set the specified vm's disk to be saved in a new image

Also available in: Unified diff