Class: EC2::Platform::Solaris::Image
- Inherits:
-
Object
- Object
- EC2::Platform::Solaris::Image
- Defined in:
- lib/ec2/platform/solaris/image.rb
Overview
This class encapsulate functionality to create an file loopback image from a volume. The image is created using mkfile. Sub-directories of the volume, including mounts of local filesystems, are copied to the image. Symbolic links are preserved wherever possible.
Constant Summary collapse
- EXCLUDES =
[ '/mnt' ]
- WORKSPACE =
'/mnt/ec2-bundle-workspace'
- MOUNT =
File.join( WORKSPACE, 'mnt' )
- ARCHIVE =
File.join( WORKSPACE, 'archive' )
- PROFILING =
true
- RETRIES =
5
- DELAY =
10
Instance Method Summary collapse
-
#initialize(volume, filename, size, exclude, includes, filter, vfstab = nil, part_type = nil, arch = nil, script = nil, debug = false) ⇒ Image
constructor
———————————————————————#.
-
#make ⇒ Object
———————————————————————# Clone a running volume into a bootable Amazon Machine Image.
-
#set_partition_type(input) ⇒ Object
———————————————————————#.
Constructor Details
#initialize(volume, filename, size, exclude, includes, filter, vfstab = nil, part_type = nil, arch = nil, script = nil, debug = false) ⇒ Image
———————————————————————#
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/ec2/platform/solaris/image.rb', line 54 def initialize( volume, # path to volume to be bundled filename, # name of image file to create size, # size of image file in MB exclude, # list of directories to exclude includes, # This does absolutely nothing on solaris - warrenr filter, # Same as above - warrenr vfstab=nil, # file system table to use part_type=nil, # Disk partition type: MBR/GPT etc arch=nil, # Architecture of the bundled volume script=nil, # Post-cloning customization script debug = false ) @volume = volume @filename = filename @size = size @exclude = exclude @debug = debug @arch = arch @script = script self.set_partition_type( part_type ) if vfstab.nil? or vfstab == :legacy @vfstab = EC2::Platform::Solaris::Fstab::DEFAULT elsif File.exists? vfstab @vfstab = IO.read(vfstab) else @vfstab = vfstab end # Exclude the workspace if it is in the volume being bundled. @exclude << WORKSPACE if( WORKSPACE.index(volume) == 0 ) end |
Instance Method Details
#make ⇒ Object
———————————————————————# Clone a running volume into a bootable Amazon Machine Image.
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ec2/platform/solaris/image.rb', line 97 def make begin announce( "Cloning #{@volume} into image file #{@filename}...", true) announce( 'Excluding: ', true ) @exclude.each { |x| announce( "\t #{x}", true ) } archive prepare replicate ensure cleanup end end |
#set_partition_type(input) ⇒ Object
———————————————————————#
86 87 88 89 90 91 92 93 |
# File 'lib/ec2/platform/solaris/image.rb', line 86 def set_partition_type( input ) input ||= EC2::Platform::PartitionType::NONE if input == EC2::Platform::PartitionType::NONE @part_type = EC2::Platform::PartitionType::NONE else raise NotImplementedError, "Disk images not supported for Solaris" end end |