-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add localonly domain option to libvirt-network #376
Conversation
f9ede62
to
633494e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see 2nd review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dmacvicar/terraform-provider-libvirt/pull/288/files#diff-042e2374df248e4277a3506b065eb28aR512
in this patch we miss the resource.SET and (we lack on real test for this)
3862d25
to
10d86c4
Compare
Hopefully I sufficiently ripped off your test code :) It seems to work. |
4317ca2
to
7ede8e9
Compare
return &networkDef, nil | ||
} | ||
|
||
func testAccCheckLibvirtNetworkLocalOnlyStatus(name string, LocalOnlyStatus bool) resource.TestCheckFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nitpick
testAccCheckLibvirtNetworkLocalOnlyStatus
should be called:
ModuleTest_ + Testname
TestAccCheckLibvirtNetwork_LocalOnlyStatus
I know that this not documented so you coud not know it but we are trying to move all the testnames in this direction.
So when we run Acceptance test we get more the debug context and more ordered output/results
} | ||
} | ||
|
||
func testAccCheckLibvirtNetworkDNSForwarders(name string, expected []libvirtxml.NetworkDNSForwarder) resource.TestCheckFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: testAccCheckLibvirtNetworkDNSForwarders -> TestAccCheckLibvirtNetwork_DNSForwarders
resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.1.address", "10.10.0.67"), | ||
resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.1.domain", "my.domain.com"), | ||
resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.2.domain", "hello.com"), | ||
testAccCheckLibvirtNetworkDNSForwarders("libvirt_network.test_net", []libvirtxml.NetworkDNSForwarder{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍
libvirt/resource_libvirt_network.go
Outdated
@@ -161,6 +177,7 @@ func resourceLibvirtNetworkUpdate(d *schema.ResourceData, meta interface{}) erro | |||
} | |||
|
|||
func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) error { | |||
dnsPrefix := "dns.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: i would enforce here this to be a const
since will should never change
libvirt/resource_libvirt_network.go
Outdated
@@ -341,6 +367,8 @@ func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) erro | |||
} | |||
|
|||
func resourceLibvirtNetworkRead(d *schema.ResourceData, meta interface{}) error { | |||
dnsPrefix := "dns.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik const
is better here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me a part of short nitpicks but it is ok from my pov. thx
e4705df
to
dc4a9a5
Compare
I make a new DNS a sectrion of network, more like the upstream xml. Inside that new DNS section I include forwarders, which were under the main object, so this is a breaking change. But one that aligns with the upstream xml and one which allows much easier future growth of DNS management. I add 'localOnly' which tells dnsmasq to own all of the domain in question. Instead of forwarding unknown names. This way you can point your local DNS at the libvirt DNS for the domain in question, and the domain in question will not forward unknown hosts back to your local DNS.
dc4a9a5
to
7651ee5
Compare
@dmacvicar feel free to have a look, to me looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR dmacvicar#393 has introduced a new function name. ( merged). PR dmacvicar#376 was using the old name, which we merged after pr dmacvicar#393 and the review was done before merging dmacvicar#393. This commit just fix the name of function
This allows one to tell dnsmasq to own all of the domain in question.
Instead of forwarding unknown names. This way you can point your local
DNS at the libvirt DNS for the domain in question, and the domain in
question will not forward unknown hosts back to your local DNS.