mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-25 23:21:29 +03:00
feature #1020: VMotion support
This commit is contained in:
parent
d1151e1474
commit
485f5947c1
@ -103,8 +103,9 @@ int main (int argc, char **argv)
|
||||
char expect = ':';
|
||||
|
||||
int opt, pty, pid, rc;
|
||||
int times = 1;
|
||||
|
||||
while((opt = getopt(argc,argv,"+hp:u:")) != -1)
|
||||
while((opt = getopt(argc,argv,"+hrp:u:")) != -1)
|
||||
switch(opt)
|
||||
{
|
||||
case 'h':
|
||||
@ -117,6 +118,9 @@ int main (int argc, char **argv)
|
||||
case 'u':
|
||||
username = strdup(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
times = 2;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Wrong option. Check usage\n");
|
||||
fprintf(stderr,"%s",myexpect_usage);
|
||||
@ -153,12 +157,17 @@ int main (int argc, char **argv)
|
||||
perror("fork\n");
|
||||
}
|
||||
|
||||
expect_char(pty,&expect,1);
|
||||
sleep(1);
|
||||
write_answer(pty,username);
|
||||
expect_char(pty,&expect,1);
|
||||
sleep(1);
|
||||
write_answer(pty,password);
|
||||
while ( times > 0 )
|
||||
{
|
||||
expect_char(pty,&expect,1);
|
||||
sleep(1);
|
||||
write_answer(pty,username);
|
||||
expect_char(pty,&expect,1);
|
||||
sleep(1);
|
||||
write_answer(pty,password);
|
||||
|
||||
times = times - 1;
|
||||
}
|
||||
|
||||
expect_char(pty,0,0);
|
||||
|
||||
|
@ -16,6 +16,23 @@
|
||||
# limitations under the License. #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
|
||||
# Action not supported
|
||||
exit -1
|
||||
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
|
||||
else
|
||||
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
|
||||
end
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
$: << File.dirname(__FILE__)
|
||||
|
||||
require 'vmware_driver'
|
||||
|
||||
deploy_id = ARGV[0]
|
||||
dst_host = ARGV[1]
|
||||
src_host = ARGV[2]
|
||||
|
||||
vmware_drv = VMwareDriver.new(src_host)
|
||||
|
||||
vmware_drv.migrate(deploy_id, dst_host, src_host)
|
||||
|
@ -51,6 +51,9 @@ class VMwareDriver
|
||||
|
||||
@user = conf[:username]
|
||||
@pass = conf[:password]
|
||||
|
||||
@datacenter = conf[:datacenter]
|
||||
@vcenter = conf[:vcenter]
|
||||
end
|
||||
|
||||
# ######################################################################## #
|
||||
@ -112,9 +115,15 @@ class VMwareDriver
|
||||
# ------------------------------------------------------------------------ #
|
||||
# Migrate #
|
||||
# ------------------------------------------------------------------------ #
|
||||
def migrate
|
||||
OpenNebula.log_error("Migration action is currently not supported")
|
||||
exit -1
|
||||
def migrate(deploy_id, dst_host, src_host)
|
||||
src_url = "vpx://#{@vcenter}/#{@datacenter}/#{src_host}/?no_verify=1"
|
||||
dst_url = "vpx://#{@vcenter}/#{@datacenter}/#{dst_host}/?no_verify=1"
|
||||
|
||||
mgr_cmd = "-r virsh -c #{src_url} migrate #{deploy_id} #{dst_url}"
|
||||
|
||||
rc, info = do_action(mgr_cmd)
|
||||
|
||||
exit info if rc == false
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------------------ #
|
||||
|
@ -15,10 +15,13 @@
|
||||
# ---------------------------------------------------------------------------- #
|
||||
|
||||
# Libvirt configuration
|
||||
|
||||
:libvirt_uri: "esx://@HOST@/?no_verify=1"
|
||||
:qemu_protocol: "qemu"
|
||||
|
||||
# Username and password of the VMware hypervisor
|
||||
:username: "oneadmin"
|
||||
:password:
|
||||
:password:
|
||||
|
||||
# VMotion configuration attributes
|
||||
:datacenter:
|
||||
:vcenter:
|
Loading…
Reference in New Issue
Block a user