Revision e86ff9e1

View differences:

src/sunstone/public/app/utils/vcenter/datastores.js
195 195
              $.each(one_clusters, function(index, cluster_id){
196 196
                  Sunstone.runAction("Cluster.adddatastore",cluster_id,response.DATASTORE.ID);
197 197
              });
198

  
199
              if (one_clusters.length > 0) {
200
                  Sunstone.runAction("Cluster.deldatastore",0,response.DATASTORE.ID);
201
              }
198 202
            },
199 203
            error: function (request, error_json) {
200 204
              VCenterCommon.importFailure({
src/vmm_mad/remotes/lib/vcenter_driver/importer.rb
157 157
                                 "      - Location   : #{cluster[:cluster_location]}\n"\
158 158
                                 "    Import cluster (y/[n])? "
159 159
                    next if STDIN.gets.strip.downcase != 'y'
160
                end
161 160

  
162
                if cluster_list.size > 0
163
                    STDOUT.print "\n    In which OpenNebula cluster do you want the vCenter cluster to be included?\n "
161
                    if cluster_list.size > 0
162
                        STDOUT.print "\n    In which OpenNebula cluster do you want the vCenter cluster to be included?\n "
164 163

  
165
                    cluster_list_str = "\n"
166
                    cluster_list.each do |key, value|
167
                        cluster_list_str << "      - \e[94mID: " << key << "\e[39m - NAME: " << value << "\n"
168
                    end
164
                        cluster_list_str = "\n"
165
                        cluster_list.each do |key, value|
166
                            cluster_list_str << "      - \e[94mID: " << key << "\e[39m - NAME: " << value << "\n"
167
                        end
169 168

  
170
                    STDOUT.print "\n    #{cluster_list_str}"
171
                    STDOUT.print "\n    Specify the ID of the cluster or press Enter if you want OpenNebula to create a new cluster for you: "
169
                        STDOUT.print "\n    #{cluster_list_str}"
170
                        STDOUT.print "\n    Specify the ID of the cluster or press Enter if you want OpenNebula to create a new cluster for you: "
172 171

  
173
                    answer = STDIN.gets.strip
174
                    if !answer.empty?
175
                        one_cluster_id = answer
176
                    else
172
                        answer = STDIN.gets.strip
173
                        if !answer.empty?
174
                            one_cluster_id = answer
175
                        end
176
                    end
177

  
178
                    if !one_cluster_id
177 179
                        one_cluster = VCenterDriver::VIHelper.new_one_item(OpenNebula::Cluster)
178 180
                        rc = one_cluster.allocate("#{cluster[:cluster_name]}")
179 181
                        if ::OpenNebula.is_error?(rc)
......
182 184
                        end
183 185
                        one_cluster_id = one_cluster.id
184 186
                    end
187
                else
188
                    # Defaults, add host to new cluster
189
                    one_cluster = VCenterDriver::VIHelper.new_one_item(OpenNebula::Cluster)
190
                    rc = one_cluster.allocate("#{cluster[:cluster_name]}")
191
                    if ::OpenNebula.is_error?(rc)
192
                        STDOUT.puts "    Error creating OpenNebula cluster: #{rc.message}\n"
193
                        next
194
                    end
195
                    one_cluster_id = one_cluster.id
185 196
                end
186 197

  
198

  
199

  
187 200
                # Generate the template and create the host in the pool
188 201
                one_host = VCenterDriver::ClusterComputeResource.to_one(cluster,
189 202
                                                                        con_ops,
......
845 858
                                end
846 859
                                rc = one_cluster.adddatastore(one_d.id)
847 860
                                if ::OpenNebula.is_error?(rc)
848
                                    STDOUT.puts "    \n    Error adding datastore #{one_d.id} to OpenNebula cluster #{cid}: #{rc.message}. Yoy may have to place this datastore in the right cluster by hand"
861
                                    STDOUT.puts "    \n    Error adding datastore #{one_d.id} to OpenNebula cluster #{cid}: #{rc.message}. You may have to place this datastore in the right cluster by hand"
862
                                end
863
                            end
864

  
865
                            if !d[:cluster].empty?
866
                                one_cluster = VCenterDriver::VIHelper.one_item(OpenNebula::Cluster, "0", false)
867
                                if ::OpenNebula.is_error?(one_cluster)
868
                                    STDOUT.puts "    \n    Error retrieving default cluster: #{rc.message}"
869
                                end
870
                                rc = one_cluster.deldatastore(one_d.id)
871
                                if ::OpenNebula.is_error?(rc)
872
                                    STDOUT.puts "    \n    Error removing datastore #{one_d.id} from default datastore."
849 873
                                end
850 874
                            end
851 875
                        end

Also available in: Unified diff