Class: Dcmgr::Models::InstanceSpec

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

Constant Summary

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

#before_validateObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/dcmgr/models/instance_spec.rb', line 25

def before_validate
  default_config =
    case self.hypervisor
    when HostPool::HYPERVISOR_KVM
      {:block_driver=>'virtio', :nic_driver=>'virtio'}
    end

  self.config = default_config.merge(self.config || {})
  super
end

#to_hashObject



36
37
38
39
# File 'lib/dcmgr/models/instance_spec.rb', line 36

def to_hash
  super.merge({:config=>self.config, # yaml -> Hash
              })
end