Hi Mike,
Please apply the following patch to cloudstack, and copy the file
agent/bindir/libvirtqemuhook.in to repace /etc/libvirt/hooks/qemu on your
hosts
--start------------
diff --git a/agent/bindir/libvirtqemuhook.in b/agent/bindir/
libvirtqemuhook.in
index 7bf9634..a895280 100755
--- a/agent/bindir/libvirtqemuhook.in
+++ b/agent/bindir/libvirtqemuhook.in
@@ -16,6 +16,7 @@
# specific language governing permissions and limitations
# under the License.
import sys
+import re
from xml.dom.minidom import parse
from cloudutils.configFileOps import configFileOps
from cloudutils.networkConfig import networkConfig
@@ -24,21 +25,29 @@ def isOldStyleBridge(brName):
return True
else:
return False
+def isNewStyleBridge(brName):
+ if re.match(r"br(\w+)-(\d+)", brName) == None:
+ return False
+ else:
+ return True
def getGuestNetworkDevice():
netlib = networkConfig()
cfo = configFileOps("/etc/cloudstack/agent/agent.properties")
guestDev = cfo.getEntry("guest.network.device")
enslavedDev = netlib.getEnslavedDev(guestDev, 1)
- return enslavedDev
+ return enslavedDev.split(".")[0]
def handleMigrateBegin():
try:
domain = parse(sys.stdin)
for interface in domain.getElementsByTagName("interface"):
source = interface.getElementsByTagName("source")[0]
bridge = source.getAttribute("bridge")
- if not isOldStyleBridge(bridge):
+ if isOldStyleBridge(bridge):
+ vlanId = bridge.replace("cloudVirBr","")
+ elif isNewStyleBridge(bridge):
+ vlanId = re.sub(r"br(\w+)-","",bridge)
+ else:
continue
- vlanId = bridge.replace("cloudVirBr","")
phyDev = getGuestNetworkDevice()
newBrName="br" + phyDev + "-" + vlanId
source.setAttribute("bridge", newBrName)
-----end-------------
Kind regards,
Wei
2015-05-10 7:35 GMT+02:00 Mike C <[email protected]>:
> On 2015-05-08 20:07, Marcus wrote:
>
>> Can you confirm that those bridges and bond devices exist prior to
>> attempting migration, and that the VMs are attached to them and work?
>> Perhaps a 'brctl show' and 'virsh dumpxml'. Those look like they should be
>> cloudstack-generated guest network bridges and libvirt is complaining they
>> don't exist
>>
> Everything as far as I can tell is working minus this migration. I have a
> few virtual routers running on this machine and VMs, each environment
> running on the box seems to be doing working just fine. The base mgmtbr0,
> cloudbr0, cloudbr1 all come up at boot prior to CloudStack and are working.
>
> Command output is below.
>
> Also: the router seems to have been restarted and was allocated on the
> machine I was trying to migrate it to. Trying to migrate it back resulted
> in the same error message.
>
> -- Mike
>
>
> # brctl show
> bridge name bridge id STP enabled interfaces
> breth0-1209 8000.6805ca095d7f no eth0.1209
> breth0-1221 8000.6805ca095d7f no eth0.1221
> vnet0
> vnet3
> cloud0 8000.fe00a9fe0380 no vnet1
> cloudbr0 8000.6805ca095d7f no eth0.1100
> vnet2
> cloudbr1 8000.6805ca095d7f no eth0.1200
> mgmtbr0 8000.002564b522ef no eth1
> virbr0 8000.000000000000 yes
>
> # virsh dumpxml r-93-XML
> <domain type='kvm' id='18'>
> <name>r-93-VM</name>
> <uuid>5269e919-564a-4986-92c1-07464e99e3ce</uuid>
> <description>Debian GNU/Linux 7(64-bit)</description>
> <memory unit='KiB'>262144</memory>
> <currentMemory unit='KiB'>262144</currentMemory>
> <vcpu placement='static'>1</vcpu>
> <cputune>
> <shares>500</shares>
> </cputune>
> <resource>
> <partition>/machine</partition>
> </resource>
> <os>
> <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
> <boot dev='cdrom'/>
> <boot dev='hd'/>
> </os>
> <features>
> <acpi/>
> <apic/>
> <pae/>
> </features>
> <cpu>
> </cpu>
> <clock offset='utc'/>
> <on_poweroff>destroy</on_poweroff>
> <on_reboot>restart</on_reboot>
> <on_crash>destroy</on_crash>
> <devices>
> <emulator>/usr/bin/kvm-spice</emulator>
> <disk type='file' device='disk'>
> <driver name='qemu' type='qcow2' cache='none'/>
> <source
> file='/mnt/d5174632-721e-39ed-b93b-462539f63c77/c1b45654-5e74-420e-bf91-5beb745546f8'/>
> <target dev='hda' bus='ide'/>
> <alias name='ide0-0-0'/>
> <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> </disk>
> <disk type='file' device='cdrom'>
> <driver name='qemu' type='raw' cache='none'/>
> <source file='/usr/share/cloudstack-common/vms/systemvm.iso'/>
> <target dev='hdc' bus='ide'/>
> <readonly/>
> <alias name='ide0-1-0'/>
> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
> </disk>
> <controller type='usb' index='0'>
> <alias name='usb0'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
> function='0x2'/>
> </controller>
> <controller type='pci' index='0' model='pci-root'>
> <alias name='pci.0'/>
> </controller>
> <controller type='ide' index='0'>
> <alias name='ide0'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
> function='0x1'/>
> </controller>
> <controller type='virtio-serial' index='0'>
> <alias name='virtio-serial0'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
> function='0x0'/>
> </controller>
> <interface type='bridge'>
> <mac address='02:00:6b:5b:00:03'/>
> <source bridge='breth0-1221'/>
> <bandwidth>
> <inbound average='25600' peak='25600'/>
> <outbound average='25600' peak='25600'/>
> </bandwidth>
> <target dev='vnet0'/>
> <model type='e1000'/>
> <alias name='net0'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
> function='0x0'/>
> </interface>
> <interface type='bridge'>
> <mac address='0e:00:a9:fe:03:80'/>
> <source bridge='cloud0'/>
> <target dev='vnet1'/>
> <model type='e1000'/>
> <alias name='net1'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
> function='0x0'/>
> </interface>
> <interface type='bridge'>
> <mac address='06:13:ca:00:00:36'/>
> <source bridge='cloudbr0'/>
> <bandwidth>
> <inbound average='25600' peak='25600'/>
> <outbound average='25600' peak='25600'/>
> </bandwidth>
> <target dev='vnet2'/>
> <model type='e1000'/>
> <alias name='net2'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
> function='0x0'/>
> </interface>
> <serial type='pty'>
> <source path='/dev/pts/0'/>
> <target port='0'/>
> <alias name='serial0'/>
> </serial>
> <console type='pty' tty='/dev/pts/0'>
> <source path='/dev/pts/0'/>
> <target type='serial' port='0'/>
> <alias name='serial0'/>
> </console>
> <channel type='unix'>
> <source mode='bind' path='/var/lib/libvirt/qemu/r-93-VM.agent'/>
> <target type='virtio' name='r-93-VM.vport'/>
> <alias name='channel0'/>
> <address type='virtio-serial' controller='0' bus='0' port='1'/>
> </channel>
> <input type='tablet' bus='usb'>
> <alias name='input0'/>
> </input>
> <input type='mouse' bus='ps2'/>
> <input type='keyboard' bus='ps2'/>
> <graphics type='vnc' port='5900' autoport='yes' listen='172.16.16.31'>
> <listen type='address' address='172.16.16.31'/>
> </graphics>
> <video>
> <model type='cirrus' vram='9216' heads='1'/>
> <alias name='video0'/>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
> </video>
> <memballoon model='none'>
> <alias name='balloon0'/>
> </memballoon>
> </devices>
> <seclabel type='none'/>
> </domain>
>
>