This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #17860,#12051,#22277,#22621 Various big rewrites
- implement image provisioning - improve volume support - add cloud-init support - UI improvements - heavy refactoring
- Loading branch information
Showing
28 changed files
with
755 additions
and
718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 31 additions & 18 deletions
49
app/assets/javascripts/foreman_xen/xenserver/cache_refresh.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
function refreshCache(item, on_success) { | ||
tfm.tools.showSpinner(); | ||
attribute_name = $(item).data('attribute') | ||
data = { | ||
type: attribute_name, | ||
compute_resource_id: $(item).data('compute-resource-id') | ||
function refreshCache(item) { | ||
tfm.tools.showSpinner(); | ||
attribute_name = $(item).data('attribute'); | ||
sel = $(item).closest('.input-group').children('select') | ||
data = { | ||
type: attribute_name, | ||
compute_resource_id: $(item).data('compute-resource-id') | ||
}; | ||
$.ajax({ | ||
type:'post', | ||
url: $(item).data('url'), | ||
data: data, | ||
complete: function(){ | ||
tfm.tools.hideSpinner(); | ||
}, | ||
error: function(){ | ||
notify(__("Error refreshing cache for " + attribute_name), 'error', true); | ||
}, | ||
success: function(results, textStatus, jqXHR){ | ||
var elements = sel.children() | ||
if (elements.first().val() == "") { //include_empty | ||
elements = elements.slice(1); | ||
} | ||
elements.remove(); | ||
for (var i = 0; i < results.length; i++) { | ||
var result = results[i]; | ||
var id = ('uuid' in result) ? result['uuid'] : result['id']; | ||
var name = ('display_name' in result) ? result['display_name'] : result['name']; | ||
sel.append('<option value=' + id + '>' + name + '</option>'); | ||
} | ||
} | ||
$.ajax({ | ||
type:'post', | ||
url: $(item).data('url'), | ||
data: data, | ||
complete: function(){ | ||
tfm.tools.hideSpinner(); | ||
}, | ||
error: function(){ | ||
notify(__("Error refreshing cache for " + attribute_name), 'error', true); | ||
}, | ||
success: on_success | ||
}) | ||
}); | ||
} |
32 changes: 0 additions & 32 deletions
32
app/assets/javascripts/foreman_xen/xenserver/populate_fields.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module FogExtensions | ||
module Xenserver | ||
module Host | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
attribute :display_name | ||
prepend FogExtensions::Xenserver::Host | ||
end | ||
|
||
def initialize(new_attributes = {}) | ||
super(new_attributes) | ||
attributes[:display_name] = "#{name} - #{mem_free_gb} GB free memory" | ||
end | ||
|
||
def mem_free_gb | ||
return metrics.memory_free.to_i / 1024 / 1024 / 1024 if metrics | ||
|
||
0 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/models/concerns/fog_extensions/xenserver/storage_repository.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module FogExtensions | ||
module Xenserver | ||
module StorageRepository | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
attribute :display_name | ||
prepend FogExtensions::Xenserver::StorageRepository | ||
end | ||
|
||
def initialize(new_attributes = {}) | ||
super(new_attributes) | ||
attributes[:display_name] = init_display_name | ||
end | ||
|
||
def free_space | ||
physical_size.to_i - physical_utilisation.to_i | ||
end | ||
|
||
def free_space_gb | ||
free_space.to_i / 1024 / 1024 / 1024 | ||
end | ||
|
||
def physical_size_gb | ||
physical_size.to_i / 1024 / 1024 / 1024 | ||
end | ||
|
||
def physical_utilisation_gb | ||
physical_utilisation.to_i / 1024 / 1024 / 1024 | ||
end | ||
|
||
def init_display_name | ||
srname = name | ||
unless shared | ||
pbd = pbds.first | ||
srname = "#{name} - #{pbd.host.name}" unless pbd.nil? | ||
end | ||
format('%{n} (%{f}: %{f_gb} GB - %{u}: %{u_gb} GB - %{t}: %{t_gb} GB)', | ||
n: srname, f: _('free'), f_gb: free_space_gb, | ||
u: _('used'), u_gb: physical_utilisation_gb, | ||
t: _('total'), t_gb: physical_size_gb) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module FogExtensions | ||
module Xenserver | ||
module Vdi | ||
extend ActiveSupport::Concern | ||
|
||
def id | ||
uuid | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.