Comments (5)
Hmm. Going with your suggestion, I "widened" the net... I tried setting command, section, and flags to 4. Flags wouldn't allow it (actually gave me a flags related error).
But...
cmd := uint32(4)
section := uint32(4)
fmt.Printf("NetworkUpdate(%d, %d, -1, %s, %d)\n", cmd, section, networkDhcpXML, 0)
err = client.NetworkUpdate(net, cmd, section, -1, networkDhcpXML, 0)
Gave me:
NetworkUpdate(4, 4, -1, <host name='vm-8029d8c8-ee6c-45b9-6476-3ba7381c3cb5' ip='192.168.123.7'/>, 0)
Setup network DHCP
... and as proof:
$ virsh net-dumpxml default
<network>
<name>default</name>
<uuid>bcb85dc8-ad27-4861-9f85-692167fd79fa</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:82:d1:6e'/>
<ip address='192.168.123.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.123.2' end='192.168.123.254'/>
<host name='vm-8029d8c8-ee6c-45b9-6476-3ba7381c3cb5' ip='192.168.123.7'/>
<host name='totally-fake-vm' ip='192.168.123.6'/>
</dhcp>
</ip>
</network>
... and running it again errors out (as expected):
NetworkUpdate(4, 4, -1, <host name='vm-8029d8c8-ee6c-45b9-6476-3ba7381c3cb5' ip='192.168.123.7'/>, 0)
panic: Requested operation is not valid: there is an existing dhcp host entry in network 'default' that matches "<host mac='unknown' name='vm-8029d8c8-ee6c-45b9-6476-3ba7381c3cb5' ip='192.168.123.7'/>"
Is something cross-wired somewhere? Even in my code? Sadly, I'm not spotting anything. (But also admitting I'm a Go rookie, haven't touched C in 30 years, and utter neophyte with Libvirt! LOL)
from go-libvirt.
Thank you so much for posting this issue. We've just run into it with the terraform libvirt provider.
Seems there has been work going on upstream to improve a situation where command
and section
argument ordering is swapped around.
See:
- v1 fix (not merged) https://listman.redhat.com/archives/libvir-list/2021-March/msg00054.html
- v2 fix (merged) https://listman.redhat.com/archives/libvir-list/2021-March/msg00758.html
from go-libvirt.
The error you're getting seems to be coming from virNetworkDefUpdateIP
in the libvirt sources. But that's not the right routine - you're trying to update the DHCP host settings, which is section "ip/dhcp/host", and is handled by virNetworkDefUpdateIPDHCPHost
. You'd get this error if the section
parameter passed into the NetworkUpdate
call were wrong (3 instead of 4), but libvirt.NetworkSectionIpDhcpHost
and NETWORK_SECTION_IP_DHCP_HOST
are both 4, in the sources I'm looking at. (libvirt 4.0.0). It might be interesting to try some other values for the section
parameter, and see if you get back sensible errors.
from go-libvirt.
I get the same response regardless of values (tried 1, 2, 3, 4, 5, and 500):
NetworkUpdate(3, 500, -1, <host name='vm-8029d8c8-ee6c-45b9-6476-3ba7381c3cb5' ip='192.168.123.7'/>, 0)
panic: Operation not supported: can't update 'ip' section of network 'default'
I am using Go 1.12 and modules. go.mod
is:
$ cat go.mod
module ip-dhcp-host
go 1.12
require github.com/digitalocean/go-libvirt v0.0.0-20190715144809-7b622097a793
Just in case there's a specific version or something.
from go-libvirt.
My take on this is cfergeau@8108763
from go-libvirt.
Related Issues (20)
- Make error public, to allow more fine grained control for clients HOT 4
- Disk usage shown by ConnectGetAllDomainStats is incorrect HOT 3
- Support for connection URIs HOT 6
- Tunnel via SSH? HOT 3
- Migrate Operations missing HOT 1
- Document minimum (or maximum) supported toolchain requirements
- Mentioned method Disconnected() does not exist HOT 1
- libvirttest.MockLibvirt does not implement net.Conn HOT 2
- Broken link to libvirt RPC knowledgebase HOT 1
- Inability to subscribe `metdata-change`, `device-added` and `device-removed` events HOT 5
- Support for QEMU Agent Command HOT 4
- CI occasionally times out HOT 1
- Can libvirt arm platform run X86 system? HOT 1
- Support for modular libvirt daemons HOT 4
- suggested breaking change: add context.Context support to API HOT 1
- cannot use 2147483648 (untyped int constant) as * value in constant declaration (overflows) HOT 4
- Connecting to Libvirt
- Deadlock if Stream Shutdown races with Push
- Q: What is the meaning of `NeedResults`? HOT 1
- Qemu special api
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-libvirt.