]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: allow use of lxc:///system URI as preferred format
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 27 Mar 2018 13:32:07 +0000 (14:32 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 12 Apr 2018 15:52:01 +0000 (16:52 +0100)
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@redhat.com>
docs/drvlxc.html.in
examples/lxcconvert/virt-lxc-convert
src/lxc/lxc_driver.c
src/lxc/lxc_process.c
tools/libvirt-guests.sysconf
tools/virsh.pod
tools/virt-login-shell.c

index 58a336ed30dfafc36dae436f5c1a7404110f8740..44c49609d9cf9d2f616b79d3f75a13699224395e 100644 (file)
@@ -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>
index e62172eea4f6d12e272df7512999b3eb6075bca4..5260eb708f7f6de29c44f64d6e033d86d4d73461 100644 (file)
@@ -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 $?
index 9cf67b98543c2147786afdef07debbf097a915d6..f61e0b33ef60ca7d1797adf37bc14790cd1b82c0 100644 (file)
@@ -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;
         }
index 96041f2ec7b0a870f42729b658a79e5ec3e612c3..e911d88b56362c1c39c7e04e95c375070e8657a1 100644 (file)
@@ -105,7 +105,7 @@ virLXCProcessReboot(virLXCDriverPtr driver,
         virObjectRef(conn);
         autodestroy = true;
     } else {
-        conn = virConnectOpen("lxc:///");
+        conn = virConnectOpen("lxc:///system");
         /* Ignoring NULL conn which is mostly harmless here */
     }
 
@@ -1625,7 +1625,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 };
index 4e11464d2dd5675e73d83af81dbfd338da3ddf91..669b0465075848197074118f6b38bfa15c9ae4dc 100644 (file)
@@ -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
index 4d25ac5d9b2a3b2afba2fe8bf43467d90ff54064..929958a9533c03abc705332d45e9a5d7dbc9532e 100644 (file)
@@ -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
 
index 016e2b6d4e196094fa59340d34736fc93610bc5e..b68c3930268d339533e23021a33930cb2cc692e4 100644 (file)
@@ -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;