Update Ironic VM network connection
When VM is dirrectly connected to OVS (current setup) there is no port in OVS when VM is in powered off state. Since Ironic plug port to network when VM is in powered-off state. Port should be present in OVS even when VM is powered-off. This patch adds additional network bridge called br-$VM_NAME for each VM. Adds additional interface ovs-$VM_NAME which is added to both OVS and br-$VM_NAME. And configures VM NIC in br-$VM_NAME instead of direct connection to OVS switch. Now connection looks like: Linux Bridge OVS -------- ----------- --------- | vm-1 | <--> | br-vm-1 | <---> | br-bm | -------- ----------- --------- Change-Id: I317dd9429684a14d16ecf2887d45c2b014e36a84 Partial-bug: #1526403
This commit is contained in:
parent
6d846590bc
commit
8fe320753c
@ -1306,6 +1306,12 @@ function cleanup_baremetal_basic_ops {
|
||||
local vm_name
|
||||
for vm_name in $(_ironic_bm_vm_names); do
|
||||
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/cleanup-node.sh $vm_name"
|
||||
# Cleanup node bridge/interfaces
|
||||
sudo ip link set ovs-$vm_name down
|
||||
sudo ip link set br-$vm_name down
|
||||
sudo ovs-vsctl del-port ovs-$vm_name
|
||||
sudo ip link del dev ovs-$vm_name
|
||||
sudo ip link del dev br-$vm_name
|
||||
done
|
||||
|
||||
sudo ovs-vsctl --if-exists del-br $IRONIC_VM_NETWORK_BRIDGE
|
||||
|
@ -68,10 +68,11 @@ def main():
|
||||
help="CPU count for the VM.")
|
||||
parser.add_argument('--bootdev', default='hd',
|
||||
help="What boot device to use (hd/network).")
|
||||
parser.add_argument('--network', default="brbm",
|
||||
help='The libvirt network name to use')
|
||||
parser.add_argument('--libvirt-nic-driver', default='virtio',
|
||||
help='The libvirt network driver to use')
|
||||
parser.add_argument('--bridge', default="br-seed",
|
||||
help='The linux bridge name to use for seeding \
|
||||
the baremetal pseudo-node\'s OS image')
|
||||
parser.add_argument('--console-log',
|
||||
help='File to log console')
|
||||
parser.add_argument('--emulator', default=None,
|
||||
@ -89,7 +90,7 @@ def main():
|
||||
'memory': args.memory,
|
||||
'cpus': args.cpus,
|
||||
'bootdev': args.bootdev,
|
||||
'network': args.network,
|
||||
'bridge': args.bridge,
|
||||
'nicdriver': args.libvirt_nic_driver,
|
||||
'emulator': args.emulator,
|
||||
'disk_format': args.disk_format
|
||||
|
@ -62,6 +62,18 @@ else
|
||||
fi
|
||||
VOL_NAME="${NAME}.${DISK_FORMAT}"
|
||||
|
||||
# Create bridge and add VM interface to it.
|
||||
# Additional interface will be added to this bridge and
|
||||
# it will be plugged to OVS.
|
||||
# This is needed in order to have interface in OVS even
|
||||
# when VM is in shutdown state
|
||||
|
||||
sudo brctl addbr br-$NAME
|
||||
sudo ip link set br-$NAME up
|
||||
sudo ovs-vsctl add-port $BRIDGE ovs-$NAME -- set Interface ovs-$NAME type=internal
|
||||
sudo ip link set ovs-$NAME up
|
||||
sudo brctl addif br-$NAME ovs-$NAME
|
||||
|
||||
if ! virsh list --all | grep -q $NAME; then
|
||||
virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
|
||||
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL >&2
|
||||
@ -73,7 +85,7 @@ if ! virsh list --all | grep -q $NAME; then
|
||||
$TOP_DIR/scripts/configure-vm.py \
|
||||
--bootdev network --name $NAME --image "$volume_path" \
|
||||
--arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
|
||||
--emulator $EMULATOR --network $BRIDGE --disk-format $DISK_FORMAT $VM_LOGGING >&2
|
||||
--emulator $EMULATOR --bridge br-$NAME --disk-format $DISK_FORMAT $VM_LOGGING >&2
|
||||
|
||||
# Createa Virtual BMC for the node if IPMI is used
|
||||
if [[ $(type -P vbmc) != "" ]]; then
|
||||
|
@ -28,9 +28,8 @@
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<interface type='network'>
|
||||
<source network='%(network)s'/>
|
||||
<virtualport type='openvswitch'/>
|
||||
<interface type='bridge'>
|
||||
<source bridge='%(bridge)s'/>
|
||||
<model type='%(nicdriver)s'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</interface>
|
||||
|
Loading…
Reference in New Issue
Block a user