Historically we have used a bare lxc:/// URI for connecting to LXC. This
is different from our practice with QEMU, UML, Parallels, Libxl, BHyve
and VirtualBox drivers, which all use a path of '/system' or '/session'
or both.
By making LXC allow '/system', we have fully standardized on the use of
either '/system' or '/session' for all the stateful drivers that run
inside libvirtd.
Support for lxc:/// is of course maintained for back-compat.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/drvlxc.html.in | 34 +++++++++++++++++-----------------
examples/lxcconvert/virt-lxc-convert | 2 +-
src/lxc/lxc_driver.c | 7 ++++---
src/lxc/lxc_process.c | 4 ++--
tools/libvirt-guests.sysconf | 2 +-
tools/virsh.pod | 2 +-
tools/virt-login-shell.c | 2 +-
7 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/docs/drvlxc.html.in b/docs/drvlxc.html.in
index 58a336ed30..44c49609d9 100644
--- a/docs/drvlxc.html.in
+++ b/docs/drvlxc.html.in
@@ -308,8 +308,8 @@ unit file specifies how systemd will start the libvirt LXC container
Description=My little container
[Service]
-ExecStart=/usr/bin/virsh -c lxc:/// start --pass-fds 3 mycontainer
-ExecStop=/usr/bin/virsh -c lxc:/// destroy mycontainer
+ExecStart=/usr/bin/virsh -c lxc:///system start --pass-fds 3 mycontainer
+ExecStop=/usr/bin/virsh -c lxc:///system destroy mycontainer
Type=oneshot
RemainAfterExit=yes
KillMode=none
@@ -621,9 +621,9 @@ The use of namespace passthrough requires libvirt >= 1.2.19
As with any libvirt virtualization driver, LXC containers can be
managed via a wide variety of libvirt based tools. At the lowest
level the <code>virsh</code> command can be used to perform many
-tasks, by passing the <code>-c lxc:///</code> argument. As an
+tasks, by passing the <code>-c lxc:///system</code> argument. As an
alternative to repeating the URI with every command, the
<code>LIBVIRT_DEFAULT_URI</code>
-environment variable can be set to <code>lxc:///</code>. The
+environment variable can be set to <code>lxc:///system</code>. The
examples that follow outline some common operations with virsh
and LXC. For further details about usage of virsh consult its
manual page.
@@ -637,7 +637,7 @@ document and loads it into libvirt, saving the configuration on disk
</p>
<pre>
-# virsh -c lxc:/// define myguest.xml
+# virsh -c lxc:///system define myguest.xml
</pre>
<h3><a id="usageView">Viewing container
configuration</a></h3>
@@ -652,7 +652,7 @@ using the <code>--inactive</code> flag
</p>
<pre>
-# virsh -c lxc:/// dumpxml myguest
+# virsh -c lxc:///system dumpxml myguest
</pre>
<h3><a id="usageStart">Starting containers</a></h3>
@@ -663,7 +663,7 @@ container from a previously defined persistent configuration
</p>
<pre>
-# virsh -c lxc:/// start myguest
+# virsh -c lxc:///system start myguest
</pre>
<p>
@@ -673,7 +673,7 @@ by libvirt, using the <code>virsh create</code> command.
</p>
<pre>
-# virsh -c lxc:/// create myguest.xml
+# virsh -c lxc:///system create myguest.xml
</pre>
@@ -689,7 +689,7 @@ to PID 1 inside the container.
</p>
<pre>
-# virsh -c lxc:/// shutdown myguest
+# virsh -c lxc:///system shutdown myguest
</pre>
<p>
@@ -698,7 +698,7 @@ request, it can be forcibly stopped using the <code>virsh
destroy</code>
</p>
<pre>
-# virsh -c lxc:/// destroy myguest
+# virsh -c lxc:///system destroy myguest
</pre>
@@ -714,7 +714,7 @@ to PID 1 inside the container.
</p>
<pre>
-# virsh -c lxc:/// reboot myguest
+# virsh -c lxc:///system reboot myguest
</pre>
<h3><a id="usageDelete">Undefining (deleting) a container
configuration</a></h3>
@@ -726,7 +726,7 @@ running, this will turn it into a "transient" guest.
</p>
<pre>
-# virsh -c lxc:/// undefine myguest
+# virsh -c lxc:///system undefine myguest
</pre>
<h3><a id="usageConnect">Connecting to a container
console</a></h3>
@@ -737,7 +737,7 @@ to the text console associated with a container.
</p>
<pre>
-# virsh -c lxc:/// console myguest
+# virsh -c lxc:///system console myguest
</pre>
<p>
@@ -749,7 +749,7 @@ as 'console0', 'console1', 'console2', etc.
</p>
<pre>
-# virsh -c lxc:/// console myguest --devname console1
+# virsh -c lxc:///system console myguest --devname console1
</pre>
<h3><a id="usageEnter">Running commands in a
container</a></h3>
@@ -761,7 +761,7 @@ and then execute an arbitrary command.
</p>
<pre>
-# virsh -c lxc:/// lxc-enter-namespace myguest -- /bin/ls -al /dev
+# virsh -c lxc:///system lxc-enter-namespace myguest -- /bin/ls -al /dev
</pre>
<h3><a id="usageTop">Monitoring container
utilization</a></h3>
@@ -773,7 +773,7 @@ host
</p>
<pre>
-# virt-top -c lxc:///
+# virt-top -c lxc:///system
</pre>
<h3><a id="usageConvert">Converting LXC container
configuration</a></h3>
@@ -784,7 +784,7 @@ most of the LXC container configuration into a domain XML fragment
</p>
<pre>
-# virsh -c lxc:/// domxml-from-native lxc-tools /var/lib/lxc/myguest/config
+# virsh -c lxc:///system domxml-from-native lxc-tools /var/lib/lxc/myguest/config
</pre>
<p>
diff --git a/examples/lxcconvert/virt-lxc-convert b/examples/lxcconvert/virt-lxc-convert
index e62172eea4..5260eb708f 100644
--- a/examples/lxcconvert/virt-lxc-convert
+++ b/examples/lxcconvert/virt-lxc-convert
@@ -123,5 +123,5 @@ if test -z "$mem_limit"; then
echo "lxc.cgroup.memory.limit_in_bytes = $memory" >>
"$conf_new"
fi
-virsh -c lxc:/// domxml-from-native lxc-tools $conf_new
+virsh -c lxc:///system domxml-from-native lxc-tools $conf_new
exit $?
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 4f600f3df7..cb481bf20a 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -164,7 +164,7 @@ static virDrvOpenStatus lxcConnectOpen(virConnectPtr conn,
if (lxc_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- if (!(conn->uri = virURIParse("lxc:///")))
+ if (!(conn->uri = virURIParse("lxc:///system")))
return VIR_DRV_OPEN_ERROR;
} else {
if (conn->uri->scheme == NULL ||
@@ -177,9 +177,10 @@ static virDrvOpenStatus lxcConnectOpen(virConnectPtr conn,
/* If path isn't '/' then they typoed, tell them correct path */
if (conn->uri->path != NULL &&
- STRNEQ(conn->uri->path, "/")) {
+ STRNEQ(conn->uri->path, "/") &&
+ STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected LXC URI path '%s', try
lxc:///"),
+ _("Unexpected LXC URI path '%s', try
lxc:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 85c7bcc321..99c41014ee 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -109,7 +109,7 @@ virLXCProcessReboot(virLXCDriverPtr driver,
virObjectRef(conn);
autodestroy = true;
} else {
- conn = virConnectOpen("lxc:///");
+ conn = virConnectOpen("lxc:///system");
/* Ignoring NULL conn which is mostly harmless here */
}
@@ -1629,7 +1629,7 @@ virLXCProcessAutostartAll(virLXCDriverPtr driver)
* to lookup the bridge associated with a virtual
* network
*/
- virConnectPtr conn = virConnectOpen("lxc:///");
+ virConnectPtr conn = virConnectOpen("lxc:///system");
/* Ignoring NULL conn which is mostly harmless here */
struct virLXCProcessAutostartData data = { driver, conn };
diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
index 4e11464d2d..669b046507 100644
--- a/tools/libvirt-guests.sysconf
+++ b/tools/libvirt-guests.sysconf
@@ -1,5 +1,5 @@
# URIs to check for running guests
-# example: URIS='default xen:///system vbox+tcp://host/system lxc:///'
+# example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
#URIS=default
# action taken on host boot
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 4d25ac5d9b..929958a953 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -266,7 +266,7 @@ connect locally as root to the daemon supervising QEMU and KVM
domains
connect locally as a normal user to his own set of QEMU and KVM domains
-=item lxc:///
+=item lxc:///system
connect to a local linux container
diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c
index 016e2b6d4e..b68c393026 100644
--- a/tools/virt-login-shell.c
+++ b/tools/virt-login-shell.c
@@ -253,7 +253,7 @@ main(int argc, char **argv)
if (virConfGetValueBool(conf, "auto_shell", &autoshell) < 0)
goto cleanup;
- conn = virConnectOpen("lxc:///");
+ conn = virConnectOpen("lxc:///system");
if (!conn)
goto cleanup;
--
2.14.3