mdzidic / ovz-web-panel

Automatically exported from code.google.com/p/ovz-web-panel
Other
0 stars 0 forks source link

Use --online migrate if container is running #405

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reason:
Stopping a running container to do a migration is inconvenient.

Description:
I'm sure there's a cleaner way to do this in Ruby (I'm more of a Python coder), 
but here's my patch for  app/models/virtual_server.rb to handle online 
migrations if a container is running.

--- virtual_server.rb.trunk 2012-02-24 22:50:51.146769657 +0300
+++ virtual_server.rb   2012-02-24 22:51:04.194766238 +0300
@@ -1,5 +1,10 @@
   def migrate(target_hardware_server)
-    hardware_server.rpc_client.exec('vzmigrate', 
"#{shellescape(target_hardware_server.host)} #{shellescape(identity.to_s)}")
+    if self.state == 'running'
+        online = "--online"
+    else
+        online = ""
+    end
+    hardware_server.rpc_client.exec('vzmigrate', "#{online} 
#{target_hardware_server.host} #{identity}")
     target_hardware_server.sync_virtual_servers
     destroy
   end

Original issue reported on code.google.com by rie...@squishypuppy.com on 24 Feb 2012 at 7:53

GoogleCodeExporter commented 9 years ago

Original comment by sibprogrammer on 1 May 2012 at 9:54

GoogleCodeExporter commented 9 years ago
Yet better is to have a way to choose between live and offline migration.

Original comment by kolysh...@gmail.com on 13 Jun 2012 at 6:45