Browse files

minor correction

  • Loading branch information...
1 parent 60afde5 commit 1a8f3f8dd21a7576949e1923093f9c7dcc89761e @pauloricardomg pauloricardomg committed Aug 16, 2010
View
2 service/service/java/source/etc/workspace-service/spotinstances.conf
@@ -42,7 +42,7 @@ backfill.enabled=true
# bid is below the current spot price.
#
# This property defines which implementation of the
-# org.globus.workspace.spotinstances.PricingModel
+# org.globus.workspace.async.spotinstances.PricingModel
# interface should be used by the Spot Instances module
# to set the spot price. This class will be constructed
# by reflection, so it must be in the classpath of the
View
44 tests/conf/public
@@ -0,0 +1,44 @@
+# A sample network pool 'public'
+
+# The first non-blank, non-comment line must be the DNS server you would
+# like to tell the VMs receiving addresses from this network pool to use.
+
+# DNS server IP address (or 'none')
+192.168.0.1
+
+# The rest of the file's non-blank, non-comment lines are the addresses
+# that will be leased out to VMs requesting this network.
+
+# The only optional field is the MAC address. All others must be a valid
+# entry or 'none'.
+
+# The IP address and hostname fields may not be 'none'.
+# If the gateway is 'none', no gateway is assigned.
+# If broadcast or subnetmask are 'none' they are derived from the IP
+# - based on the normal subnet and broadcast for the IP class (A,B,C)
+
+# An explicit MAC address may be optionally specified for an entry. The
+# MAC must be specified as six pairs of hex digits, separated by colons.
+# If you do not specify a MAC, one will be automatically generated when
+# Nimbus is started.
+
+# A file containing sample DHCP entries is written by the Nimbus service
+# to $NIMBUS_HOME/services/var/nimbus/dhcpd.entries
+# This file contains the generated and explicit IP -> MAC mappings and
+# can be included in your site DHCPD configuration. There is also a
+# simple text mapping of IP -> MAC written to the ip_mac.txt file in the
+# same directory.
+
+
+
+# hostname ipaddress gateway broadcast subnetmask [MAC]
+
+pub02 192.168.0.2 192.168.0.1 none none
+pub03 192.168.0.3 192.168.0.1 192.168.0.255 255.255.255.0 A2:AA:BB:EE:5F:2A
+pub04 192.168.0.4 192.168.0.1 192.168.0.255 255.255.255.0
+pub05 192.168.0.5 192.168.0.1 none none
+pub06 192.168.0.6 none none none
+pub07 192.168.0.7 192.168.0.1 none 255.255.255.0
+pub08 192.168.0.8 192.168.0.1 none 255.255.255.0
+pub09 192.168.0.9 192.168.0.1 none 255.255.255.0
+pub10 192.168.0.10 192.168.0.1 none 255.255.255.0
View
148 tests/ec2_si_tests.py
@@ -240,9 +240,9 @@ def test_multiple_requestSI(self):
ts1 = now = datetime.datetime.now()
- req1 = self.ec2conn.request_spot_instances("1.0",url,count=2,type="persistent")
- req2 = self.ec2conn.request_spot_instances("1.2",url,count=1)
- req3 = self.ec2conn.request_spot_instances("1.5",url,count=1)
+ req1 = self.ec2conn.request_spot_instances("1.0",url,count=2,type="persistent")[0]
+ req2 = self.ec2conn.request_spot_instances("1.2",url,count=1)[0]
+ req3 = self.ec2conn.request_spot_instances("1.5",url,count=1)[0]
req1_res = None
req2_res = None
@@ -253,11 +253,11 @@ def test_multiple_requestSI(self):
for reservation in allReservations:
assert len(reservation.instances) > 0, 'reservations have no instances!'
inst = reservation.instances[0]
- if inst.spot_instance_request_id == req1[0].id:
+ if inst.spot_instance_request_id == req1.id:
req1_res = reservation
- elif inst.spot_instance_request_id == req2[0].id:
+ elif inst.spot_instance_request_id == req2.id:
req2_res = reservation
- elif inst.spot_instance_request_id == req3[0].id:
+ elif inst.spot_instance_request_id == req3.id:
req3_res = reservation
assert len(req1_res.instances) == 2
@@ -268,19 +268,139 @@ def test_multiple_requestSI(self):
assert len(price_history) == 0
run_res1 = self.ec2conn.run_instances(url,min_count=2)
-
time.sleep(1)
price_history = self.ec2conn.get_spot_price_history(start_time=ts1.isoformat())
assert len(price_history) == 1
price1 = price_history[0]
assert price1.price == 1.0
- #run_res2 = self.ec2conn.run_instances(url)
+ ts2 = now = datetime.datetime.now()
+
+ run_res2 = self.ec2conn.run_instances(url)
+ time.sleep(1)
+
+ price_history = self.ec2conn.get_spot_price_history(start_time=ts1.isoformat())
+ assert len(price_history) == 2
+ price1 = price_history[0]
+ assert price1.price == 1.0
+ price1 = price_history[1]
+ assert price1.price == 1.2
+
+ run_res3 = self.ec2conn.run_instances(url)
+ time.sleep(1)
+
+ price_history = self.ec2conn.get_spot_price_history(start_time=ts1.isoformat())
+ assert len(price_history) == 3
+ price1 = price_history[0]
+ assert price1.price == 1.0
+ price1 = price_history[1]
+ assert price1.price == 1.2
+ price1 = price_history[2]
+ assert price1.price == 1.5
+
+ si_reqs = self.ec2conn.get_all_spot_instance_requests()
+ assert len(si_reqs) == 3, 'incorrect result size'
+ for si_req in si_reqs:
+ if si_req.id == req1.id:
+ assert si_req.price == 1.0, 'incorrect price returned'
+ assert si_req.type == "persistent", 'incorrect type returned'
+ assert si_req.state == "open", 'request should have been in the open status'
+ assert not si_req.instance_id, 'there shouldnt be an instance id'
+ elif si_req.id == req2.id:
+ assert si_req.price == 1.2, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "closed", 'request should have been in the open status'
+ assert not si_req.instance_id, 'there shouldnt be an instance id'
+ elif si_req.id == req3.id:
+ assert si_req.price == 1.5, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "active", 'request should have been in the open status'
+ assert req3_res.instances[0].id == si_req.instance_id, 'returned instance id must be equal to spot instance id'
+ else:
+ self.fail("shouldn't happen")
+
+ ts3 = now = datetime.datetime.now()
+
+ run_res2.stop_all()
+ time.sleep(1)
+
+ si_reqs = self.ec2conn.get_all_spot_instance_requests()
+ assert len(si_reqs) == 3, 'incorrect result size'
+ for si_req in si_reqs:
+ if si_req.id == req1.id:
+ assert si_req.price == 1.0, 'incorrect price returned'
+ assert si_req.type == "persistent", 'incorrect type returned'
+ assert si_req.state == "active", 'request should have been in the open status'
+ elif si_req.id == req2.id:
+ assert si_req.price == 1.2, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "closed", 'request should have been in the open status'
+ assert not si_req.instance_id, 'there shouldnt be an instance id'
+ elif si_req.id == req3.id:
+ assert si_req.price == 1.5, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "active", 'request should have been in the open status'
+ assert req3_res.instances[0].id == si_req.instance_id, 'returned instance id must be equal to spot instance id'
+ else:
+ self.fail("shouldn't happen")
+
+ price_history = self.ec2conn.get_spot_price_history(start_time=ts1.isoformat())
+ assert len(price_history) == 4
+ price1 = price_history[0]
+ assert price1.price == 1.0
+ price1 = price_history[1]
+ assert price1.price == 1.2
+ price1 = price_history[2]
+ assert price1.price == 1.5
+ price1 = price_history[3]
+ assert price1.price == 1.0
+
+ self.ec2conn.cancel_spot_instance_requests([req1.id,req3.id])
+
+ si_reqs = self.ec2conn.get_all_spot_instance_requests()
+ assert len(si_reqs) == 3, 'incorrect result size'
+ for si_req in si_reqs:
+ if si_req.id == req1.id:
+ assert si_req.price == 1.0, 'incorrect price returned'
+ assert si_req.type == "persistent", 'incorrect type returned'
+ assert si_req.state == "canceled", 'request should have been in the open status'
+ elif si_req.id == req2.id:
+ assert si_req.price == 1.2, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "closed", 'request should have been in the open status'
+ assert not si_req.instance_id, 'there shouldnt be an instance id'
+ elif si_req.id == req3.id:
+ assert si_req.price == 1.5, 'incorrect price returned'
+ assert si_req.type == "one-time", 'incorrect type returned'
+ assert si_req.state == "canceled", 'request should have been in the open status'
+ assert req3_res.instances[0].id == si_req.instance_id, 'returned instance id must be equal to spot instance id'
+ else:
+ self.fail("shouldn't happen")
+
+ allReservations = self.ec2conn.get_all_instances()
+ for reservation in allReservations:
+ reservation.stop_all()
+
+ allReservations = self.ec2conn.get_all_instances()
+ assert len(allReservations) == 0, 'incorrect result size'
+
+ price_history = self.ec2conn.get_spot_price_history(start_time=ts1.isoformat())
+ assert len(price_history) == 5
+ price1 = price_history[0]
+ assert price1.price == 1.0
+ price1 = price_history[1]
+ assert price1.price == 1.2
+ price1 = price_history[2]
+ assert price1.price == 1.5
+ price1 = price_history[3]
+ assert price1.price == 1.0
+ price1 = price_history[4]
+ assert price1.price == 0.1
- req1[0].cancel()
- req1_res.stop_all()
- req2_res.stop_all()
- req3_res.stop_all()
- run_res1.stop_all()
- #run_res2.stop_all()
+ price_history = self.ec2conn.get_spot_price_history(start_time=ts2.isoformat(), end_time=ts3.isoformat())
+ assert len(price_history) == 2
+ price1 = price_history[0]
+ assert price1.price == 1.2
+ price1 = price_history[1]
+ assert price1.price == 1.5
View
4 tests/si-tests-setup.sh
@@ -11,4 +11,8 @@ echo "Copying resource pool conf file to NIMBUS_HOME/services/etc/nimbus/workspa
cp $SI_CONF/pool1 $NIMBUS_HOME/services/etc/nimbus/workspace-service/vmm-pools/
+echo "Copying network pool conf file to NIMBUS_HOME/services/etc/nimbus/workspace-service/network-pools/"
+
+cp $SI_CONF/public $NIMBUS_HOME/services/etc/nimbus/workspace-service/network-pools/
+
echo "Done!"

0 comments on commit 1a8f3f8

Please sign in to comment.