normalize connect URI for virsh
[build.git] / lbuild-initvm.sh
index 29d6d4b..502c8a0 100755 (executable)
@@ -574,7 +574,7 @@ function setup_lxc() {
     fi
     
     # define lxc container for libvirt
-    virsh -c lxc:// define $config_xml
+    virsh -c lxc:/// define $config_xml
 
     return 0
 }
@@ -604,7 +604,7 @@ function write_lxc_xml_test () {
       <target dir='/'/>
     </filesystem>
     <interface type="bridge">
-      <source bridge="$BRIDGE_IF"/>
+      <source bridge="$PUBLIC_BRIDGE"/>
       <target dev='$VIF_HOST'/>
     </interface>
     <console type='pty' />
@@ -612,7 +612,7 @@ function write_lxc_xml_test () {
   <network>
     <name>host-bridge</name>
     <forward mode="bridge"/>
-    <bridge name="$BRIDGE_IF"/>
+    <bridge name="$PUBLIC_BRIDGE"/>
   </network>
 </domain>
 EOF
@@ -736,7 +736,7 @@ function post_install () {
        post_install_build $lxc $personality
        lxc_start $lxc
        # manually run dhclient in guest - somehow this network won't start on its own
-       virsh lxc-enter-namespace $lxc /usr/sbin/dhclient $VIF_GUEST
+       virsh -c lxc:/// lxc-enter-namespace $lxc /usr/sbin/dhclient $VIF_GUEST
     else
        post_install_myplc $lxc $personality
        lxc_start $lxc
@@ -845,7 +845,7 @@ function lxc_start() {
 
     lxc=$1; shift
   
-    virsh -c lxc:// start $lxc
+    virsh -c lxc:/// start $lxc
   
     return 0
 }
@@ -989,8 +989,6 @@ function main () {
        NETMASK=$(masklen_to_netmask $PRIVATE_MASKLEN)
        GATEWAY=$PRIVATE_GATEWAY
        VIF_HOST="i$byte"
-       BRIDGE_MODE="nat"
-       BRIDGE_IF="$PRIVATE_BRIDGE"
     else
         [[ -z "GUEST_HOSTNAME" ]] && usage
        
@@ -1002,8 +1000,6 @@ function main () {
         NETMASK=$(masklen_to_netmask $MASKLEN)
         GATEWAY=$(ip route show | grep default | awk '{print $3}')
         VIF_HOST="i$(echo $GUEST_HOSTNAME | cut -d. -f1)"
-       BRIDGE_MODE="bridge"
-       BRIDGE_IF="PUBLIC_BRIDGE"
     fi
 
     echo "the IP address of container $lxc is $IP, host virtual interface is $VIF_HOST"
@@ -1020,7 +1016,7 @@ function main () {
     # bacause /var/lib/lxc/$lxc is already created while putting $lxc.timestamp
     [ -d $rootfs_path ] && \
        { echo "container $lxc already exists in filesystem - exiting" ; exit 1 ; }
-    virsh --connect lxc:// domuuid $lxc >& /dev/null && \
+    virsh -c lxc:/// domuuid $lxc >& /dev/null && \
        { echo "container $lxc already exists in libvirt - exiting" ; exit 1 ; }
 
     setup_lxc $lxc $fcdistro $pldistro $personality