mbailey-ruby-xen 0.1.1 → 0.1.2

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/lib/xen/backup.rb CHANGED
@@ -16,17 +16,14 @@ module Xen
16
16
  archive_name="#{name}-#{version}#{backup_file_ext}"
17
17
 
18
18
  slice = Xen::Slice.find(name) # XXX test for failure
19
- if slice.running?
20
- slice.stop
21
- sleep 10
19
+ if slice.running?
20
+ slice.stop(:blocking => true)
22
21
  restart_slice = true
23
22
  end
24
23
 
25
24
  temp_mount = `mktemp -d -p /mnt #{name}-XXXXX`.chomp # XXX test for failure
26
25
  `mount #{slice.root_disk.path} #{temp_mount}` # XXX test for failure
27
26
 
28
-
29
-
30
27
  FileUtils.mkdir_p backup_dir
31
28
 
32
29
  # Creating archive at backup_dir/archive_name ...
@@ -57,7 +54,7 @@ module Xen
57
54
  def self.find(*args)
58
55
  # return all
59
56
  slice = args.first
60
- Dir.glob("#{Xen::BACKUP_DIR}/*-*#{Xen::BACKUP_FILE_EXT}").collect { |file|
57
+ Dir.glob("#{Xen::BACKUP_DIR}/*-*#{Xen::BACKUP_FILE_EXT}").sort.collect { |file|
61
58
  if match = File.basename(file, Xen::BACKUP_FILE_EXT).match(/(#{ slice || '.*' })-(.*)/)
62
59
  new(:name => match[1], :version => match[2])
63
60
  end
data/lib/xen/command.rb CHANGED
@@ -74,8 +74,8 @@ module Xen
74
74
  `xm create #{config_file}`
75
75
  end
76
76
 
77
- def self.shutdown_instance(name, blocking=false)
78
- `xm shutdown #{'-w' if blocking} #{name}`
77
+ def self.shutdown_instance(name, options={})
78
+ `xm shutdown #{'-w' if options[:blocking]} #{name}`
79
79
  end
80
80
 
81
81
  # Xen::Command.create_image('memory=512', :size => '10Gb')
data/lib/xen/slice.rb CHANGED
@@ -105,8 +105,8 @@ module Xen
105
105
  @instance = Xen::Instance.find(@name)
106
106
  end
107
107
 
108
- def stop
109
- Xen::Instance.shutdown(@name)
108
+ def stop(options={})
109
+ Xen::Instance.shutdown(@name, options)
110
110
  @instance = Xen::Instance.find(@name)
111
111
  end
112
112
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbailey-ruby-xen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bailey
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-27 00:00:00 -08:00
13
+ date: 2009-03-16 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency