mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Re-structured Cloud servers source tree and removed unused files
git-svn-id: http://svn.opennebula.org/one/trunk@846 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
parent
5bb535f6dd
commit
da5c6c6c6f
86
install.sh
86
install.sh
@ -153,8 +153,10 @@ ETC_DIRS="$ETC_LOCATION/im_kvm \
|
||||
LIB_DIRS="$LIB_LOCATION/im_probes \
|
||||
$LIB_LOCATION/ruby \
|
||||
$LIB_LOCATION/ruby/OpenNebula \
|
||||
$LIB_LOCATION/ruby/econe \
|
||||
$LIB_LOCATION/ruby/occi \
|
||||
$LIB_LOCATION/ruby/cloud/ \
|
||||
$LIB_LOCATION/ruby/cloud/econe \
|
||||
$LIB_LOCATION/ruby/cloud/econe/views \
|
||||
$LIB_LOCATION/ruby/cloud/occi \
|
||||
$LIB_LOCATION/tm_commands \
|
||||
$LIB_LOCATION/tm_commands/nfs \
|
||||
$LIB_LOCATION/tm_commands/ssh \
|
||||
@ -189,10 +191,12 @@ INSTALL_FILES[9]="DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy"
|
||||
INSTALL_FILES[10]="EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples"
|
||||
INSTALL_FILES[11]="TM_EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples/tm"
|
||||
INSTALL_FILES[12]="HOOK_SHARE_FILES:$SHARE_LOCATION/hooks"
|
||||
INSTALL_FILES[13]="ECO_LIB_FILES:$LIB_LOCATION/ruby/econe"
|
||||
INSTALL_FILES[14]="ECO_BIN_FILES:$BIN_LOCATION"
|
||||
INSTALL_FILES[15]="OCCI_LIB_FILES:$LIB_LOCATION/ruby/occi"
|
||||
INSTALL_FILES[16]="OCCI_BIN_FILES:$BIN_LOCATION"
|
||||
INSTALL_FILES[13]="COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud"
|
||||
INSTALL_FILES[14]="ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe"
|
||||
INSTALL_FILES[15]="ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views"
|
||||
INSTALL_FILES[16]="ECO_BIN_FILES:$BIN_LOCATION"
|
||||
INSTALL_FILES[17]="OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi"
|
||||
INSTALL_FILES[18]="OCCI_BIN_FILES:$BIN_LOCATION"
|
||||
|
||||
INSTALL_CLIENT_FILES[0]="BIN_CLIENT_FILES:$BIN_LOCATION"
|
||||
INSTALL_CLIENT_FILES[1]="RUBY_LIB_CLIENT_FILES:$LIB_LOCATION/ruby"
|
||||
@ -212,9 +216,9 @@ INSTALL_ETC_FILES[10]="TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh"
|
||||
INSTALL_ETC_FILES[11]="TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy"
|
||||
INSTALL_ETC_FILES[12]="HM_ETC_FILES:$ETC_LOCATION/hm"
|
||||
INSTALL_ETC_FILES[13]="ECO_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[14]="ECO_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates"
|
||||
INSTALL_ETC_FILES[14]="ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates"
|
||||
INSTALL_ETC_FILES[15]="OCCI_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[16]="OCCI_TEMPLATE_FILES:$ETC_LOCATION/occi_templates"
|
||||
INSTALL_ETC_FILES[16]="OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Binary files, to be installed under $BIN_LOCATION
|
||||
@ -428,53 +432,63 @@ TM_EXAMPLE_SHARE_FILES="share/examples/tm/tm_clone.sh \
|
||||
HOOK_SHARE_FILES="share/hooks/ebtables-xen"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# OCA files
|
||||
# Common Cloud Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
ECO_LIB_FILES="src/cloud/rm/image.rb \
|
||||
src/cloud/rm/repo_manager.rb \
|
||||
src/cloud/ec2/OcaConfiguration.rb \
|
||||
src/cloud/ec2/eco.rb \
|
||||
src/cloud/ec2/lib/EC2QueryClient.rb"
|
||||
COMMON_CLOUD_LIB_FILES="src/cloud/common/CloudServer.rb \
|
||||
src/cloud/common/Configuration.rb \
|
||||
src/cloud/rm/image.rb \
|
||||
src/cloud/rm/repo_manager.rb"
|
||||
|
||||
ECO_BIN_FILES="src/cloud/ec2/econe-server \
|
||||
src/cloud/ec2/econe-describe-images \
|
||||
src/cloud/ec2/econe-describe-instances \
|
||||
src/cloud/ec2/econe-register \
|
||||
src/cloud/ec2/econe-run-instances \
|
||||
src/cloud/ec2/econe-terminate-instances \
|
||||
src/cloud/ec2/econe-upload"
|
||||
#-------------------------------------------------------------------------------
|
||||
# EC2 Query for OpenNebula
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
ECO_ETC_FILES="src/cloud/ec2/econe.conf"
|
||||
ECO_LIB_FILES="src/cloud/ec2/lib/EC2QueryClient.rb \
|
||||
src/cloud/ec2/lib/EC2QueryServer.rb \
|
||||
src/cloud/ec2/lib/econe-server.rb"
|
||||
|
||||
ECO_TEMPLATE_FILES="src/cloud/ec2/templates/m1.small.erb"
|
||||
ECO_LIB_VIEW_FILES="src/cloud/ec2/lib/views/describe_images.erb \
|
||||
src/cloud/ec2/lib/views/describe_instances.erb \
|
||||
src/cloud/ec2/lib/views/register_image.erb \
|
||||
src/cloud/ec2/lib/views/run_instances.erb \
|
||||
src/cloud/ec2/lib/views/terminate_instances.erb"
|
||||
|
||||
ECO_BIN_FILES="src/cloud/ec2/bin/econe-server \
|
||||
src/cloud/ec2/bin/econe-describe-images \
|
||||
src/cloud/ec2/bin/econe-describe-instances \
|
||||
src/cloud/ec2/bin/econe-register \
|
||||
src/cloud/ec2/bin/econe-run-instances \
|
||||
src/cloud/ec2/bin/econe-terminate-instances \
|
||||
src/cloud/ec2/bin/econe-upload"
|
||||
|
||||
ECO_ETC_FILES="src/cloud/ec2/etc/econe.conf"
|
||||
|
||||
ECO_ETC_TEMPLATE_FILES="src/cloud/ec2/etc/templates/m1.small.erb"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# OCCI files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
OCCI_LIB_FILES="src/cloud/occi/OCCI.rb \
|
||||
src/cloud/occi/OCCIServer.rb \
|
||||
OCCI_LIB_FILES="src/cloud/occi/lib/OCCI.rb \
|
||||
src/cloud/occi/lib/OCCIServer.rb \
|
||||
src/cloud/occi/lib/OCCIConfiguration.rb \
|
||||
src/cloud/occi/lib/ONEOCCIClient.rb \
|
||||
src/cloud/occi/lib/VirtualMachineOCCI.rb \
|
||||
src/cloud/occi/lib/VirtualMachinePoolOCCI.rb \
|
||||
src/cloud/occi/lib/VirtualNetworkOCCI.rb \
|
||||
src/cloud/occi/lib/VirtualNetworkPoolOCCI.rb"
|
||||
|
||||
|
||||
OCCI_BIN_FILES="src/cloud/occi/bin/occi-server \
|
||||
src/cloud/occi/bin/occi-compute \
|
||||
src/cloud/occi/bin/occi-network \
|
||||
src/cloud/occi/bin/occi-storage"
|
||||
|
||||
OCCI_BIN_FILES="src/cloud/occi/occi-server \
|
||||
src/cloud/occi/commands/occi-compute \
|
||||
src/cloud/occi/commands/occi-network \
|
||||
src/cloud/occi/commands/occi-storage"
|
||||
|
||||
OCCI_ETC_FILES="src/cloud/occi/occi-server.conf"
|
||||
|
||||
OCCI_TEMPLATE_FILES="src/cloud/occi/templates/small.erb \
|
||||
src/cloud/occi/templates/medium.erb \
|
||||
src/cloud/occi/templates/large.erb"
|
||||
OCCI_ETC_FILES="src/cloud/occi/etc/occi-server.conf"
|
||||
|
||||
OCCI_ETC_TEMPLATE_FILES="src/cloud/occi/etc/templates/small.erb \
|
||||
src/cloud/occi/etc/templates/medium.erb \
|
||||
src/cloud/occi/etc/templates/large.erb"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -1,73 +0,0 @@
|
||||
|
||||
class OcaConfiguration
|
||||
|
||||
NAME_REG=/[\w\d_-]+/
|
||||
VARIABLE_REG=/\s*(#{NAME_REG})\s*=\s*/
|
||||
SIMPLE_VARIABLE_REG=/#{VARIABLE_REG}([^\[]+?)(#.*)?/
|
||||
SINGLE_VARIABLE_REG=/^#{SIMPLE_VARIABLE_REG}$/
|
||||
ARRAY_VARIABLE_REG=/^#{VARIABLE_REG}\[(.*?)\]/m
|
||||
|
||||
def initialize(file)
|
||||
@conf=parse_conf(file)
|
||||
end
|
||||
|
||||
def add_value(conf, key, value)
|
||||
if conf[key]
|
||||
if !conf[key].kind_of?(Array)
|
||||
conf[key]=[conf[key]]
|
||||
end
|
||||
conf[key]<<value
|
||||
else
|
||||
conf[key]=value
|
||||
end
|
||||
end
|
||||
|
||||
def parse_conf(file)
|
||||
conf_file=File.read(file)
|
||||
|
||||
conf=Hash.new
|
||||
|
||||
conf_file.scan(SINGLE_VARIABLE_REG) {|m|
|
||||
key=m[0].strip.upcase
|
||||
value=m[1].strip
|
||||
|
||||
# hack to skip multiline VM_TYPE values
|
||||
next if %w{NAME TEMPLATE}.include? key.upcase
|
||||
|
||||
add_value(conf, key, value)
|
||||
}
|
||||
|
||||
conf_file.scan(ARRAY_VARIABLE_REG) {|m|
|
||||
master_key=m[0].strip.upcase
|
||||
|
||||
pieces=m[1].split(',')
|
||||
|
||||
vars=Hash.new
|
||||
pieces.each {|p|
|
||||
key, value=p.split('=')
|
||||
vars[key.strip.upcase]=value.strip
|
||||
}
|
||||
|
||||
add_value(conf, master_key, vars)
|
||||
}
|
||||
|
||||
conf
|
||||
end
|
||||
|
||||
def conf
|
||||
@conf
|
||||
end
|
||||
|
||||
def [](key)
|
||||
@conf[key.to_s.upcase]
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
|
||||
require 'pp'
|
||||
|
||||
conf=OcaConfiguration.new('econe.conf')
|
||||
pp conf.conf
|
||||
|
||||
end
|
@ -4,6 +4,6 @@ eval `grep ^IMAGE_DIR= $ONE_LOCATION/etc/econe.conf `
|
||||
export TMPDIR=$IMAGE_DIR/tmp
|
||||
mkdir -p $TMPDIR
|
||||
|
||||
nohup ruby $ONE_LOCATION/lib/ruby/econe/eco.rb >> $ONE_LOCATION/var/econe.log &
|
||||
nohup ruby $ONE_LOCATION/lib/ruby/cloud/econe/econe-server.rb >> $ONE_LOCATION/var/econe.log &
|
||||
|
||||
|
@ -1,394 +0,0 @@
|
||||
|
||||
|
||||
ONE_LOCATION=ENV["ONE_LOCATION"]
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
|
||||
else
|
||||
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
|
||||
TEMPLATES_LOCATION=ONE_LOCATION+"/etc/ec2query_templates"
|
||||
CONF_LOCATION=ONE_LOCATION+"/etc"
|
||||
end
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
$: << RUBY_LIB_LOCATION+"/econe"
|
||||
|
||||
|
||||
require 'rubygems'
|
||||
require 'sinatra'
|
||||
require 'AWS'
|
||||
require 'time'
|
||||
|
||||
require 'OpenNebula'
|
||||
#require 'repo_manager'
|
||||
require 'OcaConfiguration'
|
||||
|
||||
require 'pp'
|
||||
|
||||
include OpenNebula
|
||||
|
||||
CONFIG=OcaConfiguration.new(CONF_LOCATION+'/econe.conf')
|
||||
AUTH="#{CONFIG[:user]}:#{CONFIG[:password]}"
|
||||
ONE_RM_DATABASE=CONFIG[:database]
|
||||
|
||||
# Load this gere to use ONE_RM_DATABASE form the configuration file
|
||||
require 'repo_manager'
|
||||
Image.image_dir=CONFIG[:image_dir]
|
||||
|
||||
|
||||
INSTANCE_TYPES=Hash.new
|
||||
|
||||
pp CONFIG
|
||||
|
||||
if CONFIG[:vm_type].kind_of?(Array)
|
||||
# Multiple instance types
|
||||
CONFIG[:vm_type].each {|type|
|
||||
INSTANCE_TYPES[type['NAME']]=type
|
||||
}
|
||||
else
|
||||
# When only one instance type is defined
|
||||
INSTANCE_TYPES[CONFIG[:vm_type]['NAME']]=CONFIG[:vm_type]
|
||||
end
|
||||
|
||||
pp INSTANCE_TYPES
|
||||
|
||||
set :host, CONFIG[:server]
|
||||
set :port, CONFIG[:port]
|
||||
|
||||
|
||||
EC2_STATES={
|
||||
:pending => {:code => 0, :name => 'pending'},
|
||||
:running => {:code => 16, :name => 'running'},
|
||||
:shutdown => {:code => 32, :name => 'shutting-down'},
|
||||
:terminated => {:code => 48, :name => 'terminated'}
|
||||
}
|
||||
|
||||
ONE_STATES={
|
||||
'init' => :pending,
|
||||
'pend' => :pending,
|
||||
'hold' => :pending,
|
||||
'stop' => :pending,
|
||||
'susp' => :pending,
|
||||
'done' => :terminated,
|
||||
'fail' => :terminated,
|
||||
'prol' => :pend,
|
||||
'boot' => :running,
|
||||
'runn' => :running,
|
||||
'migr' => :running,
|
||||
'save' => :pend,
|
||||
'epil' => :shutdown,
|
||||
'shut' => :shutdown,
|
||||
'fail' => :terminated,
|
||||
'dele' => :terminated,
|
||||
'unkn' => :terminated
|
||||
}
|
||||
|
||||
$repoman=RepoManager.new
|
||||
|
||||
def get_one_client
|
||||
Client.new(AUTH)
|
||||
end
|
||||
|
||||
def get_one_client_user(user_name)
|
||||
user=get_user(user_name)
|
||||
|
||||
|
||||
auth="#{user[:name]}:#{user[:password]}"
|
||||
|
||||
client=Client.new("dummy:dummy")
|
||||
client.one_auth=auth
|
||||
client
|
||||
end
|
||||
|
||||
def get_user(name)
|
||||
user=nil
|
||||
|
||||
user_pool=UserPool.new(get_one_client)
|
||||
user_pool.info
|
||||
user_pool.each{|u|
|
||||
if u.name==name
|
||||
user=Hash.new
|
||||
user[:id]=u.id
|
||||
user[:name]=u.name
|
||||
user[:password]=u[:password]
|
||||
end
|
||||
}
|
||||
|
||||
user
|
||||
end
|
||||
|
||||
def render_state(vm)
|
||||
one_state=vm.status
|
||||
ec2_state=EC2_STATES[ONE_STATES[one_state]]
|
||||
|
||||
"<code>#{ec2_state[:code]}</code>
|
||||
<name>#{ec2_state[:name]}</name>"
|
||||
end
|
||||
|
||||
def render_launch_time(vm)
|
||||
"<launchTime>#{Time.at(vm[:stime].to_i).xmlschema}</launchTime>"
|
||||
end
|
||||
|
||||
def authenticate(params)
|
||||
user_name=params['AWSAccessKeyId']
|
||||
user=get_user(user_name)
|
||||
|
||||
halt 401, "User does not exist" if !user
|
||||
|
||||
signature_params=params.reject {|key,value|
|
||||
key=='Signature' or key=='file' }
|
||||
canonical=AWS.canonical_string(signature_params, CONFIG[:server])
|
||||
signature=AWS.encode(user[:password], canonical, false)
|
||||
|
||||
halt 401, "Bad password" if params['Signature']!=signature
|
||||
end
|
||||
|
||||
before do
|
||||
authenticate(params)
|
||||
end
|
||||
|
||||
|
||||
def upload_image(params)
|
||||
user=get_user(params['AWSAccessKeyId'])
|
||||
file=params["file"]
|
||||
|
||||
# tmpfile where the file is stored
|
||||
f_tmp=file[:tempfile]
|
||||
img=$repoman.add(user[:id], f_tmp.path)
|
||||
f_tmp.unlink
|
||||
|
||||
@img_id=img.uuid
|
||||
|
||||
erb :register_image
|
||||
end
|
||||
|
||||
def register_image(params)
|
||||
user=get_user(params['AWSAccessKeyId'])
|
||||
uuid=params['ImageLocation']
|
||||
|
||||
img=$repoman.get(uuid)
|
||||
|
||||
halt 404, 'Image not found' if !img
|
||||
halt 401, 'Not permited to use image' if user[:id]!=img[:owner]
|
||||
|
||||
@img_id=img.uuid
|
||||
|
||||
erb :register_image
|
||||
end
|
||||
|
||||
def describe_images(params)
|
||||
@user=get_user(params['AWSAccessKeyId'])
|
||||
|
||||
@images=Image.filter(:owner => @user[:id])
|
||||
|
||||
pp @images
|
||||
|
||||
erb :describe_images
|
||||
end
|
||||
|
||||
|
||||
def run_instances(params)
|
||||
@user=get_user(params['AWSAccessKeyId'])
|
||||
|
||||
image_id=params['ImageId']
|
||||
image=$repoman.get(image_id)
|
||||
|
||||
@vm_info=Hash.new
|
||||
@vm_info[:img_path]=image.path
|
||||
@vm_info[:img_id]=image_id
|
||||
|
||||
instance_type_name=params['InstanceType']
|
||||
instance_type=INSTANCE_TYPES[instance_type_name]
|
||||
|
||||
halt 400, "Bad instance type" if !instance_type
|
||||
|
||||
@vm_info[:instance_type]=instance_type_name
|
||||
|
||||
template=ERB.new(File.read(
|
||||
TEMPLATES_LOCATION+"/#{instance_type['TEMPLATE']}"))
|
||||
template_text=template.result(binding)
|
||||
|
||||
pp template_text
|
||||
|
||||
vm=VirtualMachine.new(
|
||||
VirtualMachine.build_xml, get_one_client_user(@user[:name]))
|
||||
response=vm.allocate(template_text)
|
||||
|
||||
vm.info
|
||||
|
||||
@vm_info[:vm_id]=vm.id
|
||||
@vm_info[:vm]=vm
|
||||
|
||||
erb :run_instances
|
||||
end
|
||||
|
||||
def describe_instances(params)
|
||||
@user=get_user(params['AWSAccessKeyId'])
|
||||
|
||||
client=get_one_client_user(@user[:name])
|
||||
|
||||
if @user[:id]==0
|
||||
user_flag=-2
|
||||
else
|
||||
user_flag=-1
|
||||
end
|
||||
|
||||
@vmpool=VirtualMachinePool.new(client, user_flag)
|
||||
@vmpool.info
|
||||
|
||||
erb :describe_instances
|
||||
end
|
||||
|
||||
def terminate_instances(params)
|
||||
@user=get_user(params['AWSAccessKeyId'])
|
||||
vmid=params['InstanceId.1']
|
||||
|
||||
client=get_one_client_user(@user[:name])
|
||||
@vm=VirtualMachine.new(VirtualMachine.build_xml(vmid), client)
|
||||
res=@vm.info
|
||||
|
||||
halt 401, res.message if OpenNebula::is_error?(res)
|
||||
|
||||
if @vm.status=='runn'
|
||||
res=@vm.shutdown
|
||||
else
|
||||
res=@vm.finalize
|
||||
end
|
||||
|
||||
halt 401, res.message if OpenNebula::is_error?(res)
|
||||
|
||||
erb :terminate_instances
|
||||
end
|
||||
|
||||
post '/' do
|
||||
pp params
|
||||
|
||||
case params['Action']
|
||||
when 'UploadImage'
|
||||
upload_image(params)
|
||||
when 'RegisterImage'
|
||||
register_image(params)
|
||||
when 'DescribeImages'
|
||||
describe_images(params)
|
||||
when 'RunInstances'
|
||||
run_instances(params)
|
||||
when 'DescribeInstances'
|
||||
describe_instances(params)
|
||||
when 'TerminateInstances'
|
||||
terminate_instances(params)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
@@ register_image
|
||||
<RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2009-04-04/">
|
||||
<imageId><%= @img_id %></imageId>
|
||||
</RegisterImageResponse>
|
||||
|
||||
|
||||
@@ describe_images
|
||||
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2009-04-04/">
|
||||
<imagesSet>
|
||||
<% for image in @images %>
|
||||
<item>
|
||||
<imageId><%= image.uuid %></imageId>
|
||||
<imageLocation><%= image.path %></imageLocation>
|
||||
<imageState>available</imageState>
|
||||
<imageOwnerId><%= @user[:name] %></imageOwnerId>
|
||||
<isPublic>false</isPublic>
|
||||
<architecture>i386</architecture>
|
||||
<imageType>machine</imageType>
|
||||
</item>
|
||||
<% end %>
|
||||
</imagesSet>
|
||||
</DescribeImagesResponse>
|
||||
|
||||
|
||||
@@ run_instances
|
||||
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-04-04/">
|
||||
<reservationId>r-47a5402e</reservationId>
|
||||
<ownerId><%= @user[:name] %></ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>default</groupId>
|
||||
</item>
|
||||
</groupSet>
|
||||
<instancesSet>
|
||||
<item>
|
||||
<instanceId><%= @vm_info[:vm_id] %></instanceId>
|
||||
<imageId><%= @vm_info[:img_id] %></imageId>
|
||||
<instanceState>
|
||||
<code>0</code>
|
||||
<name>pending</name>
|
||||
</instanceState>
|
||||
<privateDnsName><%= @vm_info[:vm]["TEMPLATE/NIC/IP"]%></privateDnsName>
|
||||
<dnsName><%= @vm_info[:vm]["TEMPLATE/NIC/IP"]%></dnsName>
|
||||
<keyName>default</keyName>
|
||||
<amiLaunchIndex>0</amiLaunchIndex>
|
||||
<instanceType><%= @vm_info[:instance_type] %></instanceType>
|
||||
<%= render_launch_time(@vm_info[:vm]) %>
|
||||
<placement>
|
||||
<availabilityZone>default</availabilityZone>
|
||||
</placement>
|
||||
<monitoring>
|
||||
<enabled>true</enabled>
|
||||
</monitoring>
|
||||
</item>
|
||||
</instancesSet>
|
||||
</RunInstancesResponse>
|
||||
|
||||
@@ describe_instances
|
||||
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-04-04/">
|
||||
<reservationSet>
|
||||
<item>
|
||||
<reservationId>default</reservationId>
|
||||
<ownerId><%= @user[:name] %></ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>default</groupId>
|
||||
</item>
|
||||
</groupSet>
|
||||
<instancesSet>
|
||||
<% @vmpool.each do |vm| %>
|
||||
<% vm.info %>
|
||||
<item>
|
||||
<instanceId><%= vm.id %></instanceId>
|
||||
<imageId><%= vm['TEMPLATE/IMAGE_ID'] %></imageId>
|
||||
<instanceState>
|
||||
<%= render_state(vm) %>
|
||||
</instanceState>
|
||||
<privateDnsName><%= vm["TEMPLATE/NIC/IP"] %></privateDnsName>
|
||||
<dnsName><%= vm["TEMPLATE/NIC/IP"] %></dnsName>
|
||||
<keyName>default</keyName>
|
||||
<amiLaunchIndex>0</amiLaunchIndex>
|
||||
<instanceType><%= vm['TEMPLATE/INSTANCE_TYPE'] %></instanceType>
|
||||
<%= render_launch_time(vm) %>
|
||||
<placement>
|
||||
<availabilityZone>default</availabilityZone>
|
||||
</placement>
|
||||
</item>
|
||||
<% end %>
|
||||
</instancesSet>
|
||||
</item>
|
||||
</reservationSet>
|
||||
</DescribeInstancesResponse>
|
||||
|
||||
@@ terminate_instances
|
||||
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-04-04/">
|
||||
<instancesSet>
|
||||
<item>
|
||||
<instanceId><%= @vm.id %></instanceId>
|
||||
<shutdownState>
|
||||
<code>32</code>
|
||||
<name>shutting-down</name>
|
||||
</shutdownState>
|
||||
<previousState>
|
||||
<%= render_state(@vm) %>
|
||||
</previousState>
|
||||
</item>
|
||||
</instancesSet>
|
||||
</TerminateInstancesResponse>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user