-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Libvirt dhcp lease fix #613
Conversation
I accidently stopped network in virsh, then run
Then enabled network again and run
update: this may be unrelated to this PR |
looked at it for a couple seconds and can't see how myself without further info. for first phase, this pr doesn't make assumption about network name I don't believe for second phase,
if there are no values in self.active.itervalues(), should get None, which I don't believe is callable so shouldn't trigger hook, i don't think certainly mutating state outside of nixops with virsh could get you in trouble fairly quickly; and nixops seems still pretty "under development" for this backend anyway ;P |
I ended up wrapping the globalPreDestroyHook into |
nixops/backends/libvirtd.py
Outdated
self._logged_exec(["virsh", "-c", "qemu:///system", "net-start", net]) | ||
|
||
def _globalPreDestroyHook(self): | ||
self.log("running globalPreStopHook") |
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.
should be running globalPreDestroyHook
though you do network destroy, seems like it doesn't fix the problem for me. I have
and running |
if the virsh was this:
then the changes would persist after the network was destroyed with just live the changes do not persist after the network has been destroyed.
this pull request does the second method however if you have added lines via first method (or similar technique not using a live update) they will persist unless you delete them with virsh net update. |
So, this doesn't work with multiple deployments? If I destroy one deployment, network access to VMs in another deployment will be lost. |
Hmm you might be right, might have to think about this some more. However
as temp. workaround you could use a different network name for each
deployment, after cursory glance might be possible through
deployment.libvirtd.primary_net = "new_network_name" in
infrastructure-libvirtd.nix
…On Mon, Mar 6, 2017 at 5:11 AM, Данило Глинський (Danylo Hlynskyi) < ***@***.***> wrote:
So, this doesn't work with multiple deployments? If I destroy one
deployment, network access to VMs in another deployment will be lost.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#613 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIQmnewFFeiZFA_jCw61po7LhBziLkC8ks5ri-nfgaJpZM4MNuvd>
.
--
Brian "Zach" Abel
|
did a little testing and if you use the same physical specification (infrastructure-libvirt.nix), it won't be able to create two deployments (since they'll have same hostname), also it did lose connection (only verified it lost ssh connection) after destroying a deployment on the same network. haven't tested the network workaround I'll probably still use this personally but I think it would be unexpected behavior in the broader tool though I do think this feature could be provided in a reliable/compatible way by automatically generating network names or some similar scheme. |
Strangely enough, if I define
in guest's configuration, it publishes hostname to libvirt's If you could verify, that with this client configs you don't require patching XML, I can dig deeper into the issue. I tested this with
used nixos-17.03 |
I added these to logical specification (network.nix), and commented out the live patching of the network xml.
following that when doing the new leases did have the appropriate names (instead of nixos) as you say,
however the deploy hangs when starting nscd.service |
Maybe I was a bit unclear here, but Though I'm stuck again. DHCP leases are expired in an hour and not renewed until machine reboot, so this solution is still bad. Perhaps some DHCP refresh daemon on client could solve this problem? Don't know |
hmm, woops. yea not exactly a networking war veteran myself. was trying to go for a fix internal to nixops/libvirt, though for my personal needs it's not currently super high on the list of priorities. Do still think the xml hack could work if you forced each deployment to have a different network name. Not sure how bad a tradeoff that is in terms of configurability for more complex setups. |
allows to mutate global state of deployment once before stopping
multiple machines (that could otherwise experience multithreading problems) by defining a method with a fixed named "_globalPreDestroyHook" in any given backend, in this particular case, useful with libvirt
to restart the vitrual network your vms were running on before destroying them since the only way to quickly re assign old hostname to new ip in dhcp was to mutate state of the network with virsh
example of problem this solves here