diff --git a/src/cli/one_helper/onehost_helper.rb b/src/cli/one_helper/onehost_helper.rb index 5a04160696..45f86edaa2 100644 --- a/src/cli/one_helper/onehost_helper.rb +++ b/src/cli/one_helper/onehost_helper.rb @@ -253,7 +253,14 @@ class OneHostHelper < OpenNebulaHelper::OneHelper print_update_info(total-size, total, host['NAME']) - sync_cmd = "scp -rp #{REMOTES_LOCATION}/. #{host['NAME']}:#{remote_dir} 2> /dev/null" + if options[:rsync] + sync_cmd = "rsync -Laz --delete #{REMOTES_LOCATION}" << + " #{host['NAME']}:#{remote_dir}" + else + sync_cmd = "scp -rp #{REMOTES_LOCATION}/. " << + "#{host['NAME']}:#{remote_dir} 2> /dev/null" + end + `#{sync_cmd} 2>/dev/null` if !$?.success? diff --git a/src/cli/onehost b/src/cli/onehost index ddc6b59012..3eb139d505 100755 --- a/src/cli/onehost +++ b/src/cli/onehost @@ -79,8 +79,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do :description => "Force probe upgrade in onehost sync" } + RSYNC = { + :name => "rsync", + :large => "--rsync" , + :description => "Use rsync to synchronize remotes. In case some " << + "probes are no longer in the fronted are deleted in the hosts." << + " rsync command must be installed in the frontend and nodes." + } + CREAT_OPTIONS = [ IM, VMM, VNET, OneClusterHelper::CLUSTER ] - SYNC_OPTIONS = [ OneClusterHelper::CLUSTER, FORCE ] + SYNC_OPTIONS = [ OneClusterHelper::CLUSTER, FORCE, RSYNC ] ######################################################################## # Formatters for arguments