Cole Robinsonhttps://blog.wikichoon.com/2020-10-03T00:00:00-04:00Cole's dev logBetter output with /usr/bin/bugzilla --json2020-10-03T00:00:00-04:002020-10-03T00:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-10-03:/2020/10/bugzilla-json-output.html<p>In python-bugzilla 2.4.0 I added a <code>--json</code> output switch to <code>/usr/bin/bugzilla</code>.</p> <p>IMO this is the optimal way to process large amounts of bugzilla query output from the command laine. so if you are already doing just that with the old output options, consider switching to <code>--json …</code></p><p>In python-bugzilla 2.4.0 I added a <code>--json</code> output switch to <code>/usr/bin/bugzilla</code>.</p> <p>IMO this is the optimal way to process large amounts of bugzilla query output from the command laine. so if you are already doing just that with the old output options, consider switching to <code>--json</code>. That is, if you aren't ready to make the full leap to using the library directly ;)</p> <h4>Replace usage of <code>--raw</code></h4> <p>The older <code>--raw</code> output mode will print bug contents in a strange custom array-like output format that is poorly specified and impossible to parse reliably. Please use <code>--json</code> instead. <code>--raw</code> may be removed in the future.</p> <h4>Replace usage of <code>--outputformat</code></h4> <p>The older <code>--outputformat</code> option processes bug contents and prints them out in the specified string format. Variables are referenced with something akin to RPM macro format. Example:</p> <div class="highlight"><pre><span></span><code>$ bugzilla query --outputformat <span class="s1">&#39;%{id}::%{summary}&#39;</span> --id <span class="m">1234567</span> <span class="m">1234567</span>::Package should not ship a separate emacs sub-package </code></pre></div> <p>This has served us pretty well, but besides being a custom and poorly specified format, it has limitations with formatting subvalues of non-string bugzilla fields.</p> <p>With <code>--json</code> you can make use of the powerful <code>jq</code> tool which gives you the ability to do all manner of querying and processing of the output.</p> <p>This example duplicates the <code>--outputformat</code> example above:</p> <div class="highlight"><pre><span></span><code><span class="gp">$ </span>bugzilla query --json --id <span class="m">1234567</span> <span class="p">|</span> jq -r <span class="s1">&#39;.bugs[0] | &quot;\(.id)::\(.summary)&quot;&#39;</span> <span class="go">1234567::Package should not ship a separate emacs sub-package</span> </code></pre></div> <p>This example demonstrates accessing a structured subfield like <code>comments</code>. We print the first comment's creation time for a list of bugs:</p> <div class="highlight"><pre><span></span><code><span class="gp">$ </span>bugzilla query --json <span class="se">\</span> --product Fedora --component virt-manager --status OPEN <span class="p">|</span> <span class="se">\</span> jq -r <span class="s2">&quot;.bugs[].comments[0].creation_time&quot;</span> <span class="go">2020-07-08T16:35:14Z</span> <span class="go">2020-08-30T14:22:42Z</span> <span class="go">2020-04-12T20:28:24Z</span> <span class="go">2020-02-05T09:57:48Z</span> <span class="go">2020-09-09T15:17:32Z</span> <span class="go">2019-12-28T22:29:05Z</span> <span class="go">2020-08-15T21:20:02Z</span> <span class="go">2020-09-21T13:59:37Z</span> <span class="go">2020-09-18T08:50:28Z</span> </code></pre></div> <h4>Optimizing <code>--json</code> queried data</h4> <p>One downside of <code>--json</code> compared to <code>--outputformat</code> is that it will return all bug data even if you only plan to parse a subset of it. For big queries, or ones performed repeatedly, this can cause unnecessary load on the bugzilla instance.</p> <p><code>--outputformat</code> knows what fields you need, so will only fetch those from the bugzilla instance, transferring the minimally required amount of data. You can achieve the same thing manually with <code>--json</code> by also specifying the option <code>--includefield field1 --includefield field2 ..</code> for every field you need to process. Example:</p> <div class="highlight"><pre><span></span><code><span class="gp">$ </span>bugzilla query --json --includefield summary --id <span class="m">1234567</span> <span class="go">{</span> <span class="go"> &quot;bugs&quot;: [</span> <span class="go"> {</span> <span class="go"> &quot;id&quot;: 1234567,</span> <span class="go"> &quot;summary&quot;: &quot;Package should not ship a separate emacs sub-package&quot;</span> <span class="go"> }</span> <span class="go"> ]</span> <span class="go">}</span> </code></pre></div> <p>As a more general tip, use the bugzilla web UI to generate a query that only checks for changes after a certain timestamp that is relevant to you, and pass that to <a href="https://blog.wikichoon.com/2014/05/invoking-bugzilla-query-url-from.html"><code>query --from-url $URL</code></a>, so you can limit the time window for the data you are fetching.</p> <h4>Using <code>--json</code> to find bugzilla API field names</h4> <p>This applies to <code>--raw</code> as well, but you can use <code>--json</code> to find out the API name of custom fields in the bugzilla instance. Many times I've been asked questions like: 'How do I access bugzilla.redhat.com field FOOBAR from python-bugzilla?'. The simplest way to figure it out is to find a bug that you know has data filled in for that field, pass that bug ID to <code>bugzilla query --json --id XXX</code> and examine the output to find the field name. If they are custom fields they usually have a prefix like <code>cf_</code>, at least for bugzilla.redhat.com.</p>virt-install --cloud-init support2020-09-26T00:00:00-04:002020-09-26T00:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-09-26:/2020/09/virt-install-cloud-init.html<p>As part of GSOC 2019, <a href="https://athinapl.home.blog/2019/08/25/gsoc-2019-cloud-init-configuration-for-virt-manager-virt-install/">Athina Plaskasoviti implemented <code>--cloud-init</code> support for virt-install</a>. This post provides a bit more info about the feature.</p> <h4>Why cloud-init</h4> <p>For a long while, most mainstream Linux distros have shipped 'cloud images': <code>raw</code> or <code>qcow2</code> formatted disk images with the distro minimally pre-installed on it. These …</p><p>As part of GSOC 2019, <a href="https://athinapl.home.blog/2019/08/25/gsoc-2019-cloud-init-configuration-for-virt-manager-virt-install/">Athina Plaskasoviti implemented <code>--cloud-init</code> support for virt-install</a>. This post provides a bit more info about the feature.</p> <h4>Why cloud-init</h4> <p>For a long while, most mainstream Linux distros have shipped 'cloud images': <code>raw</code> or <code>qcow2</code> formatted disk images with the distro minimally pre-installed on it. These images typically have <a href="https://cloud-init.io/">cloud-init</a> set to run on VM bootup. cloud-init can do a variety of things, like add users, change passwords, register ssh keys, and generally perform any desired action on the VM OS. This only works when cloud-init is passed the right configuration by whatever platform is starting the VM, like OpenStack or virt-install. cloud-init supports many different <a href="https://cloudinit.readthedocs.io/en/latest/topics/datasources.html">datasources</a> for getting configuration outside the VM.</p> <p>Historically though the problem is that slapping these images into virt-install or virt-manager gives crappy results, because these tools were not providing any datasource. In this case, cloud-init reverts to its distro default configured behavior, which in most cases is unusable. For example on Fedora, the result was: hang waiting for cloud-init data, time out, drop to login prompt with all accounts locked.</p> <p>Prior to virt-install <code>--cloud-init</code> support, the simplest workaround was to use libguestfs, specifically <code>virt-customize</code>, to set a root password and disable cloud-init:</p> <div class="highlight"><pre><span></span><code><span class="gp">$ </span>virt-customize -a MY-CLOUD-IMAGE.qcow2 <span class="se">\</span> --root-password password:SUPER-SECRET-PASSWORD <span class="se">\</span> --uninstall cloud-init </code></pre></div> <h4>--cloud-init option</h4> <p>The <code>--cloud-init</code> option will tell virt-install to set up a <a href="https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html">nocloud</a> datasource via a specially formatted <code>.iso</code> file that is generated on the fly, and only used for the first VM bootup.</p> <p>The default behavior when <code>--cloud-init</code> is specified with no suboptions will do the following:</p> <ul> <li>Generate a random root password and print it to the terminal.</li> <li>Default to VM serial console access rather than graphical console access. Makes it easier to paste the password and gives more ssh-like behavior.</li> <li>Sets the root password to expire on first login. So the temporary password is only used once.</li> <li>Disables cloud-init for subsequent VM startups. Otherwise on the next VM boot you'd face locked accounts again.</li> </ul> <p>The <code>--cloud-init</code> also has suboptions to specify your own behavior, like transfer in a host ssh public key, pass in raw cloud-init <code>user-data</code>/<code>meta-data</code>, etc. See the <a href="https://github.com/virt-manager/virt-manager/blob/master/man/virt-install.rst#--cloud-init">virt-install --cloud-init man page section</a> for the specifics.</p> <h4>Room for improvement</h4> <p>This is all a step in the right direction but there's lots more we can do here:</p> <ul> <li>Extend virt-install's <code>--install</code> option to learn how to fetch cloud images for the specified distro. <a href="https://libosinfo.org/">libosinfo</a> and <a href="https://gitlab.com/libosinfo/osinfo-db">osinfo-db</a> already track cloud image download links for many distros so the info we need is already in place. We could make <code>virt-install --install fedora32,cloud=yes</code> a single way to pull down a cloud image, generate a cloud-init datasource, and create the VM in one shot.</li> <li>Use <code>--cloud-init</code> by default when the user passes us a cloud-init enabled disk image. <code>virt-customize</code> has a lot of disk image detection smarts already, but we aren't using that in virt-install yet.</li> <li>virt-manager UI support. There's an <a href="https://github.com/virt-manager/virt-manager/issues/143">issue tracking this</a> with some more thoughts in it.</li> <li>Similar support for <a href="https://coreos.com/ignition/">CoreOS Ignition</a> which fulfills a similar purpose as cloud-init for distros like <a href="https://getfedora.org/en/coreos/">Fedora CoreOS</a>. There's an <a href="https://github.com/virt-manager/virt-manager/issues/152">issue tracking this too</a>.</li> </ul> <p>I personally don't have plans to work on these any time soon, but I'm happy to provide guidance if anyone is interested in helping out!</p>virt-manager 3.0.0 released!2020-09-16T00:00:00-04:002020-09-16T00:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-09-16:/2020/09/virt-manager-300-released.html<p>Yesterday I released <a href="https://www.redhat.com/archives/virt-tools-list/2020-September/msg00003.html">virt-manager 3.0.0</a>. Despite the major version number bump, things shouldn't look too different from the previous release. For me the major version number bump reflects certain feature removals (like dropping virt-convert), and the large amount of internal code changes that were done, though there's a …</p><p>Yesterday I released <a href="https://www.redhat.com/archives/virt-tools-list/2020-September/msg00003.html">virt-manager 3.0.0</a>. Despite the major version number bump, things shouldn't look too different from the previous release. For me the major version number bump reflects certain feature removals (like dropping virt-convert), and the large amount of internal code changes that were done, though there's a few long awaited features sprinkled in like virt-install <code>--cloud-init</code> support which I plan to write more about later.</p> <p>This release includes:</p> <ul> <li>virt-install --cloud-init support (<a href="https://athinapl.home.blog/2019/08/25/gsoc-2019-cloud-init-configuration-for-virt-manager-virt-install/">Athina Plaskasoviti</a>, Cole Robinson)</li> <li><a href="https://blog.wikichoon.com/2020/07/virt-convert-removed.html">The virt-convert tool has been removed</a>. Please use virt-v2v instead</li> <li>A handful of UI XML configuration options have been removed, in an effort to reduce maintenance ongoing maintenance burden, and to be more consistent with what types of UI knobs we expose. The <a href="https://blog.wikichoon.com/2020/07/virt-manager-xml-editor.html">XML editor</a> is an alternative in most cases. For a larger discussion see <a href="https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html">this thread</a> and virt-manager's <a href="https://github.com/virt-manager/virt-manager/blob/master/DESIGN.md">DESIGN.md</a> file.</li> <li>The 'New VM' UI now has a 'Manual Install' option which creates a VM without any required install media</li> <li>In the 'New VM' UI, the network/pxe install option has been removed. If you need network boot, choose 'Manual Install' and set the boot device after initial VM creation</li> <li>'Clone VM' UI has been reworked and simplified</li> <li>'Migrate VM' UI now has an XML editor for the destination VM</li> <li>Global and per-vm option to disable graphical console autoconnect. This makes it easier to use virt-manager alongside another client like virt-viewer</li> <li>virt-manager: set guest time after VM restore (Michael Weiser)</li> <li>virt-manager: option to delete storage when removing disk device (Lily Nie)</li> <li>virt-manager: show warnings if snapshot operation is unsafe (Michael Weiser)</li> <li>Unattended install improvements (Fabiano Fidêncio)</li> <li>cli: new --xml XPATH=VAL option for making direct XML changes</li> <li>virt-install: new --reinstall=DOMAIN option</li> <li>virt-install: new --autoconsole text|graphical|none option</li> <li>virt-install: new --os-variant detect=on,require=on suboptions</li> <li>cli: --clock, --keywrap, --blkiotune, --cputune additions (Athina Plaskasoviti)</li> <li>cli: add --features kvm.hint-dedicated.state= (Menno Lageman)</li> <li>cli: add --iommu option (Menno Lageman)</li> <li>cli: Add --graphics websocket= support (Petr Benes)</li> <li>cli: Add --disk type=nvme source.* suboptions</li> <li>cli: Fill in all --filesystem suboptions</li> <li>Translation string improvements (Pino Toscano)</li> <li>Convert from .pod to .rst for man pages</li> <li>Switch to pytest as our test runner</li> <li>Massively improved unittest and uitest code coverage</li> <li>Now using github issues as our bug tracker</li> </ul>virt-manager libvirt XML editor UI2020-07-12T00:00:00-04:002020-07-12T00:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-07-12:/2020/07/virt-manager-xml-editor.html<p><a href="https://www.redhat.com/archives/virt-tools-list/2019-June/msg00099.html">virt-manager 2.2.0</a> was released in June of last year. It shipped with a major new feature: libvirt XML viewing and editing UI for new and existing domain, pools, volumes, networks.</p> <p>Every VM, network, and storage object page has a <strong>XML</strong> tab at the top. Here's an example with …</p><p><a href="https://www.redhat.com/archives/virt-tools-list/2019-June/msg00099.html">virt-manager 2.2.0</a> was released in June of last year. It shipped with a major new feature: libvirt XML viewing and editing UI for new and existing domain, pools, volumes, networks.</p> <p>Every VM, network, and storage object page has a <strong>XML</strong> tab at the top. Here's an example with that tab selected from the VM <strong>Overview</strong> section:</p> <p><img alt="VM XML editor" src="https://blog.wikichoon.com/images/079-xml1.png" width="500"></p> <p>Here's an example of the XML view when just a disk is selected. Note it only shows that single device's libvirt XML:</p> <p><img alt="Disk XML editor" src="https://blog.wikichoon.com/images/079-xml2.png" width="500"></p> <p>By default the XML is not editable; notice the warning at the top of the first image. After editing is enabled, the warning is gone, like in the second image. You can enable editing via Edit-&gt;Preferences from the main <strong>Manager</strong> window. Here's what the option looks like:</p> <p><img alt="XML edit preference" src="https://blog.wikichoon.com/images/079-xml-prefs.png" width="500"></p> <p>A bit of background: We are constantly receiving requests to expose libvirt XML config options in virt-manager's UI. Some of these knobs are necessary for &lt;1% but uninteresting to the rest. Some options are difficult to set from the command line because they must be set at VM install time, which means switch from virt-manager to virt-install which is not trivial. And so on. When these options aren't added to the UI, it makes life difficult for those affected users. It's also difficult and draining to have these types of justification conversations on the regular.</p> <p>The XML editing UI was added to relieve some of the pressure on virt-manager developers fielding these requests, and to give more power to advanced virt users. The users that know they need an advanced option are usually comfortable editing the libvirt XML directly. The XML editor doesn't detract from the existing UI much IMO, and it is uneditable by default to prevent less knowledgeable users from getting into trouble. It ain't gonna win any awards for great UI, but the feedback has been largely positive so far.</p>virt-convert tool removed in virt-manager.git2020-07-11T00:00:00-04:002020-07-11T00:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-07-11:/2020/07/virt-convert-removed.html<p>The next release of virt-manager will not ship the <code>virt-convert</code> tool, I removed it upstream with <a href="https://github.com/virt-manager/virt-manager/commit/ee9f93074bf74bd2e4c5177d750e7c438c7790cf">this commit</a>.</p> <p>Here's the slightly edited quote from my original proposal to remove it:</p> <blockquote> <p>virt-convert takes an ovf/ova or vmx file and spits out libvirt XML. It started as a code drop a …</p></blockquote><p>The next release of virt-manager will not ship the <code>virt-convert</code> tool, I removed it upstream with <a href="https://github.com/virt-manager/virt-manager/commit/ee9f93074bf74bd2e4c5177d750e7c438c7790cf">this commit</a>.</p> <p>Here's the slightly edited quote from my original proposal to remove it:</p> <blockquote> <p>virt-convert takes an ovf/ova or vmx file and spits out libvirt XML. It started as a code drop a long time ago that could translate back and forth between vmx, ovf, and virt-image, a <a href="https://blog.wikichoon.com/2014/04/deprecating-little-used-tool-virt-image1.html">long dead appliance format</a>. In 2014 I <a href="https://blog.wikichoon.com/2014/04/virt-convert-command-line-has-been.html">changed virt-convert</a> to do vmx -&gt; libvirt and ovf -&gt; libvirt which was a CLI breaking change, but I never heard a peep of a complaint. It doesn't do a particularly thorough job at its intended goal, I've seen 2-3 bug reports in the past 5 years and generally it doesn't seem to have any users. Let's kill it. If anyone has the desire to keep it alive it could live as a separate project that's a wrapper around virt-install but there's no compelling reason to keep it in virt-manager.git IMO</p> </blockquote> <p>That mostly sums it up. If there's any users of virt-convert out there, you likely can get similar results by extracting the relevant disk image from the <code>.vmx</code> or <code>.ovf</code> config, pass it to <code>virt-manager</code> or <code>virt-install</code>, and let those tools fill in the defaults. In truth that's about all <code>virt-convert</code> did in to begin with.</p> <p>Please see <a href="https://libguestfs.org/virt-v2v.1.html"><code>virt-v2v</code></a> for an actively maintained tool that can covert OVA/OVF appliances to libvirt + KVM. <a href="https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v">This redhat.com article</a> describes an example conversion.</p>python-bugzilla REST API support2020-06-29T13:00:00-04:002020-06-29T13:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-06-29:/2020/06/python-bugzilla-rest-api.html<p>I just released <strong><a href="https://github.com/python-bugzilla/python-bugzilla">python-bugzilla</a> 2.4.0</strong>. The main interesting bit it adds is support for <a href="https://wiki.mozilla.org/Bugzilla:REST_API">Bugzilla's REST API</a>.</p> <p>All previous versions of python-bugzilla and <code>/usr/bin/bugzilla</code> only used the XMLRPC API, but that is deprecated in Bugzilla 5.0+ and all new API development is taking place on …</p><p>I just released <strong><a href="https://github.com/python-bugzilla/python-bugzilla">python-bugzilla</a> 2.4.0</strong>. The main interesting bit it adds is support for <a href="https://wiki.mozilla.org/Bugzilla:REST_API">Bugzilla's REST API</a>.</p> <p>All previous versions of python-bugzilla and <code>/usr/bin/bugzilla</code> only used the XMLRPC API, but that is deprecated in Bugzilla 5.0+ and all new API development is taking place on the REST API.</p> <p>In practice there isn't any released bugzilla version that has big differences between the two API versions. On bugzilla.redhat.com specifically the XMLRPC API is still recommended, because some custom features are not available over REST yet. Note though that bugzilla.mozilla.org is looking at <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1599274">disabling the XMLRPC API entirely</a>, but they are usually ahead of the Bugzilla curve.</p> <p>By default, python-bugzilla will use some URL parsing heuristics to try to guess if the passed URL is for XMLRPC or REST.</p> <ul> <li>If URL contains <code>/xmlrpc</code>, assume XMLRPC</li> <li>If URL contains <code>/rest</code>, assume REST</li> <li>If the URL does not contain a path:<ul> <li>Try appending <code>/xmlrpc.cgi</code> and if the URL exists, use it</li> <li>Try appending <code>/rest</code> and if the URL exists, use it</li> </ul> </li> <li>Otherwise just attempt to initialize the XMLRPC backend</li> </ul> <p>In practice this should mean previously used URLs will continue to use XMLRPC.</p> <p>The <code>Bugzilla</code> API class also <code>force_rest</code> and <code>force_xmlrpc</code> init arguments to force use of a specific API for the passed URL. Whether REST or XMLRPC is used the existing API should continue to work as expected, it's simply a backend detail.</p> <p>From <code>/usr/bin/bugzilla</code> there aren't any explicit command line options to force use of one API or the other. If you pass a URL with an explicit <code>/rest</code> or <code>/xmlrpc.cgi</code> then the API will pick the correct backend based on the heuristic above. If your URL has a weirdly named REST API endpoint you can probably trick the heuristic with a funky URL like <code>https://fakebz.example.com/weird-rest-endpoint?/rest</code></p>virt-manager is deprecated in RHEL (but only RHEL)2020-06-16T13:00:00-04:002020-06-16T13:00:00-04:00Cole Robinsontag:blog.wikichoon.com,2020-06-16:/2020/06/virt-manager-deprecated-in-rhel.html<p><strong>TL;DR</strong>: I'm the primary author of virt-manager. virt-manager is deprecated in RHEL8 in favor of cockpit, but ONLY in RHEL8 and future RHEL releases. The upstream project virt-manager is still maintained and is still relevant for other distros.</p> <p>Google 'virt-manager deprecated' and you'll find some discussions suggesting virt-manager is …</p><p><strong>TL;DR</strong>: I'm the primary author of virt-manager. virt-manager is deprecated in RHEL8 in favor of cockpit, but ONLY in RHEL8 and future RHEL releases. The upstream project virt-manager is still maintained and is still relevant for other distros.</p> <p>Google 'virt-manager deprecated' and you'll find some discussions suggesting virt-manager is no longer maintained, <a href="https://cockpit-project.org/">Cockpit</a> is replacing virt-manager, virt-manager is going to be removed from every distro, etc. These conclusions are misinformed.</p> <p>The primary source for this confusion is the section 'virt-manager has been deprecated' from the <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.2_release_notes/deprecated_functionality#deprecated-functionality_virtualization">RHEL8 release notes virtualization deprecation section</a>. Relevant quote from the RHEL8.2 docs:</p> <blockquote> <p>The Virtual Machine Manager application, also known as virt-manager, has been deprecated. The RHEL 8 web console, also known as Cockpit, is intended to become its replacement in a subsequent release.</p> </blockquote> <p>What that means:</p> <ul> <li>virt-manager is in RHEL8 and will be there for the lifetime of RHEL8.</li> <li>Red Hat engineering effort assigned to the virt-manager UI has been reduced compared to previous RHEL versions.</li> <li>The tentative plan is to not ship the virt-manager UI in RHEL9.</li> </ul> <p>Why is this happening? As I understand it, RHEL wants to roughly standardize on Cockpit as their host admin UI tool. It's a great project with great engineers and great UI designers. Red Hat is going all in on it for RHEL and aims to replace the mismash of system-config-X tools and project specific admin frontends (like virt-manager) with a unified project. (Please note: this is my paraphrased understanding, I'm not speaking on behalf of Red Hat here.)</p> <p>Notice though, this is all about RHEL. virt-manager is not deprecated upstream, or deprecated in other distros automatically just because RHEL has made this decision. The upstream virt-manager project continues on and Red Hat continues to allocate resources to maintain it.</p> <p>Also, I'm distinguishing virt-manager UI from the virt-manager project, which includes tools like <code>virt-install</code>. I fully expect <code>virt-install</code> to be shipped in RHEL9 and actively maintained (FWIW Cockpit uses it behind the scenes).</p> <p>And even if the virt-manager UI is not in RHEL9 repos, it will likely end up shipped in EPEL, so the UI will still be available for install, just through external repos.</p> <p>Overall my personal opinion is that as long as libvirt+KVM is in use on linux desktops and servers, virt-manager will be relevant. I don't expect anything to change in that area any time soon.</p>Blog moved to Pelican and GitHub Pages2019-07-30T15:30:00-04:002019-07-30T15:30:00-04:00Cole Robinsontag:blog.wikichoon.com,2019-07-30:/2019/07/blog-moved.html<p>I've moved my blog from blogger.com to a static site generated with <a href="https://blog.getpelican.com/">Pelican</a> and hosted on GitHub Pages. This is a dump of some of the details.</p> <p>The content is hosted in three branches across two repos:</p> <ul> <li><strong><a href="https://github.com/crobinso/blog/tree/gh-pages">blog/gh-pages</a></strong>: <a href="https://blog.wikichoon.com">https://blog.wikichoon.com</a> HTML content</li> <li><strong><a href="https://github.com/crobinso/crobinso.github.io/tree/master">crobinso.github.io/master …</a></strong></li></ul><p>I've moved my blog from blogger.com to a static site generated with <a href="https://blog.getpelican.com/">Pelican</a> and hosted on GitHub Pages. This is a dump of some of the details.</p> <p>The content is hosted in three branches across two repos:</p> <ul> <li><strong><a href="https://github.com/crobinso/blog/tree/gh-pages">blog/gh-pages</a></strong>: <a href="https://blog.wikichoon.com">https://blog.wikichoon.com</a> HTML content</li> <li><strong><a href="https://github.com/crobinso/crobinso.github.io/tree/master">crobinso.github.io/master</a></strong>: <a href="https://wikichoon.com">https://wikichoon.com</a> front page HTML content</li> <li><strong><a href="https://github.com/crobinso/crobinso.github.io/tree/pelican">crobinso.github.io/pelican</a></strong>: website source content and theme</li> </ul> <p>The motivation for the split is that according to this <a href="https://blog.kmonsoor.com/pelican-how-to-make-seo-friendly/">pelican SEO</a> article, <strong>master</strong> branches of GitHub repos are indexed by google, so if you store HTML content in a <strong>master</strong> branch your canonical blog might be battling your GitHub repo in the search results. And since you can only put content in the <strong>master</strong> branch of a <code>$username.github.io</code> repo, I added a separate blog.git repo. Maybe I could shove all the content into the <strong>blog/gh-pages</strong> branch I think dealing with multiple subdomains prevents it. I've already spent too much timing playing with all this stuff though so that's for another day to figure out. Of course, suggestions welcome, blog comments are enabled with Disqus.</p> <p>One issue I hit is that pushing updated content to <strong>blog/gh-pages</strong> doesn't consistently trigger a new GitHub Pages deployment. There's a bunch of hits about this around the web (this <a href="https://stackoverflow.com/questions/20422279/github-pages-are-not-updating">stackoverflow post</a> in particular) but no authoritative explanation about what criteria GitHub Pages uses to determine whether to redeploy. The simplest 'fix' I found is to tweak the <code>index.html</code> content via the GitHub web UI and commit the change which seems to consistently trigger a refresh as reported by the repo's <a href="https://github.com/crobinso/blog/deployments">deployments page</a>.</p> <p>You may notice the blog looks a lot like stock <a href="https://jekyllrb.com/">Jekyll</a> with its <a href="https://github.com/jekyll/minima">minima</a> theme. I didn't find any Pelican theme that I liked as much as minima, so I grabbed the CSS from a minima instance and started adapting the Pelican <a href="https://github.com/getpelican/pelican-themes/tree/master/simple-bootstrap">simple-bootstrap</a> theme to use it. The end result is basically a simple reimplementation of minima for Pelican. I learned a lot in the process but it likely would have been much simpler if I just used Jekyll in the first place, but I'm in too deep to switch now!</p>Host 'Network Interfaces' panel removed from virt-manager2019-04-09T14:01:00-04:002019-04-09T14:01:00-04:00Cole Robinsontag:blog.wikichoon.com,2019-04-09:/2019/04/host-network-interfaces-panel-removed.html<p>I released <a href="https://www.redhat.com/archives/virt-tools-list/2018-October/msg00087.html">virt-manager 2.0.0</a> in October 2018. Since the release contained the full port to python3, it seemed like a good opportunity to drop some baggage from the app.</p> <p>The biggest piece we removed was the UI for managing host network interfaces. This is the <strong>Connection Details-&gt;Network …</strong></p><p>I released <a href="https://www.redhat.com/archives/virt-tools-list/2018-October/msg00087.html">virt-manager 2.0.0</a> in October 2018. Since the release contained the full port to python3, it seemed like a good opportunity to drop some baggage from the app.</p> <p>The biggest piece we removed was the UI for managing host network interfaces. This is the <strong>Connection Details-&gt;Network Interfaces</strong> panel, and the <strong>New Interface</strong> wizard for defining host network definitions for things like bridges, bonds, and vlan devices. The main screen of the old UI looked like this:</p> <p><img alt="virt-manager host interfaces panel" height="280" src="https://blog.wikichoon.com/images/074-host-network-interfaces-panel-removed-1.png" width="400"></p> <h4>Some history</h4> <p>Behind the scenes, this UI was using libvirt's Interface APIs, which also power the <code>virsh iface-*</code> commands. These APIs are little more than a wrapper around the <a href="https://pagure.io/netcf">netcf</a> library.</p> <p>netcf aimed to be a linux distro independent API for network device configuration. On Red Hat distros this meant turning the API's XML format into an <code>/etc/sysconfig/network</code> script. There were even pie-in-the-sky ideas about NetworkManager one day using netcf.</p> <p>In practice though the library never really took off. It was years before a debian backend showed up, contributed by a Red Hatter in the hope of increasing library uptake, though it didn't seem to help. netcf basically only existed to serve the libvirt Interface APIs, yet those APIs were never really used by any major libvirt consuming app, besides virt-manager. And in virt-manager's case it was largely just slapping some UI over the XML format and lifecycle operations.</p> <p>For virt-manager's usecases we hoped that netcf would make it trivial to bridge the host's network interface, which when used with VMs would give them first class IP addresses on the host network setup, not NAT like the 'default' virtual network. Unfortunately though the UI would create the ifcfg files well enough, behind the scenes nothing played well with NetworkManager for years and years. The standard suggestion for was to disable NetworkManager if you wanted to bridge your host NIC. Not very user friendly. Some people did manage to use the UI to that effect but it was never a trivial process.</p> <h4>The state today</h4> <p>Nowadays NetworkManager can handle bridging natively and is much more powerful than what virt-manager/libvirt/netcf provide. The virt-manager UI was more likely to shoot you in the foot than make things simple. And it had become increasingly clear that virt-manager was not the place to maintain host network config UI.</p> <p>So we made the decision to drop all this from virt-manager in 2.0.0. netcf and the libvirt interface APIs still exist. If you're interested in some more history on the interface API/netcf difficulties, check out <a href="https://www.redhat.com/archives/virt-tools-list/2018-October/msg00049.html">Laine's email</a> to virt-tools-list.</p>python-bugzilla + bugzilla 5.0 API keys2019-01-09T17:58:00-05:002019-01-09T17:58:00-05:00Cole Robinsontag:blog.wikichoon.com,2019-01-09:/2019/01/python-bugzilla-bugzilla-50-api-keys.html<p>For many uses of <code>/usr/bin/bugzilla</code> and python-bugzilla, it's necessary to actually be logged in to a bugzilla server. Creating bugs, editing bugs, querying private data, etc.</p> <p>Up until now anyone that's used the command line tool has periodically had to do a <code>bugzilla login</code> to refresh their authentication …</p><p>For many uses of <code>/usr/bin/bugzilla</code> and python-bugzilla, it's necessary to actually be logged in to a bugzilla server. Creating bugs, editing bugs, querying private data, etc.</p> <p>Up until now anyone that's used the command line tool has periodically had to do a <code>bugzilla login</code> to refresh their authentication cache. In older bugzilla versions this was an HTTP cookie, more recently it's a bugzilla API token. Generally <code>login</code> calls were needed infrequently on a single machine as tokens would remain valid for a long time.</p> <p>Recently, bugzilla.redhat.com received a big update to bugzilla 5.0. However with that update it seems like API tokens now expire after a week, which has necessitated lots more <code>bugzilla login</code> calls than I'm used to.</p> <p>Thankfully with <strong>bugzilla 5.0</strong> and later there's a better option: API keys. Here's how to to use them transparently with <code>/usr/bin/bugzilla</code> and all python-bugzilla library usage. Here's steps for enabling API keys with bugzilla.redhat.com, but the same process should roughly apply to other bugzilla instances too.</p> <ul> <li>Login to the bugzilla web UI</li> <li>Click on your email</li> <li>Select <strong>Preferences</strong></li> <li>Select <strong>API Keys</strong></li> <li>Generate an API key with an optional comment like <code>python-bugzilla</code></li> </ul> <p>Afterwards the screen will look something like this (updated in June 2020):</p> <p><img alt="Bugzilla web UI API key setup" height="384" src="https://blog.wikichoon.com/images/073-python-bugzilla-bugzilla-50-api-keys-2.png" width="640"></p> <p><code>MY-FAKE-KEY</code> is not my actual key, I replaced it for demo purposes. The actual key is a long string of characters and numbers.</p> <p>On <code>bugzilla.redhat.com</code> the key is only visible in the red box when the key is initially created; refreshing the page will only show the numeric <code>API key ID</code> which is not what you want. So if you missed copying that value the first time, revoke the key and create a new one.</p> <p>Once you've copied your key, write a bugzillarc file like this:</p> <div class="highlight"><pre><span></span><code><span class="na">$ cat ~/.config/python-bugzilla/bugzillarc</span> <span class="k">[bugzilla.redhat.com]</span> <span class="na">api_key</span><span class="o">=</span><span class="s">MY-FAKE-KEY</span> </code></pre></div> <p>That's it, <code>/usr/bin/bugzilla</code> and python-bugzilla using tools should pick it up automagically. Note, API keys are as good as passwords in certain ways, so treat it with the same secrecy you would treat a password.</p>