shu-san-scripts 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +0,0 @@
1
- # Copyright (c) 2010-2011 David Love
2
- #
3
- # Permission to use, copy, modify, and/or distribute this software for
4
- # any purpose with or without fee is hereby granted, provided that the
5
- # above copyright notice and this permission notice appear in all copies.
6
- #
7
- # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
- # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
- # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
- # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
- # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
- # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
- # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
- #
15
-
16
- # @author David Love
17
-
18
- require "uuidtools"
19
-
20
- # Extendes the {UUIDTools::UUID} class, adding the ability to
21
- # generate sequential UUID's
22
- class UUIDTools::UUID
23
-
24
- # Increments the internal UUID representation, returning a
25
- # new UUID that is different from, but greater, than the
26
- # current sequence number
27
- def next
28
- next_uuid = self.to_i
29
- next_uuid += 1
30
-
31
- # Return the newly created UUID
32
- return UUIDTools::UUID::parse_int(next_uuid)
33
- end
34
-
35
- end
@@ -1,45 +0,0 @@
1
- # Copyright (c) 2010-2011 David Love
2
- #
3
- # Permission to use, copy, modify, and/or distribute this software for
4
- # any purpose with or without fee is hereby granted, provided that the
5
- # above copyright notice and this permission notice appear in all copies.
6
- #
7
- # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
- # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
- # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
- # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
- # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
- # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
- # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
- #
15
-
16
- # @author David Love
17
-
18
- # Defines a class capable of creating iSCSI shares using the new
19
- # COMStar framework. This classes uses the various command line tools,
20
- # not the C API.
21
- class COMStar
22
-
23
- # Create a new, ready to use, iSCSI target. Functionally this is command
24
- # is equivalent to the old "shareiscsi=on" ZFS volume property.
25
- def self.new_target(volume_path)
26
-
27
- # Create a new disk target for the ZFS volume
28
- disk_target = %x[sbdadm create-lu /dev/zvol/rdsk/#{volume_path}]
29
-
30
- # Get the GUID of the new disk target from the output of the
31
- # target creation command
32
- guid = disk_target.split(/$/)[4].split[0]
33
-
34
- # Link the new disk target to the iSCSI framework
35
- vol_frame = %x[stmfadm add-view #{guid}]
36
-
37
- # Finally create the target...
38
- target = %x[itadm create-target]
39
-
40
- #... and return the name to the caller
41
- target_name = target.split[1]
42
- end
43
-
44
- end
45
-
@@ -1,36 +0,0 @@
1
- # Copyright (c) 2010-2011 David Love
2
- #
3
- # Permission to use, copy, modify, and/or distribute this software for
4
- # any purpose with or without fee is hereby granted, provided that the
5
- # above copyright notice and this permission notice appear in all copies.
6
- #
7
- # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
- # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
- # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
- # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
- # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
- # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
- # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
- #
15
-
16
- # @author David Love
17
-
18
- # Defines a class capable of manipulating ZFS volumes. This classes uses
19
- # the standard command line tools (+zfs+ and +zpool+), not the C API.
20
- class ZFS
21
-
22
- # Create a new volume, at the specified location and of the specified
23
- # size.
24
- #
25
- # NOTE: This command currently only supports the creation of sparse
26
- # volumes. If you really need pre-allocated volumes for some reason,
27
- # this command needs to be extended
28
- def self.new_volume(volume_path, volume_size)
29
-
30
- # Create the volume
31
- cmd = %x[zfs create -s -V #{volume_size} #{volume_path}]
32
-
33
- end
34
-
35
- end
36
-
@@ -1,94 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{shu-san-scripts}
8
- s.version = "0.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{David Love}]
12
- s.date = %q{2011-09-24}
13
- s.description = %q{See the README file.}
14
- s.email = %q{david@homeunix.org.uk}
15
- s.executables = [%q{store}]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".rvmrc",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "HISTORY",
26
- "LICENSE.txt",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "bin/store",
31
- "lib/SANStore.rb",
32
- "lib/SANStore/cli.rb",
33
- "lib/SANStore/cli/base.rb",
34
- "lib/SANStore/cli/commands.rb",
35
- "lib/SANStore/cli/commands/help.rb",
36
- "lib/SANStore/cli/commands/list_vols.rb",
37
- "lib/SANStore/cli/commands/new_vol.rb",
38
- "lib/SANStore/cli/logger.rb",
39
- "lib/SANStore/cri.rb",
40
- "lib/SANStore/cri/base.rb",
41
- "lib/SANStore/cri/command.rb",
42
- "lib/SANStore/cri/core_ext.rb",
43
- "lib/SANStore/cri/core_ext/string.rb",
44
- "lib/SANStore/cri/option_parser.rb",
45
- "lib/SANStore/helpers/uuid.rb",
46
- "lib/SANStore/iSCSI/comstar.rb",
47
- "lib/SANStore/zfs/zfs.rb",
48
- "shu-san-scripts.gemspec",
49
- "test/helper.rb",
50
- "test/test_shu-san-scripts.rb"
51
- ]
52
- s.homepage = %q{http://github.com/dlove24/shu-san-scripts}
53
- s.licenses = [%q{ISC}]
54
- s.require_paths = [%q{lib}]
55
- s.rubygems_version = %q{1.8.6}
56
- s.summary = %q{Scripts used to set-up and manage iSCSI targets on OpenSolaris (ZFS) systems.}
57
-
58
- if s.respond_to? :specification_version then
59
- s.specification_version = 3
60
-
61
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
- s.add_runtime_dependency(%q<cri>, ["~> 2.0.2"])
63
- s.add_runtime_dependency(%q<facets>, [">= 2.4"])
64
- s.add_runtime_dependency(%q<uuidtools>, ["~> 2.1.2"])
65
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
66
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
67
- s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
68
- s.add_development_dependency(%q<vclog>, ["~> 1.8.1"])
69
- s.add_development_dependency(%q<minitest>, [">= 0"])
70
- s.add_development_dependency(%q<riot>, [">= 0"])
71
- else
72
- s.add_dependency(%q<cri>, ["~> 2.0.2"])
73
- s.add_dependency(%q<facets>, [">= 2.4"])
74
- s.add_dependency(%q<uuidtools>, ["~> 2.1.2"])
75
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
76
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
77
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
78
- s.add_dependency(%q<vclog>, ["~> 1.8.1"])
79
- s.add_dependency(%q<minitest>, [">= 0"])
80
- s.add_dependency(%q<riot>, [">= 0"])
81
- end
82
- else
83
- s.add_dependency(%q<cri>, ["~> 2.0.2"])
84
- s.add_dependency(%q<facets>, [">= 2.4"])
85
- s.add_dependency(%q<uuidtools>, ["~> 2.1.2"])
86
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
87
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
88
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
89
- s.add_dependency(%q<vclog>, ["~> 1.8.1"])
90
- s.add_dependency(%q<minitest>, [">= 0"])
91
- s.add_dependency(%q<riot>, [">= 0"])
92
- end
93
- end
94
-
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'shu-san-scripts'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestShuSanScripts < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end