Skip to content
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

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

eparis
Copy link
Contributor

@eparis eparis commented Aug 26, 2018

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.

Copy link
Collaborator

@MalloZup MalloZup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 2nd review

Copy link
Collaborator

@MalloZup MalloZup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eparis eparis force-pushed the localonly-domain branch 2 times, most recently from 3862d25 to 10d86c4 Compare September 2, 2018 14:23
@eparis
Copy link
Contributor Author

eparis commented Sep 2, 2018

Hopefully I sufficiently ripped off your test code :) It seems to work.

@eparis eparis force-pushed the localonly-domain branch 2 times, most recently from 4317ca2 to 7ede8e9 Compare September 2, 2018 23:47
Repository owner deleted a comment from eparis Sep 3, 2018
Repository owner deleted a comment from Bischoff Sep 3, 2018
Repository owner deleted a comment from eparis Sep 3, 2018
return &networkDef, nil
}

func testAccCheckLibvirtNetworkLocalOnlyStatus(name string, LocalOnlyStatus bool) resource.TestCheckFunc {
Copy link
Collaborator

@MalloZup MalloZup Sep 3, 2018

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 {
Copy link
Collaborator

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{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

@@ -161,6 +177,7 @@ func resourceLibvirtNetworkUpdate(d *schema.ResourceData, meta interface{}) erro
}

func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) error {
dnsPrefix := "dns.0"
Copy link
Collaborator

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

@@ -341,6 +367,8 @@ func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) erro
}

func resourceLibvirtNetworkRead(d *schema.ResourceData, meta interface{}) error {
dnsPrefix := "dns.0"
Copy link
Collaborator

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

Copy link
Collaborator

@MalloZup MalloZup left a 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

@eparis eparis force-pushed the localonly-domain branch 2 times, most recently from e4705df to dc4a9a5 Compare September 4, 2018 01:29
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.
Repository owner deleted a comment from Bischoff Sep 4, 2018
Repository owner deleted a comment from Bischoff Sep 4, 2018
@MalloZup
Copy link
Collaborator

MalloZup commented Sep 4, 2018

@dmacvicar feel free to have a look, to me looks good.
@eparis nice pr thx! 🏆

Copy link
Collaborator

@flavio flavio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MalloZup
Copy link
Collaborator

MalloZup commented Sep 5, 2018

👍 🤗 🎉 thx @flavio flavio and @eparis

@MalloZup MalloZup merged commit 7e074ab into dmacvicar:master Sep 5, 2018
MalloZup added a commit to MalloZup/terraform-provider-libvirt that referenced this pull request Sep 5, 2018
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants