1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1691: Xen scripts for attach/detach NIC (prototype)

This commit is contained in:
Ruben S. Montero 2013-03-07 01:39:20 +01:00
parent 2f22ff8a48
commit 107279dc3e
4 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/kvmrc
source $(dirname $0)/../../scripts_common.sh
DOMAIN=$1
MAC=$2
SOURCE=$3
MODEL=$4
exec_and_log "$XM_ATTACH_NIC $DOMAIN bridge=$SOURCE mac=$MAC" \
"Could not attach NIC ($MAC) to $DOMAIN"

View File

@ -0,0 +1,28 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/kvmrc
source $(dirname $0)/../../scripts_common.sh
DOMAIN=$1
MAC=$2
ID=`$XM_NETWORK_LIST $DOMAIN | grep -i $MAC | cut -d' ' -f1`
exec_and_log "$XM_DETACH_NIC $DOMAIN $ID" \
"Could not detach NIC ($MAC) to $DOMAIN"

View File

@ -30,6 +30,9 @@ export XM_SHUTDOWN="sudo $XM_PATH shutdown"
export XM_POLL="sudo /usr/sbin/xentop -bi2"
export XM_ATTACH_DISK="sudo $XM_PATH block-attach"
export XM_DETACH_DISK="sudo $XM_PATH block-detach"
export XM_ATTACH_NIC="sudo $XM_PATH network-attach"
export XM_DETACH_NIC="sudo $XM_PATH network-detach"
export XM_NETWORK_LIST="sudo $XM_PATH network-list"
# In xen 4.1 the credit scheduler command is called sched-credit,
# uncomment this line if you are using this version

View File

@ -30,6 +30,9 @@ export XM_SHUTDOWN="sudo $XM_PATH shutdown"
export XM_POLL="sudo /usr/sbin/xentop -bi2"
export XM_ATTACH_DISK="sudo $XM_PATH block-attach"
export XM_DETACH_DISK="sudo $XM_PATH block-detach"
export XM_ATTACH_NIC="sudo $XM_PATH network-attach"
export XM_DETACH_NIC="sudo $XM_PATH network-detach"
export XM_NETWORK_LIST="sudo $XM_PATH network-list"
# In xen 4.1 the credit scheduler command is called sched-credit,
# uncomment this line if you are using this version