bk node and refactor
This commit is contained in:
+4
-2
@@ -1,7 +1,9 @@
|
||||
[Unit]
|
||||
Description=app vm
|
||||
After=network-online.target libvirtd.service fw.service infra.service auth.service
|
||||
Wants=fw.service infra.service auth.service
|
||||
After=network-online.target libvirtd.service fw.service bk.service infra.service auth.service
|
||||
Wants=fw.service bk.service infra.service auth.service
|
||||
ConditionPathIsMountPoint={{ hardware['disk']['data']['fs']['mount_point'] }}
|
||||
RequiresMountsFor={{ hardware['disk']['data']['fs']['mount_point'] }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=bk vm
|
||||
After=network-online.target libvirtd.service fw.service
|
||||
Wants=fw.service
|
||||
ConditionPathIsMountPoint={{ hardware['disk']['backup']['fs']['mount_point'] }}
|
||||
RequiresMountsFor={{ hardware['disk']['backup']['fs']['mount_point'] }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
TimeoutStopSec=360
|
||||
|
||||
ExecStart=/usr/bin/virsh -c qemu:///system start bk
|
||||
|
||||
ExecStartPost=/bin/sleep 30
|
||||
|
||||
ExecStop=/bin/bash -c '\
|
||||
/usr/bin/virsh -c qemu:///system shutdown bk; \
|
||||
while /usr/bin/virsh -c qemu:///system list --state-running --name | grep -q "bk"; do \
|
||||
echo "Waiting for bk to shutdown..."; \
|
||||
sleep 2; \
|
||||
done'
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=infra vm
|
||||
After=network-online.target libvirtd.service fw.service
|
||||
Wants=fw.service
|
||||
After=network-online.target libvirtd.service fw.service bk.service
|
||||
Wants=fw.service bk.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- Storage pool define -->
|
||||
<!-- backup-pool.xml -->
|
||||
<pool type='dir'>
|
||||
<name>backup-pool</name>
|
||||
<target>
|
||||
<path>/var/lib/libvirt/disk/backup</path>
|
||||
</target>
|
||||
</pool>
|
||||
@@ -3,6 +3,6 @@
|
||||
<pool type='dir'>
|
||||
<name>data-pool</name>
|
||||
<target>
|
||||
<path>/var/lib/libvirt/data</path>
|
||||
<path>/var/lib/libvirt/disk/data</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
||||
@@ -70,10 +70,14 @@
|
||||
</source>
|
||||
<address type='pci' domain='{{ device['domain'] }}' bus='{{ device['bus'] }}' slot='{{ device['slot'] }}' function='{{ device['function'] }}'/>
|
||||
</hostdev>
|
||||
{% endif %}
|
||||
{% if hostvars[target_vm]['vm']['data_storage'] is defined %}
|
||||
{% set pool = hostvars[target_vm]['vm']['data_storage']['pool'] %}
|
||||
{% set disk = hostvars['vmm']['hardware']['disk'][pool]['fs'] %}
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='raw' />
|
||||
<source file='{{ hardware['btrfs']['mount_point'] }}/{{ target_vm }}.raw' />
|
||||
<target dev='vdb' bus='virtio' />
|
||||
<source file='{{ disk['mount_point'] }}/{{ hostvars[target_vm]['vm']['name'] }}.raw' />
|
||||
<target dev='{{ hostvars[target_vm]['vm']['data_storage']['name'] }}' bus='virtio' />
|
||||
</disk>
|
||||
{% endif %}
|
||||
<tpm model='tpm-crb'>
|
||||
|
||||
Reference in New Issue
Block a user