mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
* B #5459: Importing vcenter resources without any Host * B #5459: Importing vcenter vnets without any Host
This commit is contained in:
parent
2953334157
commit
eaeb0c63be
@ -168,46 +168,53 @@ define(function(require) {
|
||||
var one_template = $(this).data("one_template");
|
||||
var one_clusters = $(this).data("one_clusters");
|
||||
var datastore_ids = [];
|
||||
$.each(one_template, function(id, element){
|
||||
var datastore_json = {
|
||||
"datastore": {
|
||||
"datastore_raw": this.one
|
||||
},
|
||||
"cluster_id" : -1
|
||||
};
|
||||
OpenNebulaDatastore.create({
|
||||
timeout: true,
|
||||
data: datastore_json,
|
||||
success: function(request, response) {
|
||||
datastore_ids.push(response.DATASTORE.ID);
|
||||
VCenterCommon.importSuccess({
|
||||
context : row_context,
|
||||
message : Locale.tr("Datastores created successfully. IDs: %1$s", datastore_ids.join())
|
||||
});
|
||||
if (one_clusters.length > 0) {
|
||||
$.each(one_template, function(id, element){
|
||||
var datastore_json = {
|
||||
"datastore": {
|
||||
"datastore_raw": this.one
|
||||
},
|
||||
"cluster_id" : -1
|
||||
};
|
||||
OpenNebulaDatastore.create({
|
||||
timeout: true,
|
||||
data: datastore_json,
|
||||
success: function(request, response) {
|
||||
datastore_ids.push(response.DATASTORE.ID);
|
||||
VCenterCommon.importSuccess({
|
||||
context : row_context,
|
||||
message : Locale.tr("Datastores created successfully. IDs: %1$s", datastore_ids.join())
|
||||
});
|
||||
|
||||
var datastore_raw =
|
||||
"VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" +
|
||||
"VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" +
|
||||
"VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n";
|
||||
var datastore_raw =
|
||||
"VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" +
|
||||
"VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" +
|
||||
"VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n";
|
||||
|
||||
Sunstone.runAction("Datastore.append_template", response.DATASTORE.ID, datastore_raw);
|
||||
Sunstone.runAction("Datastore.append_template", response.DATASTORE.ID, datastore_raw);
|
||||
|
||||
$.each(one_clusters, function(index, cluster_id){
|
||||
Sunstone.runAction("Cluster.adddatastore",cluster_id,response.DATASTORE.ID);
|
||||
});
|
||||
$.each(one_clusters, function(index, cluster_id){
|
||||
Sunstone.runAction("Cluster.adddatastore",cluster_id,response.DATASTORE.ID);
|
||||
});
|
||||
|
||||
if (one_clusters.length > 0) {
|
||||
Sunstone.runAction("Cluster.deldatastore",0,response.DATASTORE.ID);
|
||||
if (one_clusters.length > 0) {
|
||||
Sunstone.runAction("Cluster.deldatastore",0,response.DATASTORE.ID);
|
||||
}
|
||||
},
|
||||
error: function (request, error_json) {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?"))
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (request, error_json) {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?"))
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : Locale.tr("You need to import the associated vcenter cluster as one host first.")
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -305,26 +305,30 @@ define(function(require) {
|
||||
|
||||
var one_cluster_id = $(this).data("import_data").one_cluster_id;
|
||||
|
||||
OpenNebulaNetwork.create({
|
||||
timeout: true,
|
||||
data: vnet_json,
|
||||
success: function(request, response) {
|
||||
VCenterCommon.importSuccess({
|
||||
context : row_context,
|
||||
message : Locale.tr("Virtual Network created successfully. ID: %1$s", response.VNET.ID)
|
||||
});
|
||||
|
||||
if (one_cluster_id != -1) {
|
||||
if (one_cluster_id != -1){
|
||||
OpenNebulaNetwork.create({
|
||||
timeout: true,
|
||||
data: vnet_json,
|
||||
success: function(request, response) {
|
||||
VCenterCommon.importSuccess({
|
||||
context : row_context,
|
||||
message : Locale.tr("Virtual Network created successfully. ID: %1$s", response.VNET.ID)
|
||||
});
|
||||
Sunstone.runAction("Cluster.addvnet",one_cluster_id,response.VNET.ID);
|
||||
},
|
||||
error: function (request, error_json) {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?"))
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (request, error_json) {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?"))
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
VCenterCommon.importFailure({
|
||||
context : row_context,
|
||||
message : Locale.tr("You need to import the associated vcenter cluster as one host first.")
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user