Class: Dcmgr::Models::Image

Inherits:
AccountResource show all
Defined in:
lib/dcmgr/models/image.rb

Overview

Metadata catalogs for bootable image file.

Constant Summary collapse

BOOT_DEV_SAN =
1
BOOT_DEV_LOCAL =
2

Constants inherited from BaseNew

BaseNew::LOCK_TABLES_KEY

Instance Method Summary collapse

Methods inherited from AccountResource

#account

Methods inherited from BaseNew

Proxy, dataset, install_data, install_data_hooks, lock!, unlock!

Instance Method Details

#to_hashObject



41
42
43
# File 'lib/dcmgr/models/image.rb', line 41

def to_hash
  super.merge({:source=>self.source.dup, :description=>description.to_s})
end

#validateObject



31
32
33
34
35
36
37
38
39
# File 'lib/dcmgr/models/image.rb', line 31

def validate
  unless [BOOT_DEV_SAN, BOOT_DEV_LOCAL].member?(self.boot_dev_type)
    errors.add(:boot_dev_type, "Invalid boot dev type: #{self.boot_dev_type}")
  end
  
  unless HostPool::SUPPORTED_ARCH.member?(self.arch)
    errors.add(:arch, "Unsupported arch type: #{self.arch}")
  end
end