diff --git a/devstack/lib/ironic b/devstack/lib/ironic index c7199ef208..9128e9ceb1 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -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 diff --git a/devstack/tools/ironic/scripts/configure-vm.py b/devstack/tools/ironic/scripts/configure-vm.py index 24cb04b0f4..26feadd736 100755 --- a/devstack/tools/ironic/scripts/configure-vm.py +++ b/devstack/tools/ironic/scripts/configure-vm.py @@ -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 diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh index 172a22ee37..20793db916 100755 --- a/devstack/tools/ironic/scripts/create-node.sh +++ b/devstack/tools/ironic/scripts/create-node.sh @@ -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 diff --git a/devstack/tools/ironic/templates/vm.xml b/devstack/tools/ironic/templates/vm.xml index cbfa391927..64d7899ba4 100644 --- a/devstack/tools/ironic/templates/vm.xml +++ b/devstack/tools/ironic/templates/vm.xml @@ -28,9 +28,8 @@
- - - + +