-
Notifications
You must be signed in to change notification settings - Fork 111
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
Put NewVirConnection inside of PreCreateCheck, added error message fo… #18
Put NewVirConnection inside of PreCreateCheck, added error message fo… #18
Conversation
This PR modified PreCreateCheck to use NewVirConnection so that errors could be propagated outside of the driver and also added an error message if libvirt failed to connect + a likely reason for this error. |
@dhiltgen Friendly ping |
This breaks Master: (with a couple machines created)
This PR:
This also breaks
I didn't try other commands. |
947dba4
to
095fa7a
Compare
Hi @dhiltgen, |
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.
Sorry it took me so long to get back to this. Overall looks pretty good.
network, err = d.conn.NetworkDefineXML(xml) | ||
|
||
//TODO(aaron-prindle) see if this is needed? | ||
conn, err = d.getConn() |
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.
I don't think this is needed, since you're doing it on line https://github.com/dhiltgen/docker-machine-kvm/pull/18/files#diff-bda8ba8a54ef41ed9e8a4e3427ef653dR225
if err != nil { | ||
return err | ||
} | ||
network, err := conn.LookupNetworkByName(d.PrivateNetwork) |
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.
nit - style wise I'd keep this as d.conn.
095fa7a
to
783df29
Compare
I have submitted a new PR, removing the additional d.getConn(). I did not quite understand your nit, I tried to keep all d.conn calls in getConn. PTAL, thanks. |
@@ -7,7 +7,6 @@ import ( | |||
"encoding/xml" | |||
"errors" | |||
"fmt" | |||
"github.com/alexzorin/libvirt-go" |
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.
This breaks the build.
% make
GOGC=off go build -i -o docker-machine-driver-kvm
# github.com/dhiltgen/docker-machine-kvm
../kvm.go:91: undefined: libvirt in libvirt.VirConnection
../kvm.go:92: undefined: libvirt in libvirt.VirDomain
Makefile:4: recipe for target 'build' failed
make: *** [build] Error 2
If I add it back, it builds.
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.
Sorry, go-imports removed this. I have added it back.
|
||
if err != nil { | ||
return err | ||
} |
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.
Something seems wrong here. If the lookup fails on line 228, you set up the XML definition on 272, but then just error out instead of actually creating the network. We should try to create the network if it doesn't exist.
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.
This additional error check somehow got in. The network creation (NetworkDefineXML(xml)) is below (line 281) with an appropriate error catch. I will remove this error check as it does nothing.
783df29
to
7fdaeba
Compare
I have made the requested changes, PTAL. Thanks. |
Changes look good - thanks! Looks like you accidentally added the binary to your commit - please remove that so it's just the source and I think this is ready to merge. |
7fdaeba
to
7b04471
Compare
failure connection and possible reasons. Fixed previous error messages with docker-machine. Cleaned up code.
7b04471
to
661cec4
Compare
I have removed the binary now. PTAL, thanks! |
…r failure connection and possible reasons