Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php |
— | — | @@ -148,6 +148,21 @@ |
149 | 149 | 'label-message' => 'openstackmanager-dnsdomain', |
150 | 150 | ); |
151 | 151 | |
| 152 | + $securityGroups = $this->adminNova->getSecurityGroups(); |
| 153 | + $group_keys = array(); |
| 154 | + foreach ( $securityGroups as $securityGroup ) { |
| 155 | + if ( $securityGroup->getOwner() == $project ) { |
| 156 | + $securityGroupName = $securityGroup->getGroupName(); |
| 157 | + $group_keys["$securityGroupName"] = $securityGroupName; |
| 158 | + } |
| 159 | + } |
| 160 | + $instanceInfo['groups'] = array( |
| 161 | + 'type' => 'multiselect', |
| 162 | + 'section' => 'instance/info', |
| 163 | + 'options' => $group_keys, |
| 164 | + 'label-message' => 'openstackmanager-securitygroups', |
| 165 | + ); |
| 166 | + |
152 | 167 | $instanceInfo['project'] = array( |
153 | 168 | 'type' => 'hidden', |
154 | 169 | 'default' => $project, |
— | — | @@ -389,7 +404,7 @@ |
390 | 405 | $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-invaliddomain' ) ); |
391 | 406 | return true; |
392 | 407 | } |
393 | | - $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], '', $formData['instanceType'], $formData['availabilityZone'] ); |
| 408 | + $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], '', $formData['instanceType'], $formData['availabilityZone'], $formData['groups'] ); |
394 | 409 | if ( $instance ) { |
395 | 410 | $puppetinfo = array(); |
396 | 411 | if ( $wgOpenStackManagerPuppetOptions['enabled'] ) { |
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php |
— | — | @@ -78,6 +78,7 @@ |
79 | 79 | 'openstackmanager-instancestate' => 'Instance State', |
80 | 80 | 'openstackmanager-instancetype' => 'Instance Type', |
81 | 81 | 'openstackmanager-instanceip' => 'Instance IP', |
| 82 | + 'openstackmanager-securitygroups' => 'Security Groups', |
82 | 83 | 'openstackmanager-availabilityzone' => 'Availability Zone', |
83 | 84 | 'openstackmanager-imageid' => 'Image ID', |
84 | 85 | 'openstackmanager-imagetype' => 'Image Type', |
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | return $this->securityGroups; |
129 | 129 | } |
130 | 130 | |
131 | | - function createInstance( $instanceName, $image, $key, $instanceType, $availabilityZone ) { |
| 131 | + function createInstance( $instanceName, $image, $key, $instanceType, $availabilityZone, $groups ) { |
132 | 132 | # 1, 1 is min and max number of instances to create. |
133 | 133 | # We never want to make more than one at a time. |
134 | 134 | $options = array(); |
— | — | @@ -137,6 +137,11 @@ |
138 | 138 | $options['InstanceType'] = $instanceType; |
139 | 139 | $options['Placement.AvailabilityZone'] = $availabilityZone; |
140 | 140 | $options['DisplayName'] = $instanceName; |
| 141 | + #if ( count( $groups ) > 1 ) { |
| 142 | + $options['SecurityGroup'] = $groups; |
| 143 | + #} else if ( count( $groups ) == 1 ) { |
| 144 | + # $options['SecurityGroup'] = $groups[0]; |
| 145 | + #} |
141 | 146 | $response = $this->novaConnection->run_instances( $image, 1, 1, $options ); |
142 | 147 | if ( ! $response->isOK() ) { |
143 | 148 | return null; |