From 5e07d7ac8435ff80f999e833f422ff40535e1b24 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 8 Feb 2013 15:12:10 +0100 Subject: [PATCH 1/2] feature #1761: split xen drivers in version 3 and 4 --- install.sh | 26 ++++++++-- .../{vmm_exec_xen.conf => vmm_exec_xen3.conf} | 0 src/vmm_mad/exec/vmm_exec_xen4.conf | 33 +++++++++++++ src/vmm_mad/remotes/poll_xen_kvm.rb | 2 +- src/vmm_mad/remotes/xen/{ => xen3}/xenrc | 0 src/vmm_mad/remotes/xen/xen4/xenrc | 48 +++++++++++++++++++ 6 files changed, 103 insertions(+), 6 deletions(-) rename src/vmm_mad/exec/{vmm_exec_xen.conf => vmm_exec_xen3.conf} (100%) create mode 100644 src/vmm_mad/exec/vmm_exec_xen4.conf rename src/vmm_mad/remotes/xen/{ => xen3}/xenrc (100%) create mode 100644 src/vmm_mad/remotes/xen/xen4/xenrc diff --git a/install.sh b/install.sh index 44d3e4cd5b..f1ab3a879e 100755 --- a/install.sh +++ b/install.sh @@ -219,7 +219,8 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/im/ganglia.d \ $VAR_LOCATION/remotes/vmm \ $VAR_LOCATION/remotes/vmm/kvm \ - $VAR_LOCATION/remotes/vmm/xen \ + $VAR_LOCATION/remotes/vmm/xen3 \ + $VAR_LOCATION/remotes/vmm/xen4 \ $VAR_LOCATION/remotes/vmm/vmware \ $VAR_LOCATION/remotes/vnm \ $VAR_LOCATION/remotes/vnm/802.1Q \ @@ -429,7 +430,8 @@ INSTALL_FILES=( AUTH_DUMMY_FILES:$VAR_LOCATION/remotes/auth/dummy AUTH_PLAIN_FILES:$VAR_LOCATION/remotes/auth/plain VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm - VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen + VMM_EXEC_XEN3_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen3 + VMM_EXEC_XEN4_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen4 VMM_EXEC_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/vmm/vmware TM_FILES:$VAR_LOCATION/remotes/tm TM_SHARED_FILES:$VAR_LOCATION/remotes/tm/shared @@ -752,9 +754,9 @@ VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ # VMM SH Driver Xen scripts, to be installed under $REMOTES_LOCATION/vmm/xen #------------------------------------------------------------------------------- -VMM_EXEC_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ +VMM_EXEC_XEN3_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ src/vmm_mad/remotes/xen/deploy \ - src/vmm_mad/remotes/xen/xenrc \ + src/vmm_mad/remotes/xen/xen3/xenrc \ src/vmm_mad/remotes/xen/migrate \ src/vmm_mad/remotes/xen/restore \ src/vmm_mad/remotes/xen/reboot \ @@ -766,6 +768,19 @@ VMM_EXEC_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ src/vmm_mad/remotes/xen/detach_disk \ src/vmm_mad/remotes/xen/shutdown" +VMM_EXEC_XEN4_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ + src/vmm_mad/remotes/xen/deploy \ + src/vmm_mad/remotes/xen/xen4/xenrc \ + src/vmm_mad/remotes/xen/migrate \ + src/vmm_mad/remotes/xen/restore \ + src/vmm_mad/remotes/xen/reboot \ + src/vmm_mad/remotes/xen/reset \ + src/vmm_mad/remotes/xen/save \ + src/vmm_mad/remotes/xen/poll \ + src/vmm_mad/remotes/xen/poll_ganglia \ + src/vmm_mad/remotes/xen/attach_disk \ + src/vmm_mad/remotes/xen/detach_disk \ + src/vmm_mad/remotes/xen/shutdown" #------------------------------------------------------------------------------- # VMM Driver VMWARE scripts, to be installed under $REMOTES_LOCATION/vmm/vmware #------------------------------------------------------------------------------- @@ -1048,7 +1063,8 @@ VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \ VMM_EXEC_ETC_FILES="src/vmm_mad/exec/vmm_execrc \ src/vmm_mad/exec/vmm_exec_kvm.conf \ - src/vmm_mad/exec/vmm_exec_xen.conf \ + src/vmm_mad/exec/vmm_exec_xen3.conf \ + src/vmm_mad/exec/vmm_exec_xen4.conf \ src/vmm_mad/exec/vmm_exec_vmware.conf" #------------------------------------------------------------------------------- diff --git a/src/vmm_mad/exec/vmm_exec_xen.conf b/src/vmm_mad/exec/vmm_exec_xen3.conf similarity index 100% rename from src/vmm_mad/exec/vmm_exec_xen.conf rename to src/vmm_mad/exec/vmm_exec_xen3.conf diff --git a/src/vmm_mad/exec/vmm_exec_xen4.conf b/src/vmm_mad/exec/vmm_exec_xen4.conf new file mode 100644 index 0000000000..480280d40f --- /dev/null +++ b/src/vmm_mad/exec/vmm_exec_xen4.conf @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------- # +# 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. # +#--------------------------------------------------------------------------- # + +# Default configuration attributes for the Xen driver +# (all domains will use these values as defaults). These values can +# be overridden in each VM template. Valid atributes are: +# - credit +# - os [kernel,initrd,root,kernel_cmd] +# - vcpu +# - disk[driver] +# - nic[model] +# - raw + +#VCPU = 1 +#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ] + +CREDIT = 256 +DISK = [ driver = "tap2:tapdisk:aio:" ] + +#RAW = "data=\"on_crash=destroy\"" diff --git a/src/vmm_mad/remotes/poll_xen_kvm.rb b/src/vmm_mad/remotes/poll_xen_kvm.rb index 7b1fc0f6a4..20f5f70c0f 100755 --- a/src/vmm_mad/remotes/poll_xen_kvm.rb +++ b/src/vmm_mad/remotes/poll_xen_kvm.rb @@ -271,7 +271,7 @@ def select_hypervisor case $0 when %r{/vmm\/kvm/} hypervisor=KVM - when %r{/vmm\/xen/} + when %r{/vmm\/xen\d?/} hypervisor=XEN end end diff --git a/src/vmm_mad/remotes/xen/xenrc b/src/vmm_mad/remotes/xen/xen3/xenrc similarity index 100% rename from src/vmm_mad/remotes/xen/xenrc rename to src/vmm_mad/remotes/xen/xen3/xenrc diff --git a/src/vmm_mad/remotes/xen/xen4/xenrc b/src/vmm_mad/remotes/xen/xen4/xenrc new file mode 100644 index 0000000000..ac47d2bbf9 --- /dev/null +++ b/src/vmm_mad/remotes/xen/xen4/xenrc @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------- # +# 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. # +#--------------------------------------------------------------------------- # + +export LANG=C + +export XM_PATH="/usr/sbin/xm" +export XM_CANCEL="sudo $XM_PATH destroy" +export XM_CREATE="sudo $XM_PATH create" +export XM_CREDITS="sudo $XM_PATH sched-cred" +export XM_MIGRATE="sudo $XM_PATH migrate -l" +export XM_SAVE="sudo $XM_PATH save" +export XM_REBOOT="sudo $XM_PATH reboot" +export XM_RESET="sudo $XM_PATH reset" +export XM_RESTORE="sudo $XM_PATH restore" +export XM_LIST="sudo $XM_PATH list" +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" + +# In xen 4.1 the credit scheduler command is called sched-credit, +# uncomment this line if you are using this version +export XM_CREDITS="sudo $XM_PATH sched-credit" + +# Xen 4 uses the new blktap2 and tap:aio handler is no longer supported. +# To make it work uncomment this line. This will be used as the default +# handler for disk hot plug +export IMAGE_PREFIX="tap2:tapdisk:aio" + +# Seconds to wait after shutdown until timeout +export SHUTDOWN_TIMEOUT=300 + +# Uncomment this line to force VM cancellation after shutdown timeout +#export FORCE_DESTROY=yes + From 344256c7fcac92317328f14df61ca0b815179796 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 8 Feb 2013 15:27:20 +0100 Subject: [PATCH 2/2] feature #1761: Added xen3 and xen4 vmm drivers to oned.conf --- share/etc/oned.conf | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/share/etc/oned.conf b/share/etc/oned.conf index a228fac53a..ac5e7fc92d 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -244,12 +244,23 @@ VM_MAD = [ # Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll # An example: "-l migrate,poll=poll_ganglia,save" #------------------------------------------------------------------------------- + +# Driver for Xen 3.x #VM_MAD = [ # name = "xen", # executable = "one_vmm_exec", -# arguments = "-t 15 -r 0 xen", -# default = "vmm_exec/vmm_exec_xen.conf", +# arguments = "-t 15 -r 0 xen3", +# default = "vmm_exec/vmm_exec_xen3.conf", # type = "xen" ] + +# Driver for Xen 4.x +#VM_MAD = [ +# name = "xen", +# executable = "one_vmm_exec", +# arguments = "-t 15 -r 0 xen4", +# default = "vmm_exec/vmm_exec_xen4.conf", +# type = "xen" ] + #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------