kytoon 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * Thu Sep 20 2012 Dan Prince <dprince@redhat.com> - 1.2.3
2
+ - XenServer: Use vm-clone once a vm has been imported to speed up
3
+ group creation.
4
+
1
5
  * Wed Sep 19 2012 Dan Prince <dprince@redhat.com> - 1.2.2
2
6
  - Default group_type to GROUP_TYPE env variable if it
3
7
  isn't set.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.2.3
@@ -264,7 +264,18 @@ echo 1 > /proc/sys/net/ipv4/ip_forward
264
264
  file_data = Base64.encode64("/root/.ssh/authorized_keys,#{ssh_public_key}")
265
265
 
266
266
  Kytoon::Util.remote_exec(%{
267
- UUID=$(xe vm-import filename=#{image_path})
267
+ BASE_VM_NAME=$(basename #{image_path})
268
+ BASE_VM_UUID=$(xe vm-list name-label=$BASE_VM_NAME | grep uuid | sed -e 's|.*: ||')
269
+
270
+ if [ -z "$BASE_VM_UUID" ]; then
271
+ # create base vm for future use
272
+ BASE_UUID=$(xe vm-import filename=#{image_path})
273
+ xe vm-param-set name-label=$BASE_VM_NAME uuid=$BASE_UUID
274
+ xe vm-param-set other-config:kytoon_base_vm=true uuid=$BASE_UUID
275
+ fi
276
+
277
+ UUID=$(xe vm-clone vm=$BASE_VM_NAME new-name-label=${BASE_VM_NAME}_new)
278
+ xe vm-param-remove param-name=other-config param-key=kytoon_base_vm uuid=$UUID
268
279
  xe vm-param-set name-label=#{hostname} uuid=$UUID
269
280
  NETWORK_UUID=$(xe network-list bridge=#{xen_bridge} | grep -P "^uuid" | cut -f2 -d: | cut -f2 -d" ")
270
281
  xe vif-destroy uuid=$VIF_UUID &> /dev/null
@@ -294,23 +305,13 @@ echo 1 > /proc/sys/net/ipv4/ip_forward
294
305
 
295
306
  def self.cleanup_instances(gw_ip)
296
307
  Kytoon::Util.remote_exec(%{
297
- rpm -ev openstack-xen-plugins &> /dev/null
298
- yum clean all &> /dev/null
299
-
300
308
  for UUID in $(xe vm-list is-control-domain=false | grep uuid | sed -e 's|.*: ||'); do
301
- echo "Destroying Xen instance uuid: $UUID"
302
- xe vm-shutdown force=true uuid=$UUID
303
- xe vm-destroy uuid=$UUID
304
- done
305
-
306
- for UUID in $(xe vdi-list read-only=false | grep "^uuid" | sed -e 's|.*: ||'); do
307
- echo "Destroying VDI uuid: $UUID"
308
- xe vdi-destroy uuid=$UUID
309
- done
310
-
311
- for UUID in $(xe vif-list | grep uuid | sed -e 's|.*: ||'); do
312
- echo "Destroying Xen VIF uuid: $UUID"
313
- xe vif-destroy uuid=$UUID
309
+ # destroy all instances except the basevm's
310
+ if ! xe vm-param-get param-name=other-config uuid=$UUID | grep -c kytoon_base_vm; then
311
+ echo "Destroying Xen instance uuid: $UUID"
312
+ xe vm-shutdown force=true uuid=$UUID
313
+ xe vm-uninstall uuid=$UUID force=true
314
+ fi
314
315
  done
315
316
 
316
317
  }, gw_ip) do |ok, out|
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.2.2
4
+ version: 1.2.3
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: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2012-09-21 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: 3888021228185023517
292
+ hash: 63162516198761670
293
293
  required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  none: false
295
295
  requirements: