Hi,
I¹m using openstack to bring up VMs on Ubuntu servers. I am trying to
support live migration with SR-IOV networking interfaces through macvtap.
My libvirt version is 1.2.2. To make sure that the networking interface
with the same name exists on the destination host, I renamed the interface
name on both hosts. However libvirt is not happy with that. Although the
interface after renaming is accessible from the host, libvirt always give
the above error while bringing up a VM with the interface.
The interface XML is in below:
<interface type="direct">
<mac address="fa:16:3e:79:52:26"/>
<model type="virtio"/>
<driver name="vhost"/>
<source dev="srv424ac2f0-eb0" mode="passthrough"/>
<virtualport type="802.1Qbh">
<parameters profileid="BaoliPortProfile0"/>
</virtualport>
</interface>
openstack nova uses createWithFlags() to bring up the VM, and the above
error will cause exception, and the VM will be left in shutoff state.
Afterwards, However, the VM can be brought up with either a
domain.create() or on the host with Œsudo virsh start <domain>¹.
Note that the VM after being brought up with the second create() call
works perfectly in terms of networking configuration and connectivity.
However, the VM cannot be migrated any more due to the same error.
The error is thrown from src/util/virnetdev.c.
Note that using the same ioctl in a standalone linux program works
perfectly in terms of accessing the renamed interface. See below:
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <netdb.h>
#include <stdio.h>
char *getmac(char *iface)
{
#define MAC_STRING_LENGTH 13
char *ret = malloc(MAC_STRING_LENGTH);
struct ifreq s;
int fd = socket(AF_PACKET, SOCK_DGRAM, 0);
strcpy(s.ifr_name, iface);
if (fd >= 0 && ret && 0 == ioctl(fd, SIOCGIFHWADDR, &s))
{
int i;
for (i = 0; i < 6; ++i)
snprintf(ret+i*2,MAC_STRING_LENGTH-i*2,"%02x",(unsigned char)
s.ifr_addr.sa_data[i]);
}
else
{
perror("malloc/socket/ioctl failed");
exit(1);
}
return(ret);
}
int main(int argc, char* argv[])
{
char *mac = getmac(argv[1]);
printf("%s\n",mac);
free(mac);
}
Can anybody explain to me why libvirt is not happy with the renamed
interface? Looking at virnetdev.c, it does basically the same as in the
above program.
Any help is appreciated!
Thanks,
Robert