Is it possible to configure libvirt's MAC generation?

brent s. bts at square-r00t.net
Tue Jun 16 14:12:53 UTC 2020


On 6/15/20 03:45, Erik Skultety wrote:
> On Fri, Jun 12, 2020 at 02:18:13PM -0400, Alvin Starr wrote:
>> One solution would be to dump the XML for the domain and then run something
>> like sed on it to change what ever you want and then update the domain.
>> Of course that will only work if the domain is stopped.
> 
> Another one is to use the virt-xml tool to update only the part you need:
> 
> virt-xml <domain> --edit --network network=default,mac.address='<new_mac>'
> 
> ^This would require you to restart the domain for the change to take effect.
> 
> virt-xml <domain> --update --remove device --network mac.address='<old_mac>'
> virt-xml <domain --update --add-device --network network=default,mac.address='<new_mac>'
> 
> ^This would not, because it translates to hot-unplug and hot-plug respectively.
> 
> Just an alternative to using sed.
> 
> Regards,
> Erik
> 

Just a reminder that it's generally a very bad idea to regex XML[0]. :)

Cheers!



[0] https://stackoverflow.com/a/1732454/733214

-- 
brent saner
https://square-r00t.net/
GPG info: https://square-r00t.net/gpg-info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20200616/0b389b6f/attachment.sig>


More information about the libvirt-users mailing list