Index: trunk/extensions/OpenStackManager/SpecialCreateInstance.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | } |
14 | 14 | |
15 | 15 | function execute( $par ) { |
16 | | - global $wgRequest, $wgOut, $wgTitle; |
| 16 | + global $wgRequest, $wgOut; |
17 | 17 | |
18 | 18 | $this->setHeaders(); |
19 | 19 | $wgOut->setPagetitle("Create Instance"); |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | $instanceId = $this->adminNova->createInstance( $formData['imageType'], $formData['keypair'], |
102 | 102 | $formData['instanceType'], $formData['availabilityZone'] ); |
103 | 103 | |
104 | | - print_r($instanceID); |
| 104 | + print_r($instanceId); |
105 | 105 | |
106 | 106 | $wgOut->addHTML('<p>Created instance ' . $instanceId . '</p>'); |
107 | 107 | |
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php |
— | — | @@ -10,20 +10,19 @@ |
11 | 11 | |
12 | 12 | # TODO: Make disable_ssl, hostname, and resource_prefix config options |
13 | 13 | function __construct( $credentials ) { |
14 | | - global $wgOpenStackManagerNovaDisableSSL, $wgOpenStackManagerNovaPort, |
15 | | - $wgOpenStackManagerNovaServerName, $wgOpenStackManagerNovaPort, |
16 | | - $wgOpenStackManagerNovaResourcePrefix; |
| 14 | + global $wgOpenStackManagerNovaDisableSSL, $wgOpenStackManagerNovaServerName, |
| 15 | + $wgOpenStackManagerNovaPort, $wgOpenStackManagerNovaResourcePrefix; |
17 | 16 | wfLoadExtensionMessages('OpenStackManager'); |
18 | 17 | $this->novaConnection = new AmazonEC2( $credentials['accessKey'], $credentials['secretKey'] ); |
19 | 18 | $this->novaConnection->disable_ssl($wgOpenStackManagerNovaDisableSSL); |
20 | 19 | $this->novaConnection->set_hostname($wgOpenStackManagerNovaServerName, $wgOpenStackManagerNovaPort); |
21 | 20 | $this->novaConnection->set_resource_prefix($wgOpenStackManagerNovaResourcePrefix); |
22 | | - $this->instances = Array(); |
| 21 | + $this->instances = array(); |
23 | 22 | } |
24 | 23 | |
25 | | - function getInstance( $instanceId, $reload=False ) { |
26 | | - if ( isset( $this->instances[$instanceID] ) && !$reload ) { |
27 | | - $instance = $this->instances[$instanceID]; |
| 24 | + function getInstance( $instanceId, $reload = false ) { |
| 25 | + if ( isset( $this->instances[$instanceId] ) && !$reload ) { |
| 26 | + $instance = $this->instances[$instanceId]; |
28 | 27 | } else { |
29 | 28 | $instance = $this->novaConnection->describe_instances( $instanceId ); |
30 | 29 | $instance = $instance->body->reservationSet->item; |
— | — | @@ -32,9 +31,9 @@ |
33 | 32 | return $instance; |
34 | 33 | } |
35 | 34 | |
36 | | - function getInstances( $reload=False ) { |
| 35 | + function getInstances( $reload = false ) { |
37 | 36 | if ( count( $this->instances ) == 0 || $reload ) { |
38 | | - $this->instances = Array(); |
| 37 | + $this->instances = array(); |
39 | 38 | $instances = $this->novaConnection->describe_instances(); |
40 | 39 | $instances = $instances->body->reservationSet->item; |
41 | 40 | foreach ( $instances as $instance ) { |
— | — | @@ -48,9 +47,9 @@ |
49 | 48 | return $this->instanceTypes; |
50 | 49 | } |
51 | 50 | |
52 | | - function getImages( $reload=False ) { |
| 51 | + function getImages( $reload = false ) { |
53 | 52 | if ( count( $this->images ) == 0 || $reload ) { |
54 | | - $this->images = Array(); |
| 53 | + $this->images = array(); |
55 | 54 | $images = $this->novaConnection->describe_images(); |
56 | 55 | $images = $images->body->imagesSet->item; |
57 | 56 | foreach ( $images as $image ) { |
— | — | @@ -63,9 +62,9 @@ |
64 | 63 | } |
65 | 64 | |
66 | 65 | # TODO: make this user specific |
67 | | - function getKeypairs( $reload=False ) { |
| 66 | + function getKeypairs( $reload = false ) { |
68 | 67 | if ( count( $this->keypairs ) == 0 || $reload ) { |
69 | | - $this->keypairs = Array(); |
| 68 | + $this->keypairs = array(); |
70 | 69 | $keypairs = $this->novaConnection->describe_key_pairs(); |
71 | 70 | $keypairs = $keypairs->body->keypairsSet->item; |
72 | 71 | foreach ( $keypairs as $keypair ) { |
— | — | @@ -75,9 +74,9 @@ |
76 | 75 | return $this->keypairs; |
77 | 76 | } |
78 | 77 | |
79 | | - function getAvailabilityZones( $reload=False ) { |
| 78 | + function getAvailabilityZones( $reload = false ) { |
80 | 79 | if ( count( $this->availabilityZones ) == 0 || $reload ) { |
81 | | - $this->availabilityZones = Array(); |
| 80 | + $this->availabilityZones = array(); |
82 | 81 | $availabilityZones = $this->novaConnection->describe_availability_zones(); |
83 | 82 | $availabilityZones = $availabilityZones->body->availabilityZoneInfo->item; |
84 | 83 | foreach ( $availabilityZones as $availabilityZone ) { |
— | — | @@ -92,7 +91,7 @@ |
93 | 92 | function createInstance( $image, $key, $instanceType, $availabilityZone ) { |
94 | 93 | # 1, 1 is min and max number of instances to create. |
95 | 94 | # We never want to make more than one at a time. |
96 | | - $instance = $this->novaConnection->run_instances($image, 1, 1, Array( |
| 95 | + $instance = $this->novaConnection->run_instances($image, 1, 1, array( |
97 | 96 | 'KeyName' => $key, |
98 | 97 | 'InstanceType' => $instanceType, |
99 | 98 | 'Placement.AvailabilityZone' => $availabilityZone, |