foreman_xen 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 365378e8b9545f3690ba70b7a7330d0f1dbe4176
4
- data.tar.gz: 8c78d3fc70a33a56f7440e41f8d712926c9024f5
3
+ metadata.gz: bbea3b3d6ef90c6eff8545033d2df9ec9a12f881
4
+ data.tar.gz: e0b81c233dc652ebdaef50a7b18cd8276ef7dbf9
5
5
  SHA512:
6
- metadata.gz: 0841e7a228fdd5d3a039f09b6cf0096f6dc8af84d3d5f1280fada29edd72047020742f49b02272c34fb1661456e7d0e1f6fa96e1d1040e190be9167912aa8c63
7
- data.tar.gz: f6936add8819cafd4bbb862e9b77863fa9fec6babc338472f514109955a2a37bd4815e5829677cc79a7f312dbad45412c192e4f97f72af2639daa439c71fc5ec
6
+ metadata.gz: 00fedb50740623e4c74ca6d0d84698f2bc38cc8284687da0e5b16f762fa65994e420ddc79b4a247c6c3709b0cd6b04c83db4a01944cded3237c1b1493dc384c6
7
+ data.tar.gz: d8e15229b3cd13b20d8c8292fe676f0f9c1edcfcf5f2731d8c847b57d9188878e611f599d648b41ed20dc9b562158d6fb02b1f873418fb30ebd88e11bff7bcc0
@@ -62,8 +62,37 @@ module ForemanXen
62
62
  end
63
63
 
64
64
  def storage_pools
65
- storages = client.storage_repositories.select { |sr| sr.type!= 'udev' && sr.type!= 'iso'} rescue []
66
- storages.sort { |a, b| a.name <=> b.name }
65
+ results = Array.new
66
+
67
+ storages = client.storage_repositories.select { |sr| sr.type!= 'udev' && sr.type!= 'iso'} rescue []
68
+ hosts = client.hosts
69
+
70
+ storages.each do |sr|
71
+ subresults = Hash.new()
72
+ found = 0
73
+ hosts.each do |host|
74
+
75
+ if (sr.reference == host.suspend_image_sr)
76
+ found = 1
77
+ subresults[:name] = sr.name
78
+ subresults[:display_name] = sr.name + '(' + host.hostname + ')'
79
+ subresults[:uuid] = sr.uuid
80
+ break
81
+ end
82
+
83
+ end
84
+
85
+ if (found==0)
86
+ subresults[:name] = sr.name
87
+ subresults[:display_name] = sr.name
88
+ subresults[:uuid] = sr.uuid
89
+ end
90
+ results.push(subresults)
91
+ end
92
+
93
+ results.sort_by!{|item| item[:display_name] }
94
+ return results
95
+
67
96
  end
68
97
 
69
98
  def interfaces
@@ -198,7 +227,7 @@ module ForemanXen
198
227
  def create_vm_from_builtin(args)
199
228
 
200
229
  host = client.hosts.first
201
- storage_repository = client.storage_repositories.find { |sr| sr.name == "#{args[:VBDs][:print]}" }
230
+ storage_repository = client.storage_repositories.find { |sr| sr.uuid == "#{args[:VBDs][:sr_uuid]}" }
202
231
 
203
232
  gb = 1073741824 #1gb in bytes
204
233
  size = args[:VBDs][:physical_size].to_i * gb
@@ -13,6 +13,7 @@
13
13
  end
14
14
  end
15
15
  -%>
16
- <%= selectable_f f, :print, compute_resource.storage_pools.map(&:name), { :selected => selected }, :class => "span2", :label => _("Storage Repository") %>
16
+ <%= selectable_f f, :sr_uuid, compute_resource.storage_pools.map{ |item| [item[:display_name], item[:uuid]]}, { :selected => selected }, :class => "span2", :label => _("Storage Repository") %>
17
+
17
18
  <%= text_f f, :physical_size, :class => "input-mini", :label => _("Size (GB)"), :value => size %>
18
19
  </div>
@@ -91,19 +91,19 @@
91
91
  $('#xenstore-vm-data-ifs-0-netmask').val($('#subnet_mask', fields).val());
92
92
  $('#xenstore-vm-data-nameserver1').val($('#subnet_dns_primary', fields).val());
93
93
  $('#xenstore-vm-data-nameserver2').val($('#subnet_dns_secondary', fields).val());
94
- $('#xenstore-vm-data-ifs-0-ip').val($('#host_ip').val());
94
+ $('#xenstore-vm-data-ifs-0-ip').val($('#host_interfaces_attributes_0_ip').val());
95
95
  $('#xenstore-vm-data-environment').val($('#host_environment_id option:selected').text())
96
96
  })
97
97
  }
98
98
 
99
- subnet_id = $('#host_subnet_id option:selected').val();
99
+ subnet_id = $('#host_interfaces_attributes_0_subnet_id option:selected').val();
100
100
 
101
101
  if (subnet_id) {
102
102
  autocomplete_xenstore(subnet_id)
103
103
  }
104
104
 
105
- $(document).off('change.xenstore', '#host_subnet_id');
106
- $(document).on('change.xenstore', '#host_subnet_id', function (data) {
105
+ $(document).off('change.xenstore', '#host_interfaces_attributes_0_subnet_id');
106
+ $(document).on('change.xenstore', '#host_interfaces_attributes_0_subnet_id', function (data) {
107
107
  subnet_id = $('option:selected', data.target).val();
108
108
  if (subnet_id) {
109
109
  autocomplete_xenstore(subnet_id)
@@ -120,7 +120,7 @@
120
120
 
121
121
  $(document).off('click.xenstore', '#compute_resource_tab a');
122
122
  $(document).on('click.xenstore', '#compute_resource_tab a', function (data) {
123
- subnet_id = $('#host_subnet_id option:selected').val();
123
+ subnet_id = $('#host_interfaces_attributes_0_subnet_id option:selected').val();
124
124
 
125
125
  if (subnet_id) {
126
126
  autocomplete_xenstore(subnet_id)
@@ -40,9 +40,6 @@
40
40
 
41
41
  <!--Storage-->
42
42
  <div class="children_fields xenserver-raw" id="xenserver-storage" style="<%= hide_raw %>">
43
- <%= new_child_fields_template(f, :VBDs, {
44
- :object => compute_resource.new_volume,
45
- :partial => 'compute_resources_vms/form/volume', :form_builder_attrs => { :compute_resource => compute_resource, :new => new } }) %>
46
43
  <%= field_set_tag 'Storage', :id => 'storage_volumes', :title => _('Storage') do -%>
47
44
  <%= f.fields_for :VBDs do |i| %>
48
45
  <%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource, :new => new %>
@@ -59,35 +56,71 @@
59
56
  </div>
60
57
 
61
58
  <div class="children_fields" id="xenserver-vm-start" style="<%= hide_raw %>">
62
- <%= field_set_tag 'VM Startup Options', :id => 'vm_starup_options', :title => _('Power ON this machine') do -%>
63
- <div class="form-group">
64
- <label class="col-md-2 control-label" for="xenserver-vm-start-params">Power ON this VM</label>
65
- <div class="col-md-4">
66
- <div class="controls">
67
- <% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start] || '1' %>
68
- <%= checkbox_f f, :start, { :checked => (checked == '1')} if fields_enabled %>
69
- </div>
70
- </div>
71
- </div>
59
+ <%= field_set_tag 'VM Startup Options', :id => 'vm_starup_options', :title => _('Power ON this VM') do -%>
60
+ <%= checkbox_f f, :start, :checked => true, :label => _("Power ON this VM") %>
72
61
  <% end -%>
73
62
  </div>
74
63
 
75
64
 
76
65
 
77
66
  <script type="text/javascript">
67
+
68
+ // Check if its a computer resource template then just do not show the form of XenStore
69
+
70
+ if ($("#compute_attribute_compute_profile_id").length > 0){
71
+ $('#xenserver-xenstore-data').hide(1)
72
+ }
78
73
 
74
+ $(document).off('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name');
75
+ $(document).on('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name', function (data) {
76
+ if ($('option:selected', data.target).val() == "") {
77
+ $('.xenserver-raw').show(1000)
78
+ // IE and Chrome
79
+ $('.buildin_templates').prop("disabled", false);
80
+ $('#compute_attribute_vm_attrs_builtin_template_name').removeAttr('disabled');
81
+ } else {
82
+ $('.xenserver-raw').hide(1000)
83
+ $('#compute_attribute_vm_attrs_builtin_template_name').val($("#compute_attribute_vm_attrs_builtin_template_name option:contains('No template')").val());
84
+ // IE and Chrome
85
+ $('#compute_attribute_vm_attrs_builtin_template_name').attr("disabled", 'disabled');
86
+ $('.buildin_templates').prop("disabled", true);
87
+
88
+ }
89
+
90
+ });
91
+
92
+ $(document).off('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name');
93
+ $(document).on('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name', function (data) {
94
+ $('.xenserver-raw').show(1000);
95
+ $('.buildin_templates').prop("disabled", false);
96
+ $('#compute_attribute_vm_attrs_builtin_template_name').removeAttr('disabled');
97
+ })
98
+
99
+
100
+ // Create a new host windows
101
+
79
102
  $(document).off('change.xenserver', '#host_compute_attributes_custom_template_name');
80
103
  $(document).on('change.xenserver', '#host_compute_attributes_custom_template_name', function (data) {
81
104
  if ($('option:selected', data.target).val() == "") {
82
- $('.xenserver-raw').show(1000)
105
+ $('.xenserver-raw').show(1000)
106
+ // IE and Chrome
107
+ $('.buildin_templates').prop("disabled", false);
108
+ $('#host_compute_attributes_builtin_template_name').removeAttr('disabled');
83
109
  } else {
84
- $('.xenserver-raw').hide(1000)
110
+ $('.xenserver-raw').hide(1000)
111
+ $('#host_compute_attributes_builtin_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
112
+ // IE and Chrome
113
+ $('#host_compute_attributes_builtin_template_name').attr("disabled", 'disabled');
114
+ $('.buildin_templates').prop("disabled", true);
115
+
85
116
  }
86
117
 
87
118
  });
88
119
 
89
120
  $(document).off('change.xenserver', '#host_compute_attributes_builtin_template_name');
90
121
  $(document).on('change.xenserver', '#host_compute_attributes_builtin_template_name', function (data) {
91
- $('.xenserver-raw').show(1000)
122
+ $('.xenserver-raw').show(1000);
123
+ $('.buildin_templates').prop("disabled", false);
124
+ $('#host_compute_attributes_builtin_template_name').removeAttr('disabled');
92
125
  })
93
- </script>
126
+ </script>
@@ -1,3 +1,3 @@
1
1
  module ForemanXen
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_xen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Nemirovsky, Michal Piotrowski, Avi Israeli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake