<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>xcpblog</title>
    <link>https://xcpblog.com/</link>
    <description>Recent content on xcpblog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 08 Jul 2026 09:00:00 -0500</lastBuildDate>
    <atom:link href="https://xcpblog.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Anatomy of an XCP-ng host: Xen, dom0, XAPI, and who actually does what</title>
      <link>https://xcpblog.com/posts/anatomy-of-an-xcp-ng-host/</link>
      <pubDate>Wed, 08 Jul 2026 09:00:00 -0500</pubDate>
      <guid>https://xcpblog.com/posts/anatomy-of-an-xcp-ng-host/</guid>
      <description>Before you can troubleshoot this platform, you need the org chart: which component owns VMs, which owns storage, which owns the API — and which log file each one writes to.</description>
      <content:encoded><![CDATA[<p>Every troubleshooting session on this platform eventually comes down to one question: <em>which component owns this problem?</em> You can&rsquo;t answer that without the org chart. So here it is.</p>
<h2 id="layer-0-the-xen-hypervisor">Layer 0: the Xen hypervisor</h2>
<p>At the bottom is <strong>Xen</strong> — a bare-metal, type-1 hypervisor. It boots first (you&rsquo;ll see it in the GRUB entry: <code>xen.gz</code> loads, <em>then</em> the Linux kernel), and it owns exactly three things: CPU scheduling, memory partitioning, and interrupt routing. That&rsquo;s it. Xen deliberately contains no device drivers, no filesystem, no network stack. It is a few megabytes of code whose job is to slice hardware among <em>domains</em>.</p>
<p>A <em>domain</em> is Xen&rsquo;s word for a running VM. Which brings us to the special one.</p>
<h2 id="dom0-the-control-domain">dom0: the control domain</h2>
<p><strong>dom0</strong> is the first domain Xen boots, and it&rsquo;s privileged. It&rsquo;s a Linux system — in the 8.x generation, a CentOS 7-based distribution maintained by the XCP-ng team with backported security fixes — and it has direct access to the physical hardware. All the actual device drivers (NICs, HBAs, RAID controllers) live in dom0&rsquo;s kernel, not in Xen.</p>
<p>When you SSH to an XCP-ng host, you are in dom0. This surprises VMware people: it&rsquo;s a real Linux shell, with <code>yum</code>, systemd, and normal logs under <code>/var/log</code>. Two rules keep you out of trouble:</p>
<ol>
<li><strong>dom0 is an appliance.</strong> Don&rsquo;t install random packages, don&rsquo;t &ldquo;fix&rdquo; its config files outside documented procedures. Updates assume a known state.</li>
<li><strong>dom0 has fixed, small memory</strong> — a few GiB by default regardless of host RAM. Every guest&rsquo;s I/O flows through dom0 (more on that below), so dom0 memory pressure is a <em>platform</em> problem, not a VM problem. There are legitimate reasons to raise it on busy hosts, and it depends on you&rsquo;re pool size.</li>
</ol>
<p>Guest VMs are <strong>domUs</strong> — unprivileged domains. In the 8.x era they run in HVM mode with paravirtualized drivers (PV-on-HVM): hardware-assisted virtualization for CPU/memory, but disk and network I/O goes through the fast PV path — a shared-memory ring between the guest&rsquo;s PV driver (netfront/blkfront) and dom0&rsquo;s backend (netback/blkback or tapdisk). That&rsquo;s why guest tools matter so much: without PV drivers, the guest falls back to emulated devices via QEMU, and performance falls off a cliff.</p>
<h2 id="xapi-the-toolstack-and-the-pool">XAPI: the toolstack and the pool</h2>
<p><strong>XAPI</strong> (the XenAPI daemon, historically <code>xapi</code>) is the management brain, running in dom0 on every host. It exposes the API that everything — <code>xe</code> CLI, Xen Orchestra, your Terraform provider — talks to, over HTTPS on port 443.</p>
<p>XAPI&rsquo;s defining concept is the <strong>pool</strong>. Hosts joined into a pool share one configuration database (VMs, SRs, networks, everything), replicated from one elected host: the <strong>pool master</strong>. All API writes go through the master; other members proxy to it. This is why &ldquo;the master is down&rdquo; is a distinctive failure mode on this platform — the VMs keep running fine, but management operations stall until the master returns or you promote a new one.</p>
<p>The practical takeaways:</p>
<ul>
<li><strong>Point tooling at the pool master</strong> (or at XO, which handles it for you).</li>
<li>The pool database lives at <code>/var/lib/xcp/state.db</code> on the master. XAPI syncs it to members; pool metadata backup is a real operational task.</li>
<li><code>xe</code> is the CLI front-end to XAPI. Anything the UI can do, <code>xe</code> can do — usually with more precision.</li>
</ul>
<h2 id="the-supporting-cast-in-dom0">The supporting cast in dom0</h2>
<p>XAPI delegates. These are the daemons you&rsquo;ll meet in the logs:</p>
<ul>
<li><strong>xenopsd</strong> — the VM lifecycle manager. Start, stop, migrate, hotplug: XAPI decides <em>what</em>, xenopsd does <em>how</em>, talking to Xen. Migration failures usually leave their real story in xenopsd&rsquo;s logging.</li>
<li><strong>SM (Storage Manager)</strong> — a set of Python drivers implementing each SR type (LVM, NFS, iSCSI&hellip;). Every VDI attach, snapshot, and coalesce runs through SM, and it writes the single most valuable troubleshooting file on the platform: <code>/var/log/SMlog</code>.</li>
<li><strong>tapdisk / blktap</strong> — the datapath for VHD-based storage. Each active virtual disk gets a tapdisk process in dom0 doing the actual VHD block translation.</li>
<li><strong>squeezed</strong> — dynamic memory control (ballooning) when VMs have a memory range instead of a fixed size.</li>
<li><strong>xcp-rrdd</strong> — collects performance metrics (the RRDs behind XO&rsquo;s charts).</li>
<li><strong>networkd (xcp-networkd)</strong> — manages bridges/bonds/VLANs. XCP-ng uses Open vSwitch by default; each pool network is an OVS bridge on every host.</li>
<li><strong>message-switch, xcp-idl</strong> — internal message plumbing between the above. You mostly notice it when reading logs.</li>
</ul>
<h2 id="where-the-logs-live">Where the logs live</h2>
<p>The fastest way to look competent on this platform is to know which file to open:</p>
<table>
	<thead>
			<tr>
					<th>Symptom</th>
					<th>First file to read (in dom0)</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>API operation failed, task errored</td>
					<td><code>/var/log/xensource.log</code></td>
			</tr>
			<tr>
					<td>Storage: attach, snapshot, coalesce, SR issues</td>
					<td><code>/var/log/SMlog</code></td>
			</tr>
			<tr>
					<td>VM won&rsquo;t start / migration failure details</td>
					<td><code>/var/log/xensource.log</code> + xenopsd entries</td>
			</tr>
			<tr>
					<td>Host-level kernel or driver issues</td>
					<td><code>/var/log/kern.log</code>, <code>dmesg</code></td>
			</tr>
			<tr>
					<td>Xen hypervisor itself</td>
					<td><code>xl dmesg</code></td>
			</tr>
	</tbody>
</table>
<p>A full field guide to reading these is on the roadmap; for now, remember <code>xensource.log</code> for control-plane, <code>SMlog</code> for storage.</p>
<h2 id="how-xen-orchestra-fits">How Xen Orchestra fits</h2>
<p>Xen Orchestra is <em>not</em> installed on hosts. It&rsquo;s a Node.js application running in its own VM (or anywhere, really) that connects to each pool master&rsquo;s XAPI over HTTPS and builds a unified view across all your pools. It adds everything XAPI doesn&rsquo;t have: the web UI, scheduled backup jobs, delta backup logic, replication, RBAC, self-service, audit. Kill the XO VM and your hosts and VMs are unaffected — you&rsquo;ve lost the management dashboard and backup scheduler, not the infrastructure. That separation is one of the platform&rsquo;s best design decisions, and XO deployment options are covered in detail in <a href="/posts/xoa-vs-xo-from-sources/">their own post</a>.</p>
<h2 id="the-mental-model-compressed">The mental model, compressed</h2>
<ul>
<li><strong>Xen</strong> slices hardware. Tiny, no drivers.</li>
<li><strong>dom0</strong> is a privileged Linux VM holding the drivers and all the management daemons. Treat it as an appliance.</li>
<li><strong>XAPI</strong> is the API and the pool brain; the <strong>master</strong> holds the database.</li>
<li><strong>xenopsd</strong> runs VMs, <strong>SM/tapdisk</strong> run storage, and each writes its own log.</li>
<li><strong>XO</strong> sits outside, talking to pool masters, adding backup and orchestration.</li>
</ul>
<p>When something breaks, walk the chart: is it a Xen problem (rare), a dom0 problem (drivers, memory, disk full), a XAPI problem (API/database/master), an SM problem (storage — it&rsquo;s usually storage), or an XO problem (UI/backup layer)? Nine times out of ten, naming the owner is half the fix.</p>
<!--
Sources:
- https://docs.xcp-ng.org/project/architecture/
- https://xapi-project.github.io/
- https://wiki.xenproject.org/wiki/Xen_Project_Software_Overview
-->
]]></content:encoded>
    </item>
    <item>
      <title>About</title>
      <link>https://xcpblog.com/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://xcpblog.com/about/</guid>
      <description>&lt;p&gt;&lt;strong&gt;xcpblog&lt;/strong&gt; is a working library for the Vates virtualization stack: XCP-ng and Xen Orchestra.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m &lt;strong&gt;TMK&lt;/strong&gt;. I run a large mixed XCP-ng estate for a living — hundreds of VMs, real backups, real 2 AM problems — and this site is where the notes get written up properly.&lt;/p&gt;
&lt;h2 id=&#34;corrections&#34;&gt;Corrections&lt;/h2&gt;
&lt;p&gt;If something here is wrong or has aged out, I want to know. Errors get fixed and noted, not silently edited.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><strong>xcpblog</strong> is a working library for the Vates virtualization stack: XCP-ng and Xen Orchestra.</p>
<p>I&rsquo;m <strong>TMK</strong>. I run a large mixed XCP-ng estate for a living — hundreds of VMs, real backups, real 2 AM problems — and this site is where the notes get written up properly.</p>
<h2 id="corrections">Corrections</h2>
<p>If something here is wrong or has aged out, I want to know. Errors get fixed and noted, not silently edited.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
