<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tag-Based Automation: Manage VM CPU Priority via assigned tag.]]></title><description><![CDATA[<p dir="auto"><strong>WHAT</strong>: Automatically assigns CPU weights and I/O priorities based on assigned VM tag (i.e. replicating what vcenter did via resource pools etc.).</p>
<p dir="auto"><strong>HOW</strong>: Run via cron for regular enforcement.</p>
<p dir="auto"><strong>WHY</strong>: Automatically assign performance metrics on all pool VMs (as well as preventing configuration drift if settings are accidentally changed).</p>
<p dir="auto"><strong>TAGS</strong>: The Performance Tiering Concept: 4-tier system with a naming convention that sorts logically in XO:</p>
<pre><code>TAG       CPU WEIGHT  I/O PRIORITY      USE CASE
0-core    2048        7 (Highest)       Domain Controllers, DNS, DHCP, Core DBs
1-high    1024        7                 Critical App Servers
2-normal   256        4                 Standard Workloads
3-low      128        1                 Dev/Test, Noisy Neighbors
</code></pre>
<p dir="auto">Why the "0-" prefix? It forces core VMs to the top of the VM list in XO for easy visibility and management.</p>
<p dir="auto"><strong>Important:</strong> CPU weights only matter during contention. When the host is under-utilized, all VMs get the performance they need regardless of weight. These are an insurance policy.</p>
<p dir="auto">Script: <a href="http://set-performace.sh" target="_blank" rel="noopener noreferrer nofollow ugc">set-performace.sh</a></p>
<pre><code>bash
#!/bin/bash

# ============================================
# XCP-ng set-performace.sh script
# Tags: 0-core, 1-high, 2-normal, 3-low
# ============================================

# --- CONFIGURATION (Customize these for your environment) ---
CORE_TAG="0-core"
CORE_WEIGHT="2048"
CORE_IO_PRI="7"

HIGH_TAG="1-high"
HIGH_WEIGHT="1024"
HIGH_IO_PRI="7"

NORMAL_TAG="2-normal"
NORMAL_WEIGHT="256"
NORMAL_IO_PRI="4"

LOW_TAG="3-low"
LOW_WEIGHT="128"
LOW_IO_PRI="1"
LOW_QOS_KBPS="100000"  # 100Mbps cap for noisy neighbors

# --- CORE CRITICAL VMs ---
echo "=== Applying $CORE_TAG CPU &amp; I/O Priority ==="
xe vm-list tags:contains="$CORE_TAG" --minimal | tr ',' '\n' | while read uuid; do
    [ -z "$uuid" ] &amp;&amp; continue
    xe vm-param-set uuid=$uuid VCPUs-params:weight=$CORE_WEIGHT
    xe vm-param-set uuid=$uuid other-config:sched-pri=$CORE_IO_PRI
    echo "CORE CRITICAL priority applied: $uuid"
done

# --- HIGH PRIORITY VMs ---
echo "=== Applying $HIGH_TAG CPU &amp; I/O Priority ==="
xe vm-list tags:contains="$HIGH_TAG" --minimal | tr ',' '\n' | while read uuid; do
    [ -z "$uuid" ] &amp;&amp; continue
    xe vm-param-set uuid=$uuid VCPUs-params:weight=$HIGH_WEIGHT
    xe vm-param-set uuid=$uuid other-config:sched-pri=$HIGH_IO_PRI
    echo "HIGH priority applied: $uuid"
done

# --- NORMAL PRIORITY VMs ---
echo "=== Applying $NORMAL_TAG CPU &amp; I/O Priority ==="
xe vm-list tags:contains="$NORMAL_TAG" --minimal | tr ',' '\n' | while read uuid; do
    [ -z "$uuid" ] &amp;&amp; continue
    xe vm-param-set uuid=$uuid VCPUs-params:weight=$NORMAL_WEIGHT
    xe vm-param-set uuid=$uuid other-config:sched-pri=$NORMAL_IO_PRI
    echo "NORMAL priority applied: $uuid"
done

# --- LOW PRIORITY VMs (with Network QoS cap) ---
echo "=== Applying $LOW_TAG CPU &amp; I/O Priority ==="
xe vm-list tags:contains="$LOW_TAG" --minimal | tr ',' '\n' | while read uuid; do
    [ -z "$uuid" ] &amp;&amp; continue
    xe vm-param-set uuid=$uuid VCPUs-params:weight=$LOW_WEIGHT
    xe vm-param-set uuid=$uuid other-config:sched-pri=$LOW_IO_PRI
    echo "LOW priority applied: $uuid"
done

echo "=== Performance Tuning Complete! ==="
</code></pre>
<p dir="auto"><strong>How to Deploy:</strong></p>
<p dir="auto"><strong>1 Upload script</strong></p>
<pre><code>bash
# Copy to your pool master
scp set-performace.sh root@your-pool-master:/usr/local/bin/
chmod +x /usr/local/bin/set-performace.sh
</code></pre>
<p dir="auto"><strong>2 Add to crontab</strong></p>
<pre><code># Add to crontab (runs hourly)
*/60 * * * * root /usr/local/bin/set-performance.sh &gt;&gt; /var/log/set-performance.log 2&gt;&amp;1
</code></pre>
<p dir="auto"><strong>3 Test</strong></p>
<pre><code># Test it manually
/usr/local/bin/set-performace.sh
</code></pre>
]]></description><link>https://xcp-ng.org/forum/topic/12215/tag-based-automation-manage-vm-cpu-priority-via-assigned-tag.</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 05:14:05 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/12215.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 May 2026 02:48:24 GMT</pubDate><ttl>60</ttl></channel></rss>