diff --git a/src/vmm_mad/remotes/xen/attach_nic b/src/vmm_mad/remotes/xen/attach_nic new file mode 100755 index 0000000000..58c7d809b6 --- /dev/null +++ b/src/vmm_mad/remotes/xen/attach_nic @@ -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" diff --git a/src/vmm_mad/remotes/xen/detach_nic b/src/vmm_mad/remotes/xen/detach_nic new file mode 100755 index 0000000000..5ae5221596 --- /dev/null +++ b/src/vmm_mad/remotes/xen/detach_nic @@ -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" diff --git a/src/vmm_mad/remotes/xen/xen3/xenrc b/src/vmm_mad/remotes/xen/xen3/xenrc index 086fac85d9..9e9dd8b175 100644 --- a/src/vmm_mad/remotes/xen/xen3/xenrc +++ b/src/vmm_mad/remotes/xen/xen3/xenrc @@ -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 diff --git a/src/vmm_mad/remotes/xen/xen4/xenrc b/src/vmm_mad/remotes/xen/xen4/xenrc index ac47d2bbf9..41395ed7ec 100644 --- a/src/vmm_mad/remotes/xen/xen4/xenrc +++ b/src/vmm_mad/remotes/xen/xen4/xenrc @@ -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