mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 22:14:13 +09:00
Bug #4528: Allow to set floating IPs from the command line to VRs
This commit is contained in:
1 parent
13eaa744c2
commit
af9f06e0dc
2 files changed
+23
-5
No files matched your search
@@ -24,6 +24,12 @@ class OneVirtualRouterHelper < OpenNebulaHelper::OneHelper
|
||||
:description => "Show all template data"
|
||||
}
|
||||
|
||||
FLOAT = {
|
||||
:name => "float",
|
||||
:large => "--float",
|
||||
:description => "Makes this IP request a Floating one"
|
||||
}
|
||||
|
||||
def self.rname
|
||||
"VROUTER"
|
||||
end
|
||||
|
||||
+17
-5
@@ -237,10 +237,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
nic_attach_desc = <<-EOT.unindent
|
||||
Attaches a NIC to a VirtualRouter, and each one of its VMs. When using
|
||||
--file add only one NIC instance.
|
||||
|
||||
Note if you are using a HA configuration for this router, --float can be
|
||||
added. When an IP is requested in HA clusters use --float.
|
||||
EOT
|
||||
|
||||
command :"nic-attach", nic_attach_desc, :vrouterid,
|
||||
:options => [OneVMHelper::FILE, OneVMHelper::NETWORK, OneVMHelper::IP] do
|
||||
:options => [OneVMHelper::FILE, OneVMHelper::NETWORK, OneVMHelper::IP,
|
||||
OneVirtualRouterHelper::FLOAT] do
|
||||
|
||||
if options[:file].nil? and options[:network].nil?
|
||||
STDERR.puts "Provide a template file or a network:"
|
||||
@@ -253,12 +257,20 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
template = File.read(options[:file])
|
||||
else
|
||||
network_id = options[:network]
|
||||
ip = options[:ip]
|
||||
ip = options[:ip]
|
||||
float = options[:float]
|
||||
|
||||
template = "NIC = [ NETWORK_ID = #{network_id}"
|
||||
|
||||
if ip
|
||||
template = "NIC = [ NETWORK_ID = #{network_id}, IP = #{ip} ]"
|
||||
else
|
||||
template = "NIC = [ NETWORK_ID = #{network_id} ]"
|
||||
template += ", IP = #{ip}"
|
||||
end
|
||||
|
||||
if float
|
||||
template += ", FLOATING_IP =\"yes\""
|
||||
end
|
||||
|
||||
template += " ]"
|
||||
end
|
||||
|
||||
helper.perform_action(args[0],options,"Attach NIC") do |vr|
|
||||
|
||||
Reference in new issue
Block a user