kytoon 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ * Wed Jun 12 2013 Dan Prince <dprince@redhat.com> - 1.3.9
2
+ -XenServer: Extract configure_host_network (matelaket)
3
+ -XenServer: Fix: Configure host network before configuring nodes (matelaket)
4
+ -Remote exec fix - abstract connection checking loop (matelaket)
5
+ -XenServer: check domid before ssh key injection (dprince)
6
+
1
7
  * Thu May 30 2013 Dan Prince <dprince@redhat.com> - 1.3.8
2
8
  -Re-release 1.3.7 as 1.3.8 to fix bad gem.
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.8
1
+ 1.3.9
@@ -188,6 +188,7 @@ fi
188
188
  create_instance(sg.gateway_ip, server['image_path'], server['hostname'], server['mac'], sg.bridge, host_ssh_public_key)
189
189
  network_type = sg.network_type
190
190
  if network_type == 'static' then
191
+ configure_host_network(sg)
191
192
  configure_static_networking(sg.gateway_ip, server['hostname'], server['ip_address'], sg.netmask, sg.gateway, sg.broadcast, server['mac'], sg.dns_nameserver)
192
193
  else
193
194
  raise "Unsupported network type '#{sg.network_type}'"
@@ -231,21 +232,28 @@ fi
231
232
  end
232
233
  end
233
234
 
234
- def self.init_host(sg)
235
+ def self.configure_host_network(sg)
235
236
 
236
237
  cidr = IPAddr.new(sg.netmask).to_i.to_s(2).count("1")
237
238
 
238
- hosts_file_data = "127.0.0.1\tlocalhost localhost.localdomain\n"
239
- sg.servers.each do |server|
240
- hosts_file_data += "#{server['ip_address']}\t#{server['hostname']}\t#{server['hostname']}.local\n"
241
- end
242
-
243
239
  Kytoon::Util.remote_exec(%{
244
240
  # Add first IP to bridge
245
241
  if ! ip a | grep #{sg.gateway}/#{cidr} | grep #{sg.bridge}; then
246
242
  ip a add #{sg.gateway}/#{cidr} dev #{sg.bridge}
247
243
  fi
244
+ }, sg.gateway_ip)
245
+ end
246
+
247
+ def self.init_host(sg)
248
248
 
249
+ hosts_file_data = "127.0.0.1\tlocalhost localhost.localdomain\n"
250
+ sg.servers.each do |server|
251
+ hosts_file_data += "#{server['ip_address']}\t#{server['hostname']}\t#{server['hostname']}.local\n"
252
+ end
253
+
254
+ configure_host_network(sg)
255
+
256
+ Kytoon::Util.remote_exec(%{
249
257
  cat > /etc/hosts <<-EOF_CAT
250
258
  #{hosts_file_data}
251
259
  EOF_CAT
@@ -293,6 +301,10 @@ echo 1 > /proc/sys/net/ipv4/ip_forward
293
301
 
294
302
  # inject ssh from host
295
303
  DOMID=$(xe vm-param-get uuid=$UUID param-name="dom-id")
304
+ if [ "$DOMID" == "-1" -o -z "$DOMID" ]; then
305
+ echo "Unable to find valid domain ID."
306
+ exit 1
307
+ fi
296
308
  xenstore-rm -s /local/domain/$DOMID/data/guest/ssh_key 2> /dev/null
297
309
  xenstore-write -s /local/domain/$DOMID/data/host/ssh_key '{"name": "injectfile", "value": "#{file_data}"}'
298
310
  until [ -n "$INJECT_RETVAL" ]; do
@@ -77,13 +77,23 @@ module Util
77
77
  (retry_attempts+1).times do |count|
78
78
  sleep retry_sleep if count > 1
79
79
  out=%x{
80
- ssh #{SSH_OPTS} root@#{gateway_ip} bash <<-"REMOTE_EXEC_EOF"
81
- #{script_text}
82
- REMOTE_EXEC_EOF
80
+ ssh #{SSH_OPTS} root@#{gateway_ip} true
83
81
  }
84
82
  retval=$?
85
83
  break if retval.success?
86
84
  end
85
+
86
+ if not retval.success?
87
+ raise KytoonException, "Failed to connect to #{gateway_ip}."
88
+ end
89
+
90
+ out=%x{
91
+ ssh #{SSH_OPTS} root@#{gateway_ip} bash <<-"REMOTE_EXEC_EOF"
92
+ #{script_text}
93
+ REMOTE_EXEC_EOF
94
+ }
95
+ retval=$?
96
+
87
97
  if block_given? then
88
98
  yield retval.success?, out
89
99
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kytoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-30 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -289,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  segments:
291
291
  - 0
292
- hash: -4125311850560974611
292
+ hash: 4155049120962533494
293
293
  required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  none: false
295
295
  requirements: