Change-Id: I685de4207f1f7f17264cc4ad2d81c3348ca20074pull/70/merge
@@ -149,6 +149,7 @@ suites: | |||
control_cloud_digitalocean.sls: tests/pillar/control_cloud_digitalocean.sls | |||
control_cloud_openstack.sls: tests/pillar/control_cloud_openstack.sls | |||
control_virt.sls: tests/pillar/control_virt.sls | |||
control_virt_custom.sls: tests/pillar/control_virt_custom.sls | |||
- name: minion_multi_master_failover | |||
provisioner: |
@@ -574,6 +574,11 @@ Salt virt with KVM cluster | |||
.. literalinclude:: tests/pillar/control_virt.sls | |||
:language: yaml | |||
salt virt with custom destination for image file | |||
.. literalinclude:: tests/pillar/control_virt_custom.sls | |||
:language: yaml | |||
Usage | |||
===== |
@@ -354,7 +354,10 @@ def _get_image_info(hypervisor, name, **kwargs): | |||
elif hypervisor in ['kvm', 'qemu']: | |||
ret['disktype'] = 'qcow2' | |||
ret['filename'] = '{0}{1}'.format(name, '.qcow2') | |||
ret['pool'] = __salt__['config.option']('virt.images') | |||
if 'img_dest' in kwargs: | |||
ret['pool'] = kwargs['img_dest'] | |||
else: | |||
ret['pool'] = __salt__['config.option']('virt.images') | |||
return ret | |||
@@ -408,10 +411,11 @@ def _disk_profile(profile, hypervisor, **kwargs): | |||
'pool': '[{0}] '.format(kwargs.get('pool', '0')) | |||
} | |||
elif hypervisor in ['qemu', 'kvm']: | |||
overlay = {'format': 'qcow2', | |||
'model': 'virtio', | |||
'pool': __salt__['config.option']('virt.images') | |||
} | |||
if 'img_dest' in kwargs: | |||
pool = kwargs['img_dest'] | |||
else: | |||
pool = __salt__['config.option']('virt.images') | |||
overlay = {'format': 'qcow2', 'model': 'virtio', 'pool': pool} | |||
else: | |||
overlay = {} | |||
@@ -589,7 +593,8 @@ def init(name, | |||
xml = _gen_vol_xml(name, | |||
disk_name, | |||
args['size'], | |||
hypervisor) | |||
hypervisor, | |||
**kwargs) | |||
define_vol_xml_str(xml) | |||
elif hypervisor in ['qemu', 'kvm']: | |||
@@ -599,7 +604,10 @@ def init(name, | |||
# disk size TCP cloud | |||
disk_size = args['size'] | |||
img_dir = __salt__['config.option']('virt.images') | |||
if 'img_dest' in kwargs: | |||
img_dir = kwargs['img_dest'] | |||
else: | |||
img_dir = __salt__['config.option']('virt.images') | |||
img_dest = os.path.join( | |||
img_dir, | |||
name, |
@@ -30,6 +30,7 @@ update-guestfs-appliance: | |||
{%- set size = control.size.get(node.size) %} | |||
salt_control_virt_{{ cluster_name }}_{{ node_name }}: | |||
module.run: | |||
- name: virtng.init | |||
@@ -44,6 +45,9 @@ salt_control_virt_{{ cluster_name }}_{{ node_name }}: | |||
seed: True | |||
serial_type: pty | |||
console: True | |||
{%- if node.img_dest is defined %} | |||
img_dest: {{ node.img_dest }} | |||
{%- endif %} | |||
- unless: virsh list --all --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$" | |||
#salt_control_seed_{{ cluster_name }}_{{ node_name }}: | |||
@@ -61,9 +65,9 @@ salt_virt_autostart_{{ cluster_name }}_{{ node_name }}: | |||
- vm_: {{ node_name }}.{{ cluster.domain }} | |||
- state: true | |||
- unless: virsh list --autostart --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$" | |||
{%- endif %} | |||
{%- endif %} | |||
{%- endfor %} |
@@ -0,0 +1,55 @@ | |||
virt: | |||
disk: | |||
three_disks: | |||
- system: | |||
size: 4096 | |||
image: ubuntu.qcow | |||
- repository_snapshot: | |||
size: 8192 | |||
image: snapshot.qcow | |||
- cinder-volume: | |||
size: 2048 | |||
salt: | |||
minion: | |||
enabled: true | |||
master: | |||
host: config01.dc01.domain.com | |||
control: | |||
enabled: true | |||
virt_enabled: true | |||
size: | |||
small: | |||
cpu: 1 | |||
ram: 1 | |||
medium: | |||
cpu: 2 | |||
ram: 4 | |||
large: | |||
cpu: 4 | |||
ram: 8 | |||
medium_three_disks: | |||
cpu: 2 | |||
ram: 4 | |||
disk_profile: three_disks | |||
cluster: | |||
vpc20_infra: | |||
domain: neco.virt.domain.com | |||
engine: virt | |||
config: | |||
engine: salt | |||
host: master.domain.com | |||
node: | |||
ubuntu1: | |||
provider: node01.domain.com | |||
image: ubuntu.qcow | |||
size: medium | |||
img_dest: /var/lib/libvirt/ssdimages | |||
ubuntu2: | |||
provider: node02.domain.com | |||
image: bubuntu.qcomw | |||
size: small | |||
img_dest: /var/lib/libvirt/hddimages | |||
ubuntu3: | |||
provider: node03.domain.com | |||
image: meowbuntu.qcom2 | |||
size: medium_three_disks |