Bug 203865 - devel/libvirt: Installation clobbers libvirt/qemu/networks/default.xml (use @sample)
Summary: devel/libvirt: Installation clobbers libvirt/qemu/networks/default.xml (use @...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Roman Bogorodskiy
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2015-10-19 07:42 UTC by packet
Modified: 2015-11-01 15:15 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (novel)


Attachments
libvirt configuration handling improvements (3.67 KB, patch)
2015-10-25 13:05 UTC, Roman Bogorodskiy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description packet 2015-10-19 07:42:45 UTC
Port always reinstalls /usr/local/etc/libvirt/qemu/networks/default.xml, even if its contents changed. This makes changes to the default network tedious, as they have to repeated after every update.
Comment 1 Roman Bogorodskiy freebsd_committer 2015-10-19 15:42:23 UTC
Here's the proposed fix: https://reviews.freebsd.org/D3938.
Would appreciate if you could test. I'll give some more testing tomorrow as well.
Comment 2 packet 2015-10-19 22:29:18 UTC
(In reply to Roman Bogorodskiy from comment #1)
Thanks for taking your time. The patch looks good, but I can't test it at the moment. I will look what I can do tomorrow.
Comment 3 packet 2015-10-19 23:41:31 UTC
(In reply to Roman Bogorodskiy from comment #1)
Okay, now it tested the patch with default settings and default make.conf: Patch does not apply cleanly (whitespace issues). When manually "applied", it doesn't clobber default.xml anymore. But: If default.xml is deleted, it is recreated. If autostart is disabled for default.xml, it is again set to start automatically.
Comment 4 Roman Bogorodskiy freebsd_committer 2015-10-20 14:13:28 UTC
Thanks for testing the patch.

As for persisting autostart configuration I'm not sure how that could be done, because we somehow need to figure out if it's a fresh install or update over existing configuration.

At this moment the only idea I have is to disable configuring of autostart completely and update pkg-message with an instruction how to enable autostart for the default network.

Thoughts?
Comment 5 packet 2015-10-20 21:28:41 UTC
(In reply to Roman Bogorodskiy from comment #4)
Yes, that sounds good. I would also suggest moving the default network config to /usr/local/share/examples, as it would otherwise pop up again after each upgrade if it was deleted before. This makes first time configuration a bit harder, but does not alter customized configurations when upgrading.
Comment 6 Roman Bogorodskiy freebsd_committer 2015-10-22 17:38:53 UTC
(In reply to packet from comment #5)
Yeah, that sounds good.

I'll prepare a patch during this weekend (I hope) and will also provide some starter instructions in the pkg-message.

Maybe it is worth to create a wiki page as well because could be not easy at first.
Comment 7 Roman Bogorodskiy freebsd_committer 2015-10-25 13:05:59 UTC
Created attachment 162441 [details]
libvirt configuration handling improvements

Here's a new patch. It wasn't that easy to test, hope I didn't miss anything.

Basically, it does the following:

 - Networks configuration goes into %%EXAMPLESDIR%%
 - pkg-message moved to files/pkg-message.in to allow substitution and updated with instructions how to enable default network
 - While here, convert virtlockd.conf to use @sample

Feedback appreciated.
Comment 8 commit-hook freebsd_committer 2015-11-01 15:12:09 UTC
A commit references this bug:

Author: novel
Date: Sun Nov  1 15:11:07 UTC 2015
New revision: 400619
URL: https://svnweb.freebsd.org/changeset/ports/400619

Log:
  devel/libvirt: improve configuration handling

  libvirt stores various configuration objects in XML files and
  also uses symlinks to enable/disable various things. While
  using @sample could prevent from touching user-modified configs,
  it is quite cumbersome to preserve state of enabled or disabled
  symlink controlled objects across reinstall.

  In order to address this situation:

   * Install these configuration files into %%EXAMPLESDIR%%,
   * Update pkg-message with instructions how to apply the
     default configuration if user wants to. Also, pkg-message
     moved to files/pkg-message.in to allow substitution,
   * While here, convert virtlockd.conf to @sample
   * Bump PORTREVISION

  PR:			203865
  Differential Revision:	D3938

Changes:
  head/devel/libvirt/Makefile
  head/devel/libvirt/files/pkg-message.in
  head/devel/libvirt/pkg-message
  head/devel/libvirt/pkg-plist
Comment 9 Roman Bogorodskiy freebsd_committer 2015-11-01 15:15:24 UTC
Last revision of the patch committed.
Please let me know if you have any issues still.