diff --git a/qemu-adm b/qemu-adm index 0e0c9d7..4eb879d 100755 --- a/qemu-adm +++ b/qemu-adm @@ -448,11 +448,14 @@ creeMV() genCmdIntRzo(){ # Création d'une interface non étiqueté (access) if [[ "${pont_init}" -eq 1 && "${vlan_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then - commandes_a_executer+=( "ip tuntap add ${interface} mode tap" ) - commandes_a_executer+=( "ip link set ${interface} up" ) - commandes_a_executer+=( "ip link set ${interface} master ${pont}" ) - commandes_a_executer+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" ) - commandes_a_executer+=( "bridge vlan add dev ${interface} vid ${vlan} pvid untagged master" ) + # Commandes à executer au demarrage + commandes_a_executer_on+=( "ip tuntap add ${interface} mode tap" ) + commandes_a_executer_on+=( "ip link set ${interface} up" ) + commandes_a_executer_on+=( "ip link set ${interface} master ${pont}" ) + commandes_a_executer_on+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" ) + commandes_a_executer_on+=( "bridge vlan add dev ${interface} vid ${vlan} pvid untagged master" ) + # Commandes à exectuer à l'arrêt + commandes_a_executer_off+=( "ip link del ${interface}" ) # Réinitialisation des variables témoins pont_init=0 @@ -461,13 +464,15 @@ genCmdIntRzo(){ # Création d'une interface étiqueté (trunk) elif [[ "${pont_init}" -eq 1 && "${ieee8021q_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then - commandes_a_executer+=( "ip tuntap add ${interface} mode tap" ) - commandes_a_executer+=( "ip link set ${interface} up" ) - commandes_a_executer+=( "ip link set ${interface} master ${pont}" ) - commandes_a_executer+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" ) + commandes_a_executer_on+=( "ip tuntap add ${interface} mode tap" ) + commandes_a_executer_on+=( "ip link set ${interface} up" ) + commandes_a_executer_on+=( "ip link set ${interface} master ${pont}" ) + commandes_a_executer_on+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" ) for ((id_label_vlan=0 ; "${nb_params_label}" - "${id_label_vlan}" ; id_label_vlan++)); do - commandes_a_executer+=( "bridge vlan add dev ${interface} vid ${label_vlan[${id_label_vlan}]} tagged master" ) + commandes_a_executer_on+=( "bridge vlan add dev ${interface} vid ${label_vlan[${id_label_vlan}]} tagged master" ) done + # Commandes à exectuer à l'arrêt + commandes_a_executer_off+=( "ip link del ${interface}" ) # Réinitialisation des variables témoins pont_init=0 @@ -475,7 +480,7 @@ genCmdIntRzo(){ interface_init=0 fi - echo "commandes_a_executer=${commandes_a_executer[@]}" # Debogage + echo "commandes_a_executer_on=${commandes_a_executer_on[@]}" # Debogage } # Fonction exécuté en premier. Récupère les paramètres du fichier de configuration du conteneur @@ -641,11 +646,12 @@ case ${1} in echo 1 "$#" # Debogage if [[ $# -eq 0 ]]; then echo "Demarrage de la MV..." # Debogage - #recupParams - #execCmd "${commandes_a_executer[@]}" + recupParams + execCmd "${commandes_a_executer_on[@]}" commande_qemu=$(grep -Ev '^#|^$' ${chemin_mv} | tr -d '\n' | tr -d '\\') echo "${bin_qemu} ${commande_qemu}" # Debogage ${bin_qemu} ${commande_qemu} + execCmd "${commandes_a_executer_off[@]}" fi while [[ $# -gt 0 ]]; do case "${1}" in