When support for QEMU/KVM MAC addresses was added to virtinst/util.py last August [1], the first two bytes were inadvertently swapped, AFAICT. Instead of 54-52-00, the "canonical" prefix for QEMU/KVM addresses should be 52-54-00, as can be determined from http://git.savannah.gnu.org/cgit/qemu.git/tree/net.c#n2124 The attached patch changes all occurrences I found in the virtinst tree (hopefully I caught them all). Kaspar [1] https://www.redhat.com/archives/et-mgmt-tools/2008-August/msg00079.html
diff --git a/man/en/virt-clone.1 b/man/en/virt-clone.1 --- a/man/en/virt-clone.1 +++ b/man/en/virt-clone.1 @@ -257,17 +257,17 @@ Clone a guest to a physical device which original guests disks. If the destination device is bigger, the new guest can do a filesystem resize when it boots. .PP .Vb 5 \& # virt\-clone \e \& \-\-connect qemu:///system \e \& \-\-name demo \e \& \-\-file /dev/HostVG/DemoVM \e -\& \-\-mac 54:52:00:34:11:54 +\& \-\-mac 52:54:00:34:11:54 .Ve .SH "AUTHOR" .IX Header "AUTHOR" Written by Kazuki Mizushima, and a team of many other contributors. See the \s-1AUTHORS\s0 file in the source distribution for the complete list of credits. .SH "BUGS" .IX Header "BUGS" Report bugs to the mailing list \f(CW\*(C`http://www.redhat.com/mailman/listinfo/et\-mgmt\-tools\*(C'\fR diff --git a/man/en/virt-clone.pod b/man/en/virt-clone.pod --- a/man/en/virt-clone.pod +++ b/man/en/virt-clone.pod @@ -178,17 +178,17 @@ Clone a QEMU guest with multiple disks Clone a guest to a physical device which is at least as big as the original guests disks. If the destination device is bigger, the new guest can do a filesystem resize when it boots. # virt-clone \ --connect qemu:///system \ --name demo \ --file /dev/HostVG/DemoVM \ - --mac 54:52:00:34:11:54 + --mac 52:54:00:34:11:54 =head1 AUTHOR Written by Kazuki Mizushima, and a team of many other contributors. See the AUTHORS file in the source distribution for the complete list of credits. =head1 BUGS diff --git a/man/en/virt-install.1 b/man/en/virt-install.1 --- a/man/en/virt-install.1 +++ b/man/en/virt-install.1 @@ -632,17 +632,17 @@ times to setup more than one \s-1NIC\s0. Bridge device to connect the guest \s-1NIC\s0 to. This parameter is deprecated in favour of the \f(CW\*(C`\-\-network\*(C'\fR parameter. .IP "\-m \s-1MAC\s0, \-\-mac=MAC" 2 .IX Item "-m MAC, --mac=MAC" Fixed \s-1MAC\s0 address for the guest; If this parameter is omitted, or the value \&\f(CW\*(C`RANDOM\*(C'\fR is specified a suitable address will be randomly generated. For Xen virtual machines it is required that the first 3 pairs in the \s-1MAC\s0 address be the sequence '00:16:3e', while for \s-1QEMU\s0 or \s-1KVM\s0 virtual machines it must -be '54:52:00'. +be '52:54:00'. .IP "\-\-nonetworks" 2 .IX Item "--nonetworks" Request a virtual machine without any network interfaces. .Sh "Graphics Configuration" .IX Subsection "Graphics Configuration" If no graphics option is specified, \f(CW\*(C`virt\-install\*(C'\fR will default to \-\-vnc if the \s-1DISPLAY\s0 environment variable is set, otherwise \-\-nographics is used. .IP "\-\-vnc" 2 diff --git a/man/en/virt-install.pod.in b/man/en/virt-install.pod.in --- a/man/en/virt-install.pod.in +++ b/man/en/virt-install.pod.in @@ -433,17 +433,17 @@ Network device model as seen by the gues by the hypervisor, e.g.: 'e1000', 'rtl8139', 'virtio', ... =item B<mac> Fixed MAC address for the guest; If this parameter is omitted, or the value C<RANDOM> is specified a suitable address will be randomly generated. For Xen virtual machines it is required that the first 3 pairs in the MAC address be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must -be '54:52:00'. +be '52:54:00'. =back =item --nonetworks Request a virtual machine without any network interfaces. =item -b BRIDGE, --bridge=BRIDGE diff --git a/tests/clone-xml/cross-pool-in.xml b/tests/clone-xml/cross-pool-in.xml --- a/tests/clone-xml/cross-pool-in.xml +++ b/tests/clone-xml/cross-pool-in.xml @@ -21,19 +21,19 @@ <source file='/default-pool/testvol1.img'/> <target dev='hda' bus='ide'/> </disk> <disk type='block' device='disk'> <source dev='/default-pool/testvol2.img'/> <target dev='hdb' bus='ide'/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/tests/clone-xml/empty-disks-in.xml b/tests/clone-xml/empty-disks-in.xml --- a/tests/clone-xml/empty-disks-in.xml +++ b/tests/clone-xml/empty-disks-in.xml @@ -28,19 +28,19 @@ <target dev='sda' bus='scsi'/> <readonly/> </disk> <disk type='file' device='disk'> <source file='/tmp/virtinst-test2.img'/> <target dev='sdb' bus='scsi'/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/tests/clone-xml/general-cfg-in.xml b/tests/clone-xml/general-cfg-in.xml --- a/tests/clone-xml/general-cfg-in.xml +++ b/tests/clone-xml/general-cfg-in.xml @@ -21,19 +21,19 @@ <source file='/tmp/virtinst-test1.img'/> <target dev='hda' bus='ide'/> </disk> <disk type='block' device='disk'> <source dev='/dev/loop0'/> <target dev='hdb' bus='ide'/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/tests/clone-xml/managed-storage-in.xml b/tests/clone-xml/managed-storage-in.xml --- a/tests/clone-xml/managed-storage-in.xml +++ b/tests/clone-xml/managed-storage-in.xml @@ -21,19 +21,19 @@ <source file='/default-pool/testvol1.img'/> <target dev='hda' bus='ide'/> </disk> <disk type='block' device='disk'> <source dev='/default-pool/testvol2.img'/> <target dev='hdb' bus='ide'/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/tests/clone-xml/noclone-storage-in.xml b/tests/clone-xml/noclone-storage-in.xml --- a/tests/clone-xml/noclone-storage-in.xml +++ b/tests/clone-xml/noclone-storage-in.xml @@ -25,19 +25,19 @@ <disk type='file' device='floppy'> <target dev='fdb' bus='fdc'/> </disk> <disk type='block' device='cdrom'> <target dev='sda' bus='scsi'/> <readonly/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/tests/clone-xml/readonly-disks-in.xml b/tests/clone-xml/readonly-disks-in.xml --- a/tests/clone-xml/readonly-disks-in.xml +++ b/tests/clone-xml/readonly-disks-in.xml @@ -36,19 +36,19 @@ </disk> <disk type='file' device='cdrom'> <source file='test3.img'/> <target dev='sdc' bus='scsi'/> <readonly/> <shareable/> </disk> <interface type='network'> - <mac address='54:52:00:6c:a0:cb'/> + <mac address='52:54:00:6c:a0:cb'/> <source network='test1'/> </interface> <interface type='network'> - <mac address='54:52:00:6c:bb:ca'/> + <mac address='52:54:00:6c:bb:ca'/> <source network='test2'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> </devices> </domain> diff --git a/virtinst/util.py b/virtinst/util.py --- a/virtinst/util.py +++ b/virtinst/util.py @@ -176,35 +176,35 @@ def get_default_arch(): # this function is directly from xend/server/netif.py and is thus # available under the LGPL, # Copyright 2004, 2005 Mike Wray <mike.wray@xxxxxx> # Copyright 2005 XenSource Ltd def randomMAC(type = "xen"): """Generate a random MAC address. 00-16-3E allocated to xensource - 54-52-00 used by qemu/kvm + 52-54-00 used by qemu/kvm The OUI list is available at http://standards.ieee.org/regauth/oui/oui.txt. The remaining 3 fields are random, with the first bit of the first random field set 0. >>> randomMAC().startswith("00:16:36") True >>> randomMAC("foobar").startswith("00:16:36") True >>> randomMAC("xen").startswith("00:16:36") True - >>> randomMAC("qemu").startswith("54:52:00") + >>> randomMAC("qemu").startswith("52:54:00") True @return: MAC address string """ - ouis = { 'xen': [ 0x00, 0x16, 0x36 ], 'qemu': [ 0x54, 0x52, 0x00 ] } + ouis = { 'xen': [ 0x00, 0x16, 0x36 ], 'qemu': [ 0x52, 0x54, 0x00 ] } try: oui = ouis[type] except KeyError: oui = ouis['xen'] mac = oui + [ random.randint(0x00, 0x7f),
_______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools