libvirt: standardize sed replacement strings
The original code inconsistently uses replacement strings either limited to capital letters or with additional percentage symbols. The use of percentage symbols is preferred to mitigate the possibility of accidental replacements. Standardize the sed replacement strings to use percentage symbols. Test plan: PASS: Regression for default and mad examples PASS: unit test the replacement values for all configurations Story: 2010816 Task: 48611 Change-Id: I35959d7ae8cd46e613a1d0b3a1fcb44fc3f0b1d6 Signed-off-by: Michel Thebeau <michel.thebeau@windriver.com>
This commit is contained in:
parent
2066a90fa5
commit
5f1da7dbdc
@ -1,5 +1,5 @@
|
||||
<domain type='kvm' id='164'>
|
||||
<name>NAME</name>
|
||||
<name>%NAME%</name>
|
||||
<memory unit='GiB'>%MEM%</memory>
|
||||
<currentMemory unit='GiB'>%MEM%</currentMemory>
|
||||
<vcpu placement='static'>%CPU%</vcpu>
|
||||
@ -28,20 +28,20 @@
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK0'/>
|
||||
<source file='%DISK0%'/>
|
||||
<backingStore/>
|
||||
<target dev='sda' bus='sata'/>
|
||||
<boot order='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<source file='%DISK1%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='ISO'/>
|
||||
<source file='%ISO%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdc' bus='sata'/>
|
||||
<readonly/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<domain type='kvm' id='164'>
|
||||
<name>NAME</name>
|
||||
<name>%NAME%</name>
|
||||
<memory unit='GiB'>%MEM%</memory>
|
||||
<currentMemory unit='GiB'>%MEM%</currentMemory>
|
||||
<vcpu placement='static'>%CPU%</vcpu>
|
||||
@ -28,26 +28,26 @@
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK0'/>
|
||||
<source file='%DISK0%'/>
|
||||
<backingStore/>
|
||||
<target dev='sda' bus='sata'/>
|
||||
<boot order='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<source file='%DISK1%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK2'/>
|
||||
<source file='%DISK2%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdc' bus='sata'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='ISO'/>
|
||||
<source file='%ISO%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdd' bus='sata'/>
|
||||
<readonly/>
|
||||
|
@ -173,11 +173,11 @@ create_controller() {
|
||||
cp controller.xml ${DOMAIN_FILE}
|
||||
fi
|
||||
sed -i -e "
|
||||
s,NAME,${CONTROLLER_NODE},
|
||||
s,%NAME%,${CONTROLLER_NODE},
|
||||
s,%CPU%,${CPU},
|
||||
s,%MEM%,${MEM},
|
||||
s,DISK0,${DISK_LOCATION}/${CONTROLLER_NODE}-0.img,
|
||||
s,DISK1,${DISK_LOCATION}/${CONTROLLER_NODE}-1.img,
|
||||
s,%DISK0%,${DISK_LOCATION}/${CONTROLLER_NODE}-0.img,
|
||||
s,%DISK1%,${DISK_LOCATION}/${CONTROLLER_NODE}-1.img,
|
||||
s,%BR1%,${BRIDGE_INTERFACE}1,
|
||||
s,%BR2%,${BRIDGE_INTERFACE}2,
|
||||
s,%BR3%,${BRIDGE_INTERFACE}3,
|
||||
@ -187,14 +187,14 @@ create_controller() {
|
||||
sudo qemu-img create -f qcow2 ${DISK_LOCATION}/${CONTROLLER_NODE}-1.img 200G
|
||||
if ([ "$CONFIGURATION" == "simplex" ] || [ "$CONFIGURATION" == "duplex" ]); then
|
||||
sed -i -e "
|
||||
s,DISK2,${DISK_LOCATION}/${CONTROLLER_NODE}-2.img,
|
||||
s,%DISK2%,${DISK_LOCATION}/${CONTROLLER_NODE}-2.img,
|
||||
" ${DOMAIN_FILE}
|
||||
sudo qemu-img create -f qcow2 ${DISK_LOCATION}/${CONTROLLER_NODE}-2.img 200G
|
||||
fi
|
||||
if [ $i -eq 0 ]; then
|
||||
sed -i -e "s,ISO,${ISOIMAGE}," ${DOMAIN_FILE}
|
||||
sed -i -e "s,%ISO%,${ISOIMAGE}," ${DOMAIN_FILE}
|
||||
else
|
||||
sed -i -e "s,ISO,," ${DOMAIN_FILE}
|
||||
sed -i -e "s,%ISO%,," ${DOMAIN_FILE}
|
||||
fi
|
||||
sudo virsh define ${DOMAIN_FILE}
|
||||
if [ $i -eq 0 ]; then
|
||||
@ -267,11 +267,11 @@ create_node() {
|
||||
sudo qemu-img create -f qcow2 ${DISK_LOCATION}/${NODE}-1.img 200G
|
||||
cp ${IDENTITY}.xml ${DOMAIN_FILE}
|
||||
sed -i -e "
|
||||
s,NAME,${NODE},
|
||||
s,%NAME%,${NODE},
|
||||
s,%CPU%,${CPU},
|
||||
s,%MEM%,${MEM},
|
||||
s,DISK0,${DISK_LOCATION}/${NODE}-0.img,;
|
||||
s,DISK1,${DISK_LOCATION}/${NODE}-1.img,
|
||||
s,%DISK0%,${DISK_LOCATION}/${NODE}-0.img,;
|
||||
s,%DISK1%,${DISK_LOCATION}/${NODE}-1.img,
|
||||
s,%BR1%,${BRIDGE_INTERFACE}1,
|
||||
s,%BR2%,${BRIDGE_INTERFACE}2,
|
||||
s,%BR3%,${BRIDGE_INTERFACE}3,
|
||||
|
@ -1,5 +1,5 @@
|
||||
<domain type='kvm' id='187'>
|
||||
<name>NAME</name>
|
||||
<name>%NAME%</name>
|
||||
<memory unit='GiB'>%MEM%</memory>
|
||||
<currentMemory unit='GiB'>%MEM%</currentMemory>
|
||||
<vcpu placement='static'>%CPU%</vcpu>
|
||||
@ -28,14 +28,14 @@
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK0'/>
|
||||
<source file='%DISK0%'/>
|
||||
<backingStore/>
|
||||
<target dev='sda' bus='sata'/>
|
||||
<boot order='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<source file='%DISK1%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
</disk>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<domain type='kvm' id='187'>
|
||||
<name>NAME</name>
|
||||
<name>%NAME%</name>
|
||||
<memory unit='GiB'>%MEM%</memory>
|
||||
<currentMemory unit='GiB'>%MEM%</currentMemory>
|
||||
<vcpu placement='static'>%CPU%</vcpu>
|
||||
@ -28,14 +28,14 @@
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK0'/>
|
||||
<source file='%DISK0%'/>
|
||||
<backingStore/>
|
||||
<target dev='sda' bus='sata'/>
|
||||
<boot order='1'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='DISK1'/>
|
||||
<source file='%DISK1%'/>
|
||||
<backingStore/>
|
||||
<target dev='sdb' bus='sata'/>
|
||||
</disk>
|
||||
|
Loading…
Reference in New Issue
Block a user