From cf7a8cc05250f1bc6af219ef00a077ca92e87ba8 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 6 Feb 2015 14:44:10 +0530 Subject: [PATCH] CLOUDSTACK-8220: Let's have a separate XenServer 6.5 resource Signed-off-by: Rohit Yadav (cherry picked from commit 06437dadf51160252724767fc219de19f96de374) Signed-off-by: Rohit Yadav --- .../discoverer/XcpServerDiscoverer.java | 3 +- .../resource/CitrixResourceBase.java | 4 +- .../resource/XenServer650Resource.java | 50 ++++++++++++++ .../{xenserver62 => }/cloud-plugin-storage | 0 scripts/vm/hypervisor/xenserver/vmops | 2 + .../vm/hypervisor/xenserver/xenserver62/patch | 6 +- .../vm/hypervisor/xenserver/xenserver65/patch | 66 +++++++++++++++++++ 7 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java rename scripts/vm/hypervisor/xenserver/{xenserver62 => }/cloud-plugin-storage (100%) create mode 100644 scripts/vm/hypervisor/xenserver/xenserver65/patch diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java index 45cdaf946a5..8cb8846ff95 100755 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java @@ -56,6 +56,7 @@ import com.cloud.hypervisor.xenserver.resource.XenServer620Resource; import com.cloud.hypervisor.xenserver.resource.XenServer620SP1Resource; import com.cloud.hypervisor.xenserver.resource.XenServerConnectionPool; import com.cloud.hypervisor.xenserver.resource.Xenserver625Resource; +import com.cloud.hypervisor.xenserver.resource.XenServer650Resource; import com.cloud.resource.Discoverer; import com.cloud.resource.DiscovererBase; import com.cloud.resource.ResourceStateAdapter; @@ -411,7 +412,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) return new XenServer610Resource(); else if (prodBrand.equals("XenServer") && prodVersion.equals("6.5.0")) - return new Xenserver625Resource(); + return new Xenserver650Resource(); else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) { if (hotfix != null && hotfix.equals(XenserverConfigs.XSHotFix62ESP1004)) { return new Xenserver625Resource(); diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index a90f99d0fc2..f20017811dc 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -1346,9 +1346,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (vmSpec.isEnableDynamicallyScaleVm() && !isDmcEnabled(conn, host)) { s_logger.warn("Host " + host.getHostname(conn) + " does not support dynamic scaling, so the vm " + vmSpec.getName() + " is not dynamically scalable"); } - vmr.memoryStaticMin = vmSpec.getMaxRam(); + vmr.memoryStaticMin = vmSpec.getMinRam(); vmr.memoryStaticMax = vmSpec.getMaxRam(); - vmr.memoryDynamicMin = vmSpec.getMaxRam();; + vmr.memoryDynamicMin = vmSpec.getMinRam();; vmr.memoryDynamicMax = vmSpec.getMaxRam(); vmr.VCPUsMax = (long) vmSpec.getCpus(); diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java new file mode 100644 index 00000000000..4fa82a80680 --- /dev/null +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServer650Resource.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package com.cloud.hypervisor.xenserver.resource; + +import com.cloud.resource.ServerResource; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +@Local(value=ServerResource.class) +public class XenServer650Resource extends Xenserver625Resource { + private static final Logger s_logger = Logger.getLogger(XenServer650Resource.class); + + public XenServer650Resource() { + super(); + } + + protected List getPatchFiles() { + List files = new ArrayList(); + String patch = "scripts/vm/hypervisor/xenserver/xenserver65/patch"; + String patchfilePath = Script.findScript("", patch); + if (patchfilePath == null) { + throw new CloudRuntimeException("Unable to find patch file " + patch); + } + File file = new File(patchfilePath); + files.add(file); + return files; + } +} diff --git a/scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage b/scripts/vm/hypervisor/xenserver/cloud-plugin-storage similarity index 100% rename from scripts/vm/hypervisor/xenserver/xenserver62/cloud-plugin-storage rename to scripts/vm/hypervisor/xenserver/cloud-plugin-storage diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index cf9d3773a9a..59ede97b7d5 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -791,6 +791,8 @@ def default_network_rules(session, args): util.pread2(['iptables', '-F', vmchain_default]) vmipset = vm_name + if len(vmipset) > 28: + vmipset = vmipset[0:27] #create ipset and add vm ips to that ip set if create_ipset_forvm(vmipset) == False: logging.debug(" failed to create ipset for rule " + str(tokens)) diff --git a/scripts/vm/hypervisor/xenserver/xenserver62/patch b/scripts/vm/hypervisor/xenserver/xenserver62/patch index 03cdfadbb27..939e97c48d0 100644 --- a/scripts/vm/hypervisor/xenserver/xenserver62/patch +++ b/scripts/vm/hypervisor/xenserver/xenserver62/patch @@ -5,9 +5,9 @@ # to you 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 @@ -34,7 +34,7 @@ ovs-vif-flows.py=..,0755,/etc/xapi.d/plugins cloudstack_plugins.conf=..,0644,/etc/xensource cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins ovstunnel=..,0755,/etc/xapi.d/plugins -cloud-plugin-storage=,0755,/etc/xapi.d/plugins +cloud-plugin-storage=..,0755,/etc/xapi.d/plugins systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso id_rsa.cloud=../../../systemvm,0600,/root/.ssh network_info.sh=..,0755,/opt/cloud/bin diff --git a/scripts/vm/hypervisor/xenserver/xenserver65/patch b/scripts/vm/hypervisor/xenserver/xenserver65/patch new file mode 100644 index 00000000000..939e97c48d0 --- /dev/null +++ b/scripts/vm/hypervisor/xenserver/xenserver65/patch @@ -0,0 +1,66 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# This file specifies the files that need +# to be transferred over to the XenServer. +# The format of this file is as follows: +# [Name of file]=[source path],[file permission],[destination path] +# [destination path] is required. +# If [file permission] is missing, 755 is assumed. +# If [source path] is missing, it looks in the same +# directory as the patch file. +# If [source path] starts with '/', then it is absolute path. +# If [source path] starts with '~', then it is path relative to management server home directory. +# If [source path] does not start with '/' or '~', then it is relative path to the location of the patch file. +vmops=..,0755,/etc/xapi.d/plugins +vmopspremium=..,0755,/etc/xapi.d/plugins +vmopsSnapshot=..,0755,/etc/xapi.d/plugins +xen-ovs-vif-flows.rules=..,0644,/etc/udev/rules.d +ovs-vif-flows.py=..,0755,/etc/xapi.d/plugins +cloudstack_plugins.conf=..,0644,/etc/xensource +cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins +ovstunnel=..,0755,/etc/xapi.d/plugins +cloud-plugin-storage=..,0755,/etc/xapi.d/plugins +systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso +id_rsa.cloud=../../../systemvm,0600,/root/.ssh +network_info.sh=..,0755,/opt/cloud/bin +setupxenserver.sh=..,0755,/opt/cloud/bin +make_migratable.sh=..,0755,/opt/cloud/bin +setup_iscsi.sh=..,0755,/opt/cloud/bin +pingtest.sh=../../..,0755,/opt/cloud/bin +router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin +cloud-setup-bonding.sh=..,0755,/opt/cloud/bin +kill_copy_process.sh=..,0755,/opt/cloud/bin +setup_heartbeat_sr.sh=..,0755,/opt/cloud/bin +setup_heartbeat_file.sh=..,0755,/opt/cloud/bin +check_heartbeat.sh=..,0755,/opt/cloud/bin +xenheartbeat.sh=..,0755,/opt/cloud/bin +launch_hb.sh=..,0755,/opt/cloud/bin +upgrade_snapshot.sh=..,0755,/opt/cloud/bin +cloud-clean-vlan.sh=..,0755,/opt/cloud/bin +cloud-prepare-upgrade.sh=..,0755,/opt/cloud/bin +swift=..,0755,/opt/cloud/bin +swiftxen=..,0755,/etc/xapi.d/plugins +s3xen=..,0755,/etc/xapi.d/plugins +add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin +ovs-pvlan=..,0755,/etc/xapi.d/plugins +ovs-pvlan-dhcp-host.sh=../../../network,0755,/opt/cloud/bin +ovs-pvlan-vm.sh=../../../network,0755,/opt/cloud/bin +ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloud/bin +ovs-get-dhcp-iface.sh=..,0755,/opt/cloud/bin +ovs-get-bridge.sh=..,0755,/opt/cloud/bin +cloudlog=..,0644,/etc/logrotate.d