diff --git a/LICENSE.header b/LICENSE.header index 4eacb643179..60b675e3101 100644 --- a/LICENSE.header +++ b/LICENSE.header @@ -1,16 +1,16 @@ Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file +or more contributor license agreements. See the NOTICE file distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file +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 +with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + 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 +KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/scripts/network/domr/s2s_vpn.sh b/api/resources/META-INF/cloudstack/api-config/module.properties old mode 100755 new mode 100644 similarity index 80% rename from scripts/network/domr/s2s_vpn.sh rename to api/resources/META-INF/cloudstack/api-config/module.properties index 3ec3e260636..3b2a85d2743 --- a/scripts/network/domr/s2s_vpn.sh +++ b/api/resources/META-INF/cloudstack/api-config/module.properties @@ -1,4 +1,3 @@ -#!/bin/bash # 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 @@ -15,15 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - - - - -# @VERSION@ - -cert="/root/.ssh/id_rsa.cloud" -domr=$1 -shift -ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domr "/opt/cloud/bin/ipsectunnel.sh $*" >/dev/null - -exit $? +name=api-config +parent=core diff --git a/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml b/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml new file mode 100644 index 00000000000..2cd12663072 --- /dev/null +++ b/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml @@ -0,0 +1,32 @@ + + + + + + diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java index fa3ef6d2395..a9d9c527f40 100644 --- a/api/src/com/cloud/network/VirtualNetworkApplianceService.java +++ b/api/src/com/cloud/network/VirtualNetworkApplianceService.java @@ -69,5 +69,5 @@ public interface VirtualNetworkApplianceService { List upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd); - public static final String MinVRVersion = "4.2.0"; + public static final String MinVRVersion = "4.3.0"; } diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java index e02573d7605..51a8fdfbe38 100755 --- a/api/src/com/cloud/vm/UserVmService.java +++ b/api/src/com/cloud/vm/UserVmService.java @@ -461,4 +461,12 @@ public interface UserVmService { UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException; + /** + * Finds and returns an encrypted password for a VM. + * + * @param userVmId + * @return Base64 encoded userdata + */ + String getVmUserData(long vmId); + } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java new file mode 100644 index 00000000000..0e527149821 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java @@ -0,0 +1,81 @@ +/* + * 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 org.apache.cloudstack.api.command.admin.vm; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VMUserDataResponse; +import org.apache.log4j.Logger; + +import com.cloud.user.Account; +import com.cloud.uservm.UserVm; + +@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4") +public class GetVMUserDataCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(GetVMUserDataCmd.class); + private static final String s_name = "getvirtualmachineuserdataresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + private Long vmId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public long getId() { + return vmId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + String userData = _userVmService.getVmUserData(getId()); + VMUserDataResponse resp = new VMUserDataResponse(); + resp.setVmId(_entityMgr.findById(UserVm.class, getId()).getUuid()); + resp.setUserData(userData); + resp.setObjectName("virtualmachineuserdata"); + resp.setResponseName(getCommandName()); + this.setResponseObject(resp); + } + + @Override + public long getEntityOwnerId() { + UserVm userVm = _entityMgr.findById(UserVm.class, getId()); + if (userVm != null) { + return userVm.getAccountId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + } + + @Override + public String getCommandName() { + return s_name; + } +} diff --git a/api/src/org/apache/cloudstack/api/response/VMUserDataResponse.java b/api/src/org/apache/cloudstack/api/response/VMUserDataResponse.java new file mode 100644 index 00000000000..1b739e56442 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/response/VMUserDataResponse.java @@ -0,0 +1,44 @@ +/* + * 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 org.apache.cloudstack.api.response; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class VMUserDataResponse extends BaseResponse { + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) + @Param(description = "the ID of the virtual machine") + private String vmId; + + @SerializedName(ApiConstants.USER_DATA) + @Param(description = "Base 64 encoded VM user data") + private String userData; + + public void setUserData(String userData) { + this.userData = userData; + } + + public void setVmId(String vmId) { + this.vmId = vmId; + } + +} diff --git a/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java b/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java new file mode 100644 index 00000000000..edf5a21b673 --- /dev/null +++ b/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java @@ -0,0 +1,40 @@ +// 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 org.apache.cloudstack.config; + +import javax.ejb.Local; + +import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.Configurable; + +@Local(value = {ApiServiceConfiguration.class}) +public class ApiServiceConfiguration implements Configurable { + public static final ConfigKey ManagementHostIPAdr = new ConfigKey("Advanced", String.class, "host", "localhost", "The ip address of management server", true); + public static final ConfigKey ApiServletPath = new ConfigKey("Advanced", String.class, "api.servlet.endpoint", "http://localhost:8080/client/api?", + "API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", true); + + @Override + public String getConfigComponentName() { + return ApiServiceConfiguration.class.getSimpleName(); + } + + @Override + public ConfigKey[] getConfigKeys() { + return new ConfigKey[] {ManagementHostIPAdr, ApiServletPath}; + } + +} diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java index 60f974a5e1d..ef7539f7350 100644 --- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java +++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java @@ -66,6 +66,7 @@ import com.cloud.stack.models.CloudStackPasswordData; import com.cloud.stack.models.CloudStackResourceLimit; import com.cloud.stack.models.CloudStackResourceTag; import com.cloud.stack.models.CloudStackSecurityGroup; +import com.cloud.stack.models.CloudStackServiceOffering; import com.cloud.stack.models.CloudStackSnapshot; import com.cloud.stack.models.CloudStackTemplate; import com.cloud.stack.models.CloudStackTemplatePermission; @@ -1414,7 +1415,7 @@ public class EC2Engine extends ManagerBase { if (request.getInstanceType() != null) { instanceType = request.getInstanceType(); } - CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType); + CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType); if (svcOffering == null) { logger.info("No ServiceOffering found to be defined by name, please contact the administrator " + instanceType); throw new Exception("instanceType not found"); @@ -1609,7 +1610,7 @@ public class EC2Engine extends ManagerBase { if (request.getInstanceType() != null) { String instanceType = request.getInstanceType(); - CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType); + CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType); if (svcOffering == null) throw new Exception("instanceType not found"); CloudStackUserVm userVm = getApi().changeServiceForVirtualMachine(instanceId, svcOffering.getId()); @@ -1783,11 +1784,12 @@ public class EC2Engine extends ManagerBase { * */ - private CloudStackServiceOfferingVO getCSServiceOfferingId(String instanceType) throws Exception { + private CloudStackServiceOffering getCSServiceOfferingId(String instanceType) throws Exception { try { if (instanceType == null) instanceType = "m1.small"; // default value - return scvoDao.getSvcOfferingByName(instanceType); + List serviceOfferings = getApi().listServiceOfferings(null, null, false, null, instanceType, null, null); + return serviceOfferings.get(0); } catch (Exception e) { logger.error("Error while retrieving ServiceOffering information by name - ", e); throw new Exception("No ServiceOffering found to be defined by name"); diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index f186fbf7848..f1c166bda11 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -31,7 +31,7 @@ label.smb.password=SMB Password label.smb.domain=SMB Domain label.hypervisors=Hypervisors label.home=Home -label.sockets=Sockets +label.sockets=CPU Sockets label.root.disk.size=Root disk size label.s3.nfs.server=S3 NFS Server label.s3.nfs.path=S3 NFS Path @@ -706,6 +706,7 @@ label.lang.arabic=Arabic label.lang.brportugese=Brazilian Portugese label.lang.catalan=Catalan label.lang.chinese=Chinese (Simplified) +label.lang.dutch=Dutch (Netherlands) label.lang.english=English label.lang.french=French label.lang.german=German @@ -713,6 +714,7 @@ label.lang.italian=Italian label.lang.japanese=Japanese label.lang.korean=Korean label.lang.norwegian=Norwegian +label.lang.polish=Polish label.lang.russian=Russian label.lang.spanish=Spanish label.last.disconnected=Last Disconnected diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties index 3620047a275..31a9c93646c 100644 --- a/client/WEB-INF/classes/resources/messages_es.properties +++ b/client/WEB-INF/classes/resources/messages_es.properties @@ -22,6 +22,7 @@ error.session.expired=Su sesi\u00c3\u00b3n ha caducado. error.unresolved.internet.name=El nombre de Internet no se puede resolver. extractable=extra\u00c3\u00adble force.delete.domain.warning=Advertencia\: Si elige esta opci\u00c3\u00b3n, la supresi\u00c3\u00b3n de todos los dominios secundarios y todas las cuentas asociadas y sus recursos. +<<<<<<< HEAD force.delete=Fuerza Borrar force.remove=Fuerza Retire force.remove.host.warning=Advertencia\: Si elige esta opci\u00c3\u00b3n, CloudStack para detener la fuerza todas las m\u00c3\u00a1quinas virtuales en ejecuci\u00c3\u00b3n antes de retirar este host del cl\u00c3\u00baster. @@ -31,25 +32,38 @@ ICMP.code=ICMP C\u00c3\u00b3digo ICMP.type=Tipo ICMP image.directory=Directorio de la imagen inline=en l\u00c3\u00adnea +======= +force.delete=Forzar el borrado +force.remove=Forzar el retiro +force.remove.host.warning=Advertencia\: Si elige esta opci\u00f3n, CloudStack para detener la fuerza todas las m\u00e1quinas virtuales en ejecuci\u00f3n antes de retirar este host del cl\u00faster. +force.stop=Forzar la detenci\u00f3n +force.stop.instance.warning=Advertencia\: Forzar la dertenci\u00f3n de esta instancia deber\u00ed\u00ada ser su \u00faltima opci\u00f3n. Puede conducir a la p\u00e9rdida de datos, as\u00ed\u00ad como un comportamiento incoherente del Estado de la m\u00e1quina virtual. +ICMP.code=C\u00f3digo ICMP +ICMP.type=Tipo ICMP +image.directory=Directorio de im\u00e1genes +inline=alineado +label.about=Acerca de +label.about.app=Acerca de CloudStack +>>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.account=Cuenta label.account.id=ID de la cuenta -label.account.name=Nombre de la cuenta +label.account.name=Nombre de cuenta label.accounts=Cuentas label.account.specific=espec\u00c3\u00adficas de la cuenta -label.acquire.new.ip=adquirir nuevas IP +label.acquire.new.ip=Adquirir nueva IP label.action.attach.disk=Conecte el disco -label.action.attach.disk.processing=disco Fijaci\u00c3\u00b3n .... -label.action.attach.iso=Adjuntar ISO -label.action.attach.iso.processing=Colocaci\u00c3\u00b3n de la norma ISO .... -label.action.cancel.maintenance.mode=Cancelar modo de mantenimiento -label.action.cancel.maintenance.mode.processing=Cancelaci\u00c3\u00b3n del modo de mantenimiento .... -label.action.change.password=Cambiar contrase\u00c3\u00b1a -label.action.change.service=Cambio de Servicio -label.action.change.service.processing=Cambio de servicio .... -label.action.copy.ISO=Copia de la ISO -label.action.copy.ISO.processing=hacer frente ISO .... -label.action.copy.template=Copia de plantilla -label.action.copy.template.processing=hacer frente plantilla .... +label.action.attach.disk.processing=Conectando el disco.... +label.action.attach.iso=Conectar ISO +label.action.attach.iso.processing=Conectando el ISO.... +label.action.cancel.maintenance.mode=Cancelar el modo de mantenimiento +label.action.cancel.maintenance.mode.processing=Cancelando el modo de mantenimiento.... +label.action.change.password=Cambiar la contrase\u00f1a +label.action.change.service=Cambiar el Servicio +label.action.change.service.processing=Cambiando el servicio.... +label.action.copy.ISO=Copiar ISO +label.action.copy.ISO.processing=Copiando ISO .... +label.action.copy.template=Copiear la plantilla +label.action.copy.template.processing=Copiando la plantilla .... label.action.create.template=Crear plantilla label.action.create.template.from.vm=Crear plantilla de VM label.action.create.template.from.volume=Crear plantilla de volumen @@ -250,6 +264,9 @@ label.alert=Alerta label.algorithm=Algoritmo label.allocated=Asignados label.api.key=clave de API +label.app.name=CloudStack +label.archive.alerts=Archivar alertas +label.archive.events=Archivar sucesos label.assign=Asignar label.assign.to.load.balancer=instancia de Asignaci\u00c3\u00b3n de equilibrador de carga label.associated.network.id=ID de red asociados @@ -263,9 +280,13 @@ label.basic.mode=Modo b\u00c3\u00a1sico label.bootable=arranque label.broadcast.domain.type=Tipo de dominio de difusi\u00c3\u00b3n label.by.account=Por Cuenta +label.by.alert.type=Por tipo de alerta label.by.availability=Por Disponibilidad +label.by.date.end=Por fecha (finalizaci\u00f3n) +label.by.date.start=Por fecha (inicio) label.by.domain=Por dominio label.by.end.date=Por Fecha de finalizaci\u00c3\u00b3n +label.by.event.type=Por tipo de suceso label.by.level=por Nivel label.by.pod=Por Pod label.by.role=por funci\u00c3\u00b3n @@ -300,6 +321,7 @@ label.cpu=CPU label.cpu.utilized=CPU Utilizado label.created=creaci\u00c3\u00b3n label.cross.zones=Cruz Zonas +label.custom.disk.iops=IOPS personalizadas label.custom.disk.size=Personal Disk Size label.daily=diario label.data.disk.offering=Datos Disco Offering @@ -307,7 +329,9 @@ label.date=Fecha label.day.of.month=D\u00c3\u00ada del mes label.day.of.week=d\u00c3\u00ada de la semana label.default.use=Usar por defecto +label.delete.alerts=Eliminar alertas label.delete=Eliminar +label.delete.events=Eliminar sucesos label.deleting.failed=No se pudo eliminar label.deleting.processing=Eliminar .... label.description=Descripci\u00c3\u00b3n @@ -319,6 +343,9 @@ label.DHCP.server.type=Tipo de servidor DHCP label.disabled=personas de movilidad reducida label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso label.disk.allocated=disco asignado +label.disk.iops.max=IOPS m\u00e1ximas +label.disk.iops.min=IOPS m\u00ednimas +label.disk.iops.total=Total de IOPS label.disk.offering=disco Ofrenda label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB) label.disk.size=tama\u00c3\u00b1o de disco @@ -335,6 +362,7 @@ label.domain.suffix=DNS sufijo de dominio (es decir, xyz.com) label.double.quotes.are.not.allowed=comillas dobles no se permite label.download.progress=Progreso de la descarga label.edit=Editar +label.egress.default.policy=Directiva de salida predeterminada label.email=correo electr\u00c3\u00b3nico label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN @@ -374,6 +402,8 @@ label.host.name=nombre de host label.hosts=Ej\u00c3\u00a9rcitos label.hourly=por hora label.hypervisor=Hypervisor +label.hypervisors=Hipervisores +label.hypervisor.snapshot.reserve=Reserva de instant\u00e1neas de hipervisores label.hypervisor.type=Tipo Hypervisor label.id=ID label.info=Informaci\u00c3\u00b3n @@ -576,7 +606,10 @@ label.resource=Recursos label.resources=Recursos label.role=Papel label.root.disk.offering=Root Disco Offering +label.routing=Enrutamiento label.running.vms=Ejecuci\u00c3\u00b3n de m\u00c3\u00a1quinas virtuales +label.s3.nfs.path=Ruta NFS S3 +label.s3.nfs.server=Servidor NFS S3 label.s3.secret_key=clave secreta label.saturday=s\u00c3\u00a1bado label.save=Guardar @@ -594,6 +627,7 @@ label.select.a.zone=Seleccione una zona. label.sent=Enviados label.server=Servidor label.service.offering=Oferta de Servicio +label.service.state=Estado del servicio label.session.expired=Session Caducado label.shared=compartidas label.SharedMountPoint=SharedMountPoint @@ -605,6 +639,7 @@ label.snapshot.name=Nombre de instant\u00c3\u00a1neas label.snapshot.schedule=Lista de instant\u00c3\u00a1neas label.snapshot.s=Instant\u00c3\u00a1nea (s) label.snapshots=instant\u00c3\u00a1neas +label.sockets=Sockets label.source.nat=NAT Fuente label.specify.vlan=Especifique VLAN label.specify.vxlan=Especifique VXLAN @@ -636,6 +671,7 @@ label.submit=Enviar label.submitted.by=[Enviado por\: ] label.succeeded=Sucesor label.sunday=domingo +label.switch.type=Cambiar el tipo label.system.capacity=Capacidad de todo el sistema label.system.vm=Sistema de VM label.system.vms=Sistema de m\u00c3\u00a1quinas virtuales @@ -680,6 +716,7 @@ label.vcenter.host=vCenter anfitri\u00c3\u00b3n label.vcenter.password=vCenter Contrase\u00c3\u00b1a label.vcenter.username=vCenter Nombre de usuario label.version=Versi\u00c3\u00b3n +label.view.secondary.ips=Ver las IP secundarias label.virtual.appliances=Virtual Appliances label.virtual.appliance=Virtual Appliance label.virtual.machines=Maquinas virtuales @@ -854,6 +891,7 @@ message.step.4.continue=Por favor seleccione al menos una red social para contin message.step.4.desc=Por favor, seleccione la red primaria que la instancia virtual estar\u00c3\u00a1 conectado. message.update.os.preference=Por favor seleccione un sistema operativo de preferencia para este equipo. Todas las instancias virtuales con preferencias similares ser\u00c3\u00a1n los primeros asignados a este equipo antes de elegir otro. message.update.ssl=Por favor, env\u00c3\u00ade una nueva X.509 compatible con certificado SSL que se actualizar\u00c3\u00a1 a cada instancia virtual de la consola del servidor proxy\: +message.validate.invalid.characters=Se han hallado caracteres no v\u00e1lidos. Por favor, corr\u00edjalos. message.virtual.network.desc=Una red dedicada virtualizados para su cuenta. El dominio de difusi\u00c3\u00b3n est\u00c3\u00a1 contenida dentro de una VLAN y todos los acceso a la red p\u00c3\u00bablica se encamina a cabo por un router virtual. message.vm.create.template.confirm=Crear plantilla de la m\u00c3\u00a1quina virtual se reiniciar\u00c3\u00a1 autom\u00c3\u00a1ticamente. message.volume.create.template.confirm=Por favor, confirme que desea crear una plantilla para este volumen de disco. Creaci\u00c3\u00b3n de la plantilla puede oscilar entre varios minutos m\u00c3\u00a1s, dependiendo del tama\u00c3\u00b1o del volumen. diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties index db624221ddf..42335bc7b45 100644 --- a/client/WEB-INF/classes/resources/messages_fr_FR.properties +++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties @@ -641,6 +641,7 @@ label.lang.arabic=Arabe label.lang.brportugese=Portuguais Br\u00e9sil label.lang.catalan=Catalan label.lang.chinese=Chinois (simplifi\u00e9) +label.lang.dutch=N\u00e9erlandais label.lang.english=Anglais label.lang.french=Fran\u00e7ais label.lang.german=Allemand @@ -648,6 +649,7 @@ label.lang.italian=Italien label.lang.japanese=Japonais label.lang.korean=Cor\u00e9en label.lang.norwegian=Norv\u00e9gien +label.lang.polish=Polonais label.lang.russian=Russe label.lang.spanish=Espagnol label.last.disconnected=Derni\u00e8re D\u00e9connexion diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties similarity index 100% rename from client/WEB-INF/classes/resources/messages_ja.properties rename to client/WEB-INF/classes/resources/messages_ja_JP.properties diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties new file mode 100644 index 00000000000..b1bfadb42af --- /dev/null +++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties @@ -0,0 +1,1216 @@ +# 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. + +changed.item.properties=Item eigenschappen gewijzigd +confirm.enable.s3=Vul de volgende informatie in om ondersteuning voor S3-aangestuurde Secundaire Opslag te activeren +confirm.enable.swift=Vul de volgende informatie in om ondersteuning voor Swift te activeren +error.could.not.enable.zone=Kon zone niet activeren +error.installWizard.message=Er ging iets mis; je kunt teruggaan om de eventuele fouten te herstellen +error.invalid.username.password=Ongeldige gebruikersnaam of wachtwoord +error.login=Uw gebruikersnaam/wachtwoord komt niet overeen met onze gegevens +error.menu.select=Kan actie niet uitvoeren omdat geen items zijn geselecteerd +error.mgmt.server.inaccessible=The Management Server is niet toegankelijk. Probeer het later opnieuw. +error.password.not.match=De wachtwoord velden komen niet overeen +error.please.specify.physical.network.tags=Netwerk aanbiedingen zijn niet beschikbaar totdat u labels voor het fysieke netwerk specificeert. +error.session.expired=Uw sessie is verlopen +error.something.went.wrong.please.correct.the.following=Er is iets mis gegaan; Corrigeer het volgende +error.unable.to.reach.management.server=Niet in staat om de Management Server te bereiken +error.unresolved.internet.name=Uw internet naam kan niet worden omgezet. +extractable=Uitpakbaar +force.delete.domain.warning=Waarschuwing\: Wanneer u deze optie selecteert zullen alle onderliggende domeinen, hun gekoppelde accounts en hun verbruik worden verwijderd. +force.delete=Geforceerd verwijderen +force.remove=Geforceerd loskoppelen +force.remove.host.warning=Waarschuwing\: Wanneer u deze optie selecteert zal CloudStack alle draaiende virtuele machines geforceerd stoppen voordat de host van het cluster wordt verwijderd. +force.stop=Geforceerd stoppen +force.stop.instance.warning=Waarschuwing\: Een instantie geforceerd stoppen zou uw laatste optie moeten zijn. Het kan leiden tot dataverlies en inconsistent gedrag van de staat van de virtuele machine. +ICMP.code=ICMP Code +ICMP.type=ICMP Type +image.directory=Afbeelding Directory +inline=Inline +instances.actions.reboot.label=Herstart instantie +label.accept.project.invitation=Accepteer project uitnodiging +label.account=Account +label.account.and.security.group=Account, Security group +label.account.id=Account ID +label.account.name=Account Naam +label.accounts=Accounts +label.account.specific=Account-specifiek +label.acquire.new.ip=Bemachtig nieuw IP +label.action.attach.disk.processing=Schijf wordt toegevoegd.... +label.action.attach.disk=Schijf toevoegen +label.action.attach.iso=ISO toevoegen +label.action.attach.iso.processing=ISO wordt toegevoegd.... +label.action.cancel.maintenance.mode=Annuleer Onderhoudsmodus +label.action.cancel.maintenance.mode.processing=Onderhoudsmodus wordt geannuleerd.... +label.action.change.password=Wijzig Wachtwoord +label.action.change.service.processing=Service wordt gewijzigd.... +label.action.change.service=Wijzig Service +label.action.copy.ISO=Kopieer ISO +label.action.copy.ISO.processing=Kopi\u00ebren ISO.... +label.action.copy.template=Kopieer Template +label.action.copy.template.processing=Bezig met kopi\u00ebren Template.... +label.action.create.template=Cre\u00eber Template +label.action.create.template.from.vm=Cre\u00eber Template vanaf VM +label.action.create.template.from.volume=Cre\u00eber Template van Volume +label.action.create.template.processing=Bezig met aanmaken Template.... +label.action.create.vm=Cre\u00eber VM +label.action.create.vm.processing=Bezig met aanmaken VM.... +label.action.create.volume=Cre\u00eber Volume +label.action.create.volume.processing=Bezig met cre\u00ebren volume.... +label.action.delete.account.processing=Bezig met verwijderen account.... +label.action.delete.account=Verwijder account +label.action.delete.cluster.processing=Bezig met verwijderen van Cluster.... +label.action.delete.cluster=Verwijder Cluster +label.action.delete.disk.offering.processing=Bezig met verwijderen van Schijf Aanbieding.... +label.action.delete.disk.offering=Verwijder Schijf Aanbieding +label.action.delete.domain.processing=Bezig met verwijderen van Domein.... +label.action.delete.domain=Verwijder Domein +label.action.delete.firewall.processing=Bezig met verwijderen van Firewall.... +label.action.delete.firewall=Verwijder firewall regel +label.action.delete.ingress.rule.processing=Bezig met verwijderen van Inkomende Regel.... +label.action.delete.ingress.rule=Verwijder Inkomende Regel +label.action.delete.IP.range.processing=Bezig met verwijderen van IP Range.... +label.action.delete.IP.range=Verwijder IP Range +label.action.delete.ISO.processing=Bezig met verwijderen van ISO.... +label.action.delete.ISO=Verwijder ISO +label.action.delete.load.balancer.processing=Bezig met verwijderen van Load Balancer.... +label.action.delete.load.balancer=Verwijder load balancer regel +label.action.delete.network.processing=Bezig met verwijderen van Netwerk.... +label.action.delete.network=Verwijder Netwerk +label.action.delete.nexusVswitch=Verwijder Nexus 1000v +label.action.delete.physical.network=Verwijder fysiek netwerk +label.action.delete.pod.processing=Bezig met verwijderen van Pod.... +label.action.delete.pod=Verwijder Pod +label.action.delete.primary.storage.processing=Bezig met verwijderen van Primaire Opslag.... +label.action.delete.primary.storage=Verwijder Primaire Opslag +label.action.delete.secondary.storage.processing=Bezig met verwijderen van Secundaire Opslag.... +label.action.delete.secondary.storage=Verwijder Secundaire Opslag +label.action.delete.security.group.processing=Bezig met verwijderen van Security Group.... +label.action.delete.security.group=Verwijder Security Group +label.action.delete.service.offering.processing=Bezig met verwijderen van Service Aanbieding.... +label.action.delete.service.offering=Verwijder Service Aanbieding +label.action.delete.snapshot.processing=Bezig met verwijderen van Snapshot.... +label.action.delete.snapshot=Verwijder Snapshot +label.action.delete.system.service.offering=Verwijder Systeem Service Aanbieding +label.action.delete.template.processing=Bezig met verwijderen van Template.... +label.action.delete.template=Verwijder Template +label.action.delete.user.processing=Bezig met verwijderen Gebruiker.... +label.action.delete.user=Verwijder Gebruiker +label.action.delete.volume.processing=Bezig met verwijderen van Volume.... +label.action.delete.volume=Verwijder Volume +label.action.delete.zone.processing=Bezig met verwijderen van Zone.... +label.action.delete.zone=Verwijder Zone +label.action.destroy.instance.processing=Bezig met vernietigen van Instantie.... +label.action.destroy.instance=Verwijder Instantie +label.action.destroy.systemvm.processing=Bezig met vernietigen van Systeem VM.... +label.action.destroy.systemvm=Vernietig Systeem VM +label.action.detach.disk=Ontkoppel Schijf +label.action.detach.disk.processing=Bezig met ontkoppelen van Schijf.... +label.action.detach.iso=Ontkoppel ISO +label.action.detach.iso.processing=Bezig met ontkoppelen van ISO.... +label.action.disable.account=Deactiveer account +label.action.disable.account.processing=Bezig met deactiveren van account.... +label.action.disable.cluster=Deactiveer Cluster +label.action.disable.cluster.processing=Bezig met deactiveren van Cluster.... +label.action.disable.nexusVswitch=Deactiveer Nexus 1000v +label.action.disable.physical.network=Deactiveer fysiek netwerk +label.action.disable.pod=Deactiveer Pod +label.action.disable.pod.processing=Bezig met deactiveren van Pod.... +label.action.disable.static.NAT=Deactiveer Static NAT +label.action.disable.static.NAT.processing=Bezig met deactiveren van Static NAT.... +label.action.disable.user=Deactiveer Gebruiker +label.action.disable.user.processing=Bezig met deactiveren van Gebruiker.... +label.action.disable.zone=Deactiveer Zone +label.action.disable.zone.processing=Bezig met deactiveren van Zone.... +label.action.download.ISO=Download ISO +label.action.download.template=Download Template +label.action.download.volume=Download Volume +label.action.download.volume.processing=Bezig met downloaden van Volume.... +label.action.edit.account=Wijzig account +label.action.edit.disk.offering=Wijzig schijf aanbieding +label.action.edit.domain=Wijzig Domein +label.action.edit.global.setting=Wijzig Algemene Instellingen +label.action.edit.host=Wijzig Host +label.action.edit.instance=Wijzig Instantie +label.action.edit.ISO=Wijzig ISO +label.action.edit.network.offering=Wijzig Netwerk Aanbieding +label.action.edit.network.processing=Bezig met wijzigen van Netwerk... +label.action.edit.network=Wijzig Netwerk +label.action.edit.pod=Wijzig Pod +label.action.edit.primary.storage=Wijzig Primaire Opslag +label.action.edit.resource.limits=Wijzig verbruikslimieten +label.action.edit.service.offering=Wijzig Service Aanbieding +label.action.edit.template=Wijzig Template +label.action.edit.user=Wijzig Gebruiker +label.action.edit.zone=Wijzig Zone +label.action.enable.account=Activeer account +label.action.enable.account.processing=Bezig met activeren van account.... +label.action.enable.cluster=Activeer Cluster +label.action.enable.cluster.processing=Bezig met activeren van Cluster.... +label.action.enable.maintenance.mode=Activeer onderhoudsmodus +label.action.enable.maintenance.mode.processing=Bezig met activeren van Onderhoudsmodus +label.action.enable.nexusVswitch=Activeer Nexus 1000v +label.action.enable.physical.network=Activeer fysiek netwerk +label.action.enable.pod=Activeer Pod +label.action.enable.pod.processing=Bezig met activeren van Pod.... +label.action.enable.static.NAT=Activeer Static NAT +label.action.enable.static.NAT.processing=Bezig met activeren van Static NAT.... +label.action.enable.user=Activeer Gebruiker +label.action.enable.user.processing=Bezig met activeren van Gebruiker.... +label.action.enable.zone=Activeer Zone +label.action.enable.zone.processing=Bezig met activeren van Zone.... +label.action.force.reconnect=Forceer opnieuw verbinden +label.action.force.reconnect.processing=Bezig met opnieuw verbinden.... +label.action.generate.keys=Genereer Sleutels +label.action.generate.keys.processing=Bezig met generen van Sleutels.... +label.action.list.nexusVswitch=Toon Nexus 1000v +label.action.lock.account=Account op slot zetten +label.action.lock.account.processing=Bezig met account op slot zetten.... +label.action.manage.cluster=Beheer Cluster +label.action.manage.cluster.processing=Bezig met beheren van Cluster.... +label.action.migrate.instance=Migreer Instantie +label.action.migrate.instance.processing=Bezig met migreren van Instantie.... +label.action.migrate.router=MIgreer Router +label.action.migrate.router.processing=Bezig met migreren van Router.... +label.action.migrate.systemvm=Migreer Systeem VM +label.action.migrate.systemvm.processing=Bezig met migreren van Systeem VM.... +label.action.reboot.instance=Herstart Instantie +label.action.reboot.instance.processing=Bezig met herstarten van Instantie.... +label.action.reboot.router=Herstart Router +label.action.reboot.router.processing=Bezig met herstarten van Router.... +label.action.reboot.systemvm=Herstart Systeem VM +label.action.reboot.systemvm.processing=Bezig met herstarten van Systeem VM.... +label.action.recurring.snapshot=Terugkerende Snapshots +label.action.register.iso=Registreer ISO +label.action.register.template=Registreer Template +label.action.release.ip=Ontkoppel IP +label.action.release.ip.processing=Bezig met ontkoppelen van IP.... +label.action.remove.host.processing=Bezig met verwijderen van Host.... +label.action.remove.host=Verwijder Host +label.action.reset.password.processing=Bezig met resetten van wachtwoord.... +label.action.reset.password=Reset Wachtwoord +label.action.resize.volume.processing=Bezig met aanpassen van de grootte van het Volume +label.action.resize.volume=Wijzig de grootte van het volume +label.action.resource.limits=Verbruikslimieten +label.action.restore.instance=Herstel Instantie +label.action.restore.instance.processing=Bezig met herstellen van Instantie.... +label.actions=Acties +label.action.start.instance.processing=Bezig met starten van Instantie.... +label.action.start.instance=Start Instantie +label.action.start.router.processing=Start Router.... +label.action.start.router=Start Router +label.action.start.systemvm.processing=Bezig met starten van Systeem VM.... +label.action.start.systemvm=Start Systeem VM +label.action.stop.instance.processing=Bezig met stoppen van Instantie.... +label.action.stop.instance=Stop Instantie +label.action.stop.router.processing=Bezig met stoppen van Router.... +label.action.stop.router=Stop Router +label.action.stop.systemvm.processing=Bezig met stoppen van Systeem VM.... +label.action.stop.systemvm=Stop Systeem VM +label.action.take.snapshot=Neem Snapshot +label.action.take.snapshot.processing=Bezig met nemen van Snapshot.... +label.action.unmanage.cluster.processing=Bezig met uitschakelen van Clusterbeheer.... +label.action.unmanage.cluster=Schakel Clusterbeheer uit +label.action.update.OS.preference.processing=Bezig met wijzigen van OS voorkeuren.... +label.action.update.OS.preference=Wijzig OS voorkeuren +label.action.update.resource.count.processing=Bezig met updaten van verbruikslimieten.... +label.action.update.resource.count=Update Verbruikslimieten +label.action.vmsnapshot.create=Neem Snapshot van de VM +label.action.vmsnapshot.delete=Verwijder Snapshot van de VM +label.action.vmsnapshot.revert=Draai Snapshot van de VM terug +label.activate.project=Activeer Project +label.active.sessions=Actieve Sessies +label.add.accounts.to=Voeg accounts toe aan +label.add.accounts=Voeg accounts toe +label.add.account.to.project=Voeg account aan project toe +label.add.account=Voeg Account toe +label.add.ACL=Voeg ACL toe +label.add.BigSwitchVns.device=Voeg BigSwitch Vns Controller toe +label.add.by.cidr=Voeg toe door middel van CIDR +label.add.by.group=Voeg toe door middel van Groep +label.add.by=Voeg toe door middel van +label.add.cluster=Voeg Cluster toe +label.add.compute.offering=Voeg Compute aanbieding toe +label.add.direct.iprange=Voeg Direct IP Range toe +label.add.disk.offering=Voeg Schijf Aanbieding toe +label.add.domain=Voeg Domein toe +label.add.egress.rule=Voeg uitgaande regel toe +label.add.F5.device=Voeg F5 apparaat toe +label.add.firewall=Voeg firewall regel toe +label.add.guest.network=Gast netwerk toevoegen +label.add.host=Host toevoegen +label.adding.cluster=Bezig met toevoegen van Cluster +label.adding.failed=Toevoegen mislukt +label.adding.pod=Bezig met toevoegen van Pod +label.adding.processing=Toevoegen.... +label.add.ingress.rule=Voeg inkomende regel toe +label.adding.succeeded=Toevoegen geslaagd +label.adding=Toevoegen +label.adding.user=Bezig met toevoegen van Gebruiker +label.adding.zone=Bezig met toevoegen van Zone +label.add.ip.range=Voeg IP range toe +label.additional.networks=Additioneele Netwerken +label.add.load.balancer=Voeg Load Balancer toe +label.add.more=Voeg meer toe +label.add.netScaler.device=Voeg Netscaler apparaat toe +label.add.network.ACL=Voeg netwerk ACL toe +label.add.network.device=Voeg Netwerk Apparaat toe +label.add.network.offering=Voeg netwerk aanbieding toe +label.add.network=Voeg Netwerk toe +label.add.new.F5=Voeg nieuwe F5 toe +label.add.new.gateway=Voeg nieuwe gateway toe +label.add.new.NetScaler=Voeg nieuwe Netscaler toe +label.add.new.SRX=Voeg nieuwe SRX toe +label.add.new.tier=Voeg nieuwe Tier toe +label.add.NiciraNvp.device=Voeg NVP Controller toe +label.add.physical.network=Voeg fysiek netwerk toe +label.add.pod=Voeg Pod toe +label.add.port.forwarding.rule=Voeg port forwarding regel toe +label.add.primary.storage=Voeg Primaire Opslag toe +label.add.region=Voeg Regio toe +label.add.resources=Resources toevoegen +label.add.route=Route toevoegen +label.add.rule=Regel toevoegen +label.add.secondary.storage=Secundaire Opslag toevoegen +label.add.security.group=Security Group toevoegen +label.add.service.offering=Service Aanbieding toevoegen +label.add.SRX.device=SRX apparaat toevoegen +label.add.static.nat.rule=Statische NAT regel toevoegen +label.add.static.route=Statische route toevoegen +label.add.system.service.offering=Systeem Service Aanbieding toevoegen +label.add.template=Template toevoegen +label.add.to.group=Toevoegen aan groep +label.add.user=Gebruiker toevoegen +label.add.vlan=VLAN toevoegen +label.add.vms.to.lb=Voeg VM(s) toe aan load balancer regel +label.add.vms=VMs toevoegen +label.add.VM.to.tier=Voeg VM toe aan tier +label.add.vm=VM toevoegen +label.add=Voeg toe +label.add.volume=Volume toevoegen +label.add.vpc=VPC toevoegen +label.add.vpn.customer.gateway=VPN Customer Gateway toevoegen +label.add.VPN.gateway=VPN Gateway toevoegen +label.add.vpn.user=VPN gebruiker toevoegen +label.add.zone=Zone toevoegen +label.admin.accounts=Beheer Accounts +label.admin=Beheerder +label.advanced=Geavanceerd +label.advanced.mode=Geavanceerde Modus +label.advanced.search=Geavanceerd zoeken +label.agent.password=Agent wachtwoord +label.agent.username=Agent Gebruikersnaam +label.agree=Accepteren +label.alert=Alarm +label.algorithm=Algoritme +label.allocated=Gebruikt +label.allocation.state=Verbruik Staat +label.api.key=API Sleutel +label.apply=Uitvoeren +label.assign=Toevoegen +label.assign.to.load.balancer=Voeg instantie toe aan load balancer +label.associated.network=Bijbehorend Netwerk +label.associated.network.id=Bijbehorend Netwerk ID +label.attached.iso=Gekoppelde ISO +label.author.email=Auteur e-mail +label.author.name=Auteur naam +label.availability=Beschikbaarheid +label.availability.zone=Beschikbaarheids-zone +label.available=Beschikbaar +label.available.public.ips=Beschikbare Publieke IP adressen +label.back=Terug +label.bandwidth=Bandbreedte +label.basic=Basis +label.basic.mode=Basis Modus +label.bigswitch.controller.address=BigSwitch Vns Controller Adres +label.bootable=Bootable +label.broadcast.domain.range=Broadcast domain range +label.broadcast.domain.type=Broadcast Domain Type +label.broadcast.uri=Broadcast URI +label.by.account=Op Account +label.by.availability=Op Beschikbaarheid +label.by.domain=Op Domein +label.by.end.date=Op Eind Datum +label.by.level=Op Level +label.by.pod=Op Pod +label.by.role=Op Rol +label.by.start.date=Op Start Datum +label.by.state=Op Staat +label.bytes.received=Bytes Ontvangen +label.bytes.sent=Bytes Verzonden +label.by.traffic.type=Op Verkeerstype +label.by.type.id=Op Type ID +label.by.type=Op Type +label.by.zone=Op Zone +label.cancel=Annuleer +label.capacity=Capaciteit +label.certificate=Certificaat +label.change.service.offering=Wijzig service aanbieding +label.change.value=Wijzig waarde +label.character=Karakter +label.checksum=MD5 checksum +label.cidr.account=CIDRN of Account/Security Group +label.cidr=CIDR +label.cidr.list=Bron CIDR +label.CIDR.list=CIDR lijst +label.CIDR.of.destination.network=CIDR van bestemmingsnetwerk +label.clean.up=Opschonen +label.clear.list=Schoon lijst op +label.close=Sluiten +label.cloud.console=Cloud Beheers Console +label.cloud.managed=Cloud.com Managed +label.cluster=Cluster +label.cluster.name=Cluster Naam +label.clusters=Clusters +label.cluster.type=Cluster Type +label.clvm=CLVM +label.code=Code +label.community=Community +label.compute.and.storage=Compute en Opslag +label.compute=Compute +label.compute.offering=Compute aanbieding +label.configuration=Configuratie +label.configure=Configureer +label.configure.network.ACLs=Configureer Netwerk ACLs +label.configure.vpc=Configureer VPC +label.confirmation=Bevestiging +label.confirm.password=Bevestig wachtwoord +label.congratulations=Gefeliciteerd\! +label.conserve.mode=Conserveer modus +label.console.proxy=Console proxy +label.continue.basic.install=Ga door met basis installatie +label.continue=Ga door +label.corrections.saved=Correcties opgeslagen +label.cpu.allocated=CPU gebruik +label.cpu.allocated.for.VMs=CPU gebruikt voor VMs +label.CPU.cap=CPU Cap +label.cpu=CPU +label.cpu.limits=CPU limieten +label.cpu.mhz=CPU (in MHz) +label.cpu.utilized=CPU Verbruik +label.created=Aangemaakt +label.created.by.system=Aangemaakt door systeem +label.create.project=Nieuw project +label.create.template=Nieuwe template +label.create.VPN.connection=Nieuwe VPN connectie +label.cross.zones=Over Zones +label.custom.disk.size=Vrije schijf grootte +label.daily=Dagelijkse +label.data.disk.offering=Data Schijf Aanbieding +label.date=Datum +label.day.of.month=Dag van de Maand +label.day.of.week=Dag van de Week +label.dead.peer.detection=Dead Peer detectie +label.decline.invitation=Sla uitnodiging af +label.dedicated=Dedicated +label.default=Standaard +label.default.use=Standaard Gebruik +label.default.view=Standaard Weergave +label.delete.BigSwitchVns=Verwijder BigSwitch Vns Controller +label.delete.F5=Verwijder F5 +label.delete.gateway=Verwijder gateway +label.delete.NetScaler=Verwijder NetScaler +label.delete.NiciraNvp=Verwijder Nvp Controller +label.delete.project=Verwijder project +label.delete.SRX=Verwijder SRX +label.delete=Verwijder +label.delete.VPN.connection=Verwijder VPN connectie +label.delete.VPN.customer.gateway=Verwijder VPN Customer Gateway +label.delete.VPN.gateway=Verwijder VPN Gateway +label.delete.vpn.user=Verwijder VPN gebruiker +label.deleting.failed=Verwijderen Mislukt +label.deleting.processing=Verwijderen.... +label.description=Beschrijving +label.destination.physical.network.id=Bestemming fysiek netwerk ID +label.destination.zone=Bestemmingszone +label.destroy.router=Verwijder router +label.destroy=Verwijder +label.detaching.disk=Ontkoppelen Schijf +label.details=Details +label.device.id=Apparaat ID +label.devices=Apparaten +label.dhcp=DHCP +label.DHCP.server.type=DHCP Server Type +label.direct.ips=Shared Netwerk IPs +label.disabled=Uitgeschakeld +label.disable.provider=Provider uitschakelen +label.disable.vpn=VPN uitschakelen +label.disabling.vpn.access=Uitschakelen van VPN Toegang +label.disk.allocated=Schijfruimte gealloceerd +label.disk.offering=Schijf Aanbieding +label.disk.size.gb=Schijf Grootte (in GB) +label.disk.size=Schijf Grootte +label.disk.total=Schijf Totaal +label.disk.volume=Schijf Volume +label.display.name=Weergavenaam +label.display.text=Weergavetekst +label.dns.1=DNS 1 +label.dns.2=DNS 2 +label.dns=DNS +label.DNS.domain.for.guest.networks=DNS domein voor Gast Netwerken +label.domain.admin=Domein Beheerder +label.domain=Domein +label.domain.id=Domein ID +label.domain.name=Domeinnaam +label.domain.router=Domein router +label.domain.suffix=DNS domein achtervoegsel (v.b., xyz.com) +label.done=Klaar +label.double.quotes.are.not.allowed=Aanhalingstekens zijn hier niet toegestaan +label.download.progress=Download Voortgang +label.drag.new.position=Sleep naar nieuwe positie +label.edit.lb.rule=Wijzig LB regel +label.edit.network.details=Wijzig netwerk details +label.edit.project.details=Wijzig project details +label.edit.tags=Wijzig tags +label.edit.traffic.type=Wijzig traffic type +label.edit.vpc=Wijzig VPC +label.edit=Wijzig +label.egress.rules=Uitgaande regels +label.egress.rule=Uitgaande regel +label.elastic=Elastisch +label.elastic.IP=Elastisch IP +label.elastic.LB=Elastisch LB +label.email=Email +label.enable.provider=Provider inschakelen +label.enable.s3=S3-gebaseerde Secondary Storage inschakelen +label.enable.swift=Swift inschakelen +label.enable.vpn=VPN inschakelen +label.enabling.vpn.access=VPN toegang inschakelen +label.enabling.vpn=VPN inschakelen +label.end.IP=Eind IP +label.endpoint=Endpoint +label.endpoint.or.operation=Endpoint or Operation +label.end.port=Eind Poort +label.end.reserved.system.IP=Einde gereserveerde systeem IP +label.end.vlan=Einde Vlan +label.enter.token=Voer token in +label.error.code=Fout code +label.error=Fout +label.ESP.encryption=ESP Encryptie +label.ESP.hash=ESP Hash +label.ESP.lifetime=ESP Lifetime (secondes) +label.ESP.policy=ESP policy +label.esx.host=ESX/ESXi Host +label.example=Voorbeeld +label.external.link=Externe link +label.f5=F5 +label.failed=Mislukt +label.featured=Voorgesteld +label.fetch.latest=Haal laatste op +label.filterBy=Filter per +label.firewall=Firewall +label.first.name=Voornaam +label.format=Formaat +label.friday=Vrijdag +label.full.path=Volledig pad +label.full=Volledig +label.gateway=Gateway +label.general.alerts=Algemene Waarschuwingen +label.generating.url=Generen van URL +label.go.step.2=Ga naar Stap 2 +label.go.step.3=Ga naar Stap 3 +label.go.step.4=Ga naar Stap 4 +label.go.step.5=Ga naar Stap 5 +label.group=Groep +label.group.optional=Groep (Optioneel) +label.guest.cidr=Gast CIDR +label.guest.end.ip=Gast eind IP +label.guest=Gast +label.guest.gateway=Gast Gateway +label.guest.ip=Gast IP Adres +label.guest.ip.range=Gast IP range +label.guest.netmask=Gast Netmask +label.guest.networks=Gast netwerken +label.guest.start.ip=Gast start IP +label.guest.traffic=Gast verkeer +label.guest.type=Gast Type +label.ha.enabled=HA ingeschakeld +label.help=Help +label.hide.ingress.rule=Verberg Inkomende Regel +label.hints=Tips +label.host.alerts=Host Waarschuwingen +label.host=Host +label.host.MAC=Host MAC +label.host.name=Hostnaam +label.hosts=Hosts +label.host.tags=Host Tags +label.hourly=Uurlijks +label.hypervisor.capabilities=Hypervisor mogelijkheden +label.hypervisor=Hypervisor +label.hypervisor.type=Hypervisor Type +label.hypervisor.version=Hypervisor versie +label.id=ID +label.IKE.DH=IKE DH +label.IKE.encryption=IKE Encryptie +label.IKE.hash=IKE Hash +label.IKE.lifetime=IKE lifetime (secondes) +label.IKE.policy=IKE policy +label.info=Info +label.ingress.rule=Inkomende Regel +label.initiated.by=Ge\u00efnitieerd door +label.installWizard.addClusterIntro.subtitle=Wat is een cluster? +label.installWizard.addClusterIntro.title=Nu\: Cluster toevoegen +label.installWizard.addHostIntro.subtitle=Wat is een host? +label.installWizard.addHostIntro.title=Nu\: Host toevoegen +label.installWizard.addPodIntro.subtitle=Wat is een pod? +label.installWizard.addPodIntro.title=Nu\: Pod toevoegen +label.installWizard.addPrimaryStorageIntro.subtitle=Wat is primary storage? +label.installWizard.addPrimaryStorageIntro.title=Nu\: Primaire opslag toevoegen +label.installWizard.addSecondaryStorageIntro.subtitle=Wat is secundaire opslag? +label.installWizard.addSecondaryStorageIntro.title=Nu\: Secundaire opslag toevoegen +label.installWizard.addZoneIntro.subtitle=Wat is een zone? +label.installWizard.addZoneIntro.title=Nu\: Zone toevoegen +label.installWizard.addZone.title=Zone toevoegen +label.installWizard.click.launch=Klik op de lanceer knop. +label.installWizard.subtitle=Deze rondleiding gaat je helpen met het uitvoeren van de CloudStack&\#8482 installatie +label.installWizard.title=Hallo en welkom bij CloudStack&\#8482 +label.instance=Instantie +label.instance.limits=Instantie Limieten +label.instance.name=Instantie Naam +label.instances=Instanties +label.internal.dns.1=Interne DNS 1 +label.internal.dns.2=Interne DNS 2 +label.internal.name=Interne naam +label.interval.type=Interval Type +label.introduction.to.cloudstack=CloudStack&\#8482 Introductie +label.invalid.integer=Onjuiste Waarde +label.invalid.number=Onjuist nummer +label.invitations=Uitnodigingen +label.invited.accounts=Uitgenodigde accounts +label.invite.to=Nodig uit voor +label.invite=Uitnodigen +label.ip.address=IP Adres +label.ipaddress=IP Adres +label.ip.allocations=IP Allocaties +label.ip=IP +label.ip.limits=Publieke IP Limieten +label.ip.or.fqdn=IP of FQDN +label.ip.range=IP Range +label.ip.ranges=IP Ranges +label.IPsec.preshared.key=IPsec Preshared-Key +label.ips=IPs +label.iscsi=iSCSI +label.is.default=Is Standaard +label.iso.boot=ISO Boot +label.iso=ISO +label.isolated.networks=Geisoleerde netwerken +label.isolation.method=Isolatie methode +label.isolation.mode=Isolatie Modus +label.isolation.uri=Isolatie URI +label.is.redundant.router=Redundant +label.is.shared=Is Gedeeld +label.is.system=Is Systeem +label.item.listing=Items lijst +label.keep=Bewaar +label.keyboard.type=Toetsenbord type +label.key=Sleutel +label.kvm.traffic.label=KVM verkeer label +label.label=Label +label.lang.brportugese=Braziliaans Portgees +label.lang.chinese=Chinees (Simplified) +label.lang.english=Engels +label.lang.french=Frans +label.lang.japanese=Japans +label.lang.korean=Koreans +label.lang.russian=Russisch +label.lang.spanish=Spaans +label.last.disconnected=Laatse keer niet verbonden +label.last.name=Achternaam +label.latest.events=Laatste gebeurtenissen +label.launch=Lanceer +label.launch.vm=Lanceer VM +label.launch.zone=Lanceer zone +label.LB.isolation=LB isolatie +label.least.connections=Minste connecties +label.level=Level +label.load.balancer=Load Balancer +label.load.balancing=Load Balancing +label.load.balancing.policies=Load balancing policies +label.loading=Laden +label.local=Lokaal +label.local.storage.enabled=Lokale opslag ingeschakeld +label.local.storage=Lokale Opslag +label.login=Login +label.logout=Log uit +label.lun=LUN +label.LUN.number=LUN \# +label.make.project.owner=Maak account project eigenaar +label.manage=Beheer +label.management=Beheer +label.management.ips=Beheers IP Adressen +label.manage.resources=Beheer Resources +label.max.cpus=Max. CPU cores +label.max.guest.limit=Max. Instanties +label.maximum=Maximaal +label.max.memory=Max. geheugen (MiB) +label.max.networks=Max. netwerken +label.max.primary.storage=Max. primare opslag (GiB) +label.max.public.ips=Max. publieke IPs +label.max.secondary.storage=Max. secundaire opslag (GiB) +label.max.snapshots=Max. snapshots +label.max.templates=Max. templates +label.max.vms=Max. VMs per gebruiker +label.max.volumes=Max. volumes +label.max.vpcs=Max. VPCs +label.may.continue=U kunt nu verder gaan. +label.memory.allocated=Geheugen Gealloceerd +label.memory=Geheugen +label.memory.limits=Geheugen limieten (MiB) +label.memory.mb=Geheugen (in MB) +label.memory.total=Totaal Geheugen +label.memory.used=Geheugen gebruikt +label.menu.accounts=Accounts +label.menu.alerts=Waarschuwingen +label.menu.all.accounts=Alle Accounts +label.menu.all.instances=Alle Instanties +label.menu.community.isos=Community ISOs +label.menu.community.templates=Community Templates +label.menu.configuration=Configuratie +label.menu.dashboard=Dashboard +label.menu.destroyed.instances=Vernietigde Instanties +label.menu.disk.offerings=Schijf Aanbiedingen +label.menu.domains=Domeinen +label.menu.events=Gebeurtenissen +label.menu.featured.isos=Voorgestelde ISOs +label.menu.featured.templates=Voorgestelde Templates +label.menu.global.settings=Algemene Instellingen +label.menu.infrastructure=Infrastructuur +label.menu.instances=Instanties +label.menu.ipaddresses=IP Adressen +label.menu.isos=ISOs +label.menu.my.accounts=Mijn Accounts +label.menu.my.instances=Mijn Instanties +label.menu.my.isos=Mijn ISOs +label.menu.my.templates=Mijn Templates +label.menu.network=Netwerk +label.menu.network.offerings=Netwerk Aanbiedingen +label.menu.physical.resources=Fysieke Resources +label.menu.regions=Regio\\'s +label.menu.running.instances=Draaiende Instanties +label.menu.security.groups=Security Groups +label.menu.service.offerings=Service Aanbiedingen +label.menu.snapshots=Snapshots +label.menu.stopped.instances=Uitgeschakelde Instanties +label.menu.storage=Opslag +label.menu.system.service.offerings=Systeem Aanbiedingen +label.menu.system=Systeem +label.menu.system.vms=Systeem VMs +label.menu.templates=Templates +label.menu.virtual.appliances=Virtueele Appliances +label.menu.virtual.resources=Virtuele Resources +label.menu.volumes=Volumes +label.migrate.instance.to.host=Migreer instantie naar andere host +label.migrate.instance.to=Migreer instantie naar +label.migrate.instance.to.ps=Migreer instantie naar andere primaire opslag +label.migrate.router.to=Migreer Router naar +label.migrate.systemvm.to=Migreer Systeem VM naar +label.migrate.to.host=Migreer naar host +label.migrate.to.storage=Migreer naar opslag +label.migrate.volume=Migreer volume naar andere primaire opslag +label.minimum=Minimum +label.minute.past.hour=Minuten na het uur +label.monday=Maandag +label.monthly=Maandelijks +label.more.templates=Meer Templates +label.move.down.row=Verplaats \u00e9\u00e9n regel naar beneden +label.move.to.bottom=Verplaats naar beneden +label.move.to.top=Verplaats naar boven +label.move.up.row=Verplaats \u00e9\u00e9n regel naar boven +label.my.account=Mijn Account +label.my.network=Mijn netwerk +label.my.templates=Mijn templates +label.name=Naam +label.name.optional=Naam (Optioneel) +label.nat.port.range=NAT Poort Range +label.netmask=Netmask +label.netScaler=NetScaler +label.network.ACL=Netwerk ACL +label.network.ACLs=Netwerk ACLs +label.network.ACL.total=Netwerk ACL Totaal +label.network.desc=Netwerk Beschr. +label.network.device=Netwerk Apparaat +label.network.device.type=Netwerk Apparaat Type +label.network.domain=Netwerk Domein +label.network.domain.text=Netwerk Domein +label.network.id=Netwerk ID +label.networking.and.security=Netwerken en beveiliging +label.network.label.display.for.blank.value=Gebruik standaard gateway +label.network.name=Netwerk Naam +label.network=Netwerk +label.network.offering.display.text=Netwerk Aanbieding Weergave Tekst +label.network.offering.id=Netwerk Aanbieding ID +label.network.offering.name=Netwerk Aanbieding Naam +label.network.offering=Netwerk Aanbieding +label.network.read=Netwerk gelezen +label.network.service.providers=Netwerk Service Aanbieders +label.networks=Netwerken +label.network.type=Netwerk Type +label.network.write=Netwerk geschreven +label.new=Nieuw +label.new.password=Nieuw wachtwoord +label.new.project=Nieuw Project +label.new.vm=Nieuwe VM +label.next=Volgende +label.nexusVswitch=Nexus 1000v +label.nfs=NFS +label.nfs.server=NFS Server +label.nfs.storage=NFS Opslag +label.nic.adapter.type=NIC adapter type +label.nicira.controller.address=Controller Adres +label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid +label.nicira.transportzoneuuid=Transport Zone Uuid +label.nics=NICs +label.no.actions=Geen Beschikbare Acties +label.no.alerts=Geen Recente Waarschuwingen +label.no.data=Geen data om weer te geven +label.no.errors=Geen Recente Fouten +label.no.isos=Geen beschikbare ISOs +label.no.items=Geen Beschikbare Items +label.no=Nee +label.none=Geen +label.no.security.groups=Geen Beschikbare Security Groups +label.not.found=Niet gevonden +label.no.thanks=Nee bedankt +label.notifications=Notificaties +label.number.of.clusters=Aantal Clusters +label.number.of.hosts=Aantal Hosts +label.number.of.pods=Aantal Pods +label.number.of.system.vms=Aantal Systeem VMs +label.number.of.virtual.routers=Aantal Virtual Routers +label.number.of.zones=Aantal Zones +label.num.cpu.cores=Aantal CPU Cores +label.numretries=Keren opnieuw geprorbeerd +label.ocfs2=OCFS2 +label.offer.ha=HA aanbieden +label.ok=OK +label.optional=Optioneel +label.order=Volgorde +label.os.preference=OS Voorkeur +label.os.type=OS Type +label.owned.public.ips=Publieke IP Adressen in beheer +label.owner.account=Account Eigenaar +label.owner.domain=Domein Eigenaar +label.parent.domain=Bovenliggend Domein +label.password.enabled=Wachtwoord Ingeschakeld +label.password=Wachtwoord +label.path=Pad +label.perfect.forward.secrecy=Perfect Forward Secrecy +label.physical.network=Fysiek Netwerk +label.physical.network.ID=Fysiek netwerk ID +label.PING.CIFS.password=PING CIFS wachtwoord +label.PING.CIFS.username=PING CIFS gebruikersnaam +label.PING.dir=PING Directory +label.PING.storage.IP=PING opslag IP +label.please.specify.netscaler.info=Geef hier informatie van de Netscaler op +label.please.wait=Een ogenblik geduld a.u.b. +label.plugin.details=Plugin details +label.plugins=Plugins +label.pod.name=Pod Naam +label.pod=Pod +label.pods=Pods +label.port.forwarding.policies=Port forwarding policies +label.port.forwarding=Port Forwarding +label.port.range=Port Range +label.PreSetup=PreSetup +label.previous=Vorige +label.prev=Terug +label.primary.allocated=Primaire Opslag Gealloceerd +label.primary.network=Primair Netwerk +label.primary.storage.count=Primaire Opslag Pools +label.primary.storage.limits=Primaire Opslag limieten (GiB) +label.primary.storage=Primaire Opslag +label.primary.used=Primaire Opslag Gebruikt +label.private.Gateway=Priv\u00e9 Gateway +label.private.interface=Priv\u00e9 Interface +label.private.ip=Priv\u00e9 IP Adres +label.private.ip.range=Priv\u00e9 IP Range +label.private.ips=Priv\u00e9 IP adressen +label.privatekey=PKCS\#8 Private Key +label.private.network=Priv\u00e9 Netwerk +label.private.port=Priv\u00e9 Port +label.private.zone=Priv\u00e9 Zone +label.project.dashboard=Project Dashboard +label.project.id=Project ID +label.project.invite=Nodig uit voor project +label.project.name=Project naam +label.project=Project +label.projects=Projecten +label.project.view=Project Weergave +label.protocol=Protocol +label.providers=Providers +label.public.interface=Publieke Interface +label.public.ip=Publiek IP Adres +label.public.ips=Publieke IP Adressen +label.public.network=Publiek netwerk +label.public.port=Publieke Poort +label.public=Publiek +label.public.traffic=Publiek verkeer +label.public.zone=Publieke Zone +label.purpose=Doel +label.Pxe.server.type=PXE Server Type +label.quickview=Sneloverzicht +label.reboot=Reboot +label.recent.errors=Recente Fouten +label.redundant.router.capability=Redundante router mogelijkheden +label.redundant.router=Redundante Router +label.redundant.state=Redundante staat +label.refresh=Ververs +label.region=Regio +label.related=Samenhangend +label.remind.later=Herinner me later +label.remove.ACL=Verwijder ACL +label.remove.egress.rule=Verwijder uitgaande regel +label.remove.from.load.balancer=Verwijder Instantie van load balancer +label.remove.ingress.rule=Verwijder inkomende regel +label.remove.ip.range=Verwijder IP range +label.remove.pf=Verwijder port forwarding regel +label.remove.project.account=Verwijder account van project +label.remove.region=Verwijder Regio +label.remove.rule=Verwijder regel +label.remove.static.nat.rule=Verwijder static NAT regel +label.remove.static.route=Verwijder statische route +label.remove.tier=Verwijder tier +label.remove.vm.from.lb=Verwijder VM van load balancer regel +label.remove.vpc=verwijder VPC +label.removing.user=Verwijderen Gebruiker +label.removing=Verwijderen +label.required=Vereist +label.reserved.system.gateway=Gereseveerde systeem gateway +label.reserved.system.ip=Gereserveerd Systeem IP +label.reserved.system.netmask=Gereserveerd systeem netmask +label.reset.VPN.connection=Reset VPN verbinding +label.resize.new.offering.id=Nieuwe Aanbieding +label.resize.new.size=Nieuwe Grootte(GB) +label.resize.shrink.ok=Verklein OK +label.resource.limits=Verbruikslimieten +label.resource.state=Verbruik staat +label.resources=Verbruiken +label.resource=Verbruik +label.restart.network=Herstart netwerk +label.restart.required=Herstart benodigd +label.restart.vpc=herstart VPC +label.restore=Herstel +label.review=Beoordeel +label.revoke.project.invite=Trek uitnodiging in +label.role=Rol +label.root.disk.controller=Root schijf controller +label.root.disk.offering=Root Schijf Aanbieding +label.round.robin=Round-robin +label.rules=Regels +label.running.vms=Draaiende VMs +label.s3.access_key=Toegangssleutel +label.s3.bucket=Bucket +label.s3.connection_timeout=Connectie Timeout +label.s3.endpoint=Endpoint +label.s3.max_error_retry=Max. opnieuw proberen na Fout +label.s3.secret_key=Geheime sleutel +label.s3.socket_timeout=Socket Timeout +label.s3.use_https=Gebruik HTTPS +label.saturday=Zaterdag +label.save.and.continue=Opslaan en verder gaan +label.save=Opslaan +label.saving.processing=Opslaan.... +label.scope=Scope +label.search=Zoeken +label.secondary.storage.count=Secundaire Opslag Pools +label.secondary.storage.limits=Secundaire Opslag limieten (GiB) +label.secondary.storage=Secundaire Opslag +label.secondary.storage.vm=Secundaire Opslag VM +label.secondary.used=Secundaire Opslag Gebruikt +label.secret.key=Geheime sleutel +label.security.group.name=Security Group Naam +label.security.group=Security Group +label.security.groups.enabled=Security Groups Ingeschakeld +label.security.groups=Security Groups +label.select.a.template=Selecteer een template +label.select.a.zone=Selecteer een zone +label.select.instance=Selecteer een instance +label.select.instance.to.attach.volume.to=Selecteer een instance om het volume aan te koppelen +label.select.iso.or.template=Selecteer een ISO of template +label.select.offering=Selecteer Aanbieding +label.select.project=Selecteer Project +label.select=Selecteer +label.select.tier=Selecteer Tier +label.select-view=Selecteer Weergave +label.select.vm.for.static.nat=Selecteer VM voor static NAT +label.sent=Verstuurd +label.server=Server +label.service.capabilities=Service Mogelijkheden +label.service.offering=Service Aanbieding +label.session.expired=Sessie Verlopen +label.setup=Instellen +label.setup.network=Stel Netwerk in +label.setup.zone=Stel Zone in +label.set.up.zone.type=Stel zone type in +label.shared=Gedeeld +label.SharedMountPoint=SharedMountPoint +label.show.ingress.rule=Toon Inkomende Regel +label.shutdown.provider=Schakel provider uit +label.site.to.site.VPN=Site-to-site VPN +label.size=Grootte +label.skip.guide=Ik heb CloudStack al eerder gebruikt, sla deze stap over +label.snapshot.limits=Snapshot Limieten +label.snapshot.name=Snapshot Naam +label.snapshot.schedule=Stel herhalende Snapshot in +label.snapshot=Snapshot +label.snapshot.s=Snapshot (s) +label.snapshots=Snapshots +label.source=Bron +label.source.nat=Source NAT +label.specify.IP.ranges=Specificeer IP ranges +label.specify.vlan=Specificeer VLAN +label.SR.name = SR Name-Label +label.srx=SRX +label.start.IP=Start IP +label.start.port=Start Poort +label.start.reserved.system.IP=Start gereseveerd systeem IP +label.start.vlan=Start VLAN +label.state=Staat +label.static.nat.enabled=Static NAT Ingeschakeld +label.static.nat=Static NAT +label.static.nat.to=Static NAT naar +label.static.nat.vm.details=Static NAT VM Details +label.statistics=Statistieken +label.status=Status +label.step.1=Stap 1 +label.step.1.title=Stap 1\: Selecteer een Template +label.step.2=Stap 2 +label.step.2.title=Stap 2\: Service Aanbieding +label.step.3=Stap 3 +label.step.3.title=Stap 4\: Selecteer een Schijf Aanbieding +label.step.4=Stap 4 +label.step.4.title=Stap 4\: Netwerk +label.step.5=Stap 5 +label.step.5.title=Stap 5\: Beoordeel +label.stickiness=Stickiness +label.sticky.cookie-name=Cookie naam +label.sticky.domain=Domein +label.sticky.expire=Verloopt +label.sticky.holdtime=Wacht tijd +label.sticky.indirect=Indirect +label.sticky.length=Lengte +label.sticky.mode=Modus +label.sticky.nocache=Geen cache +label.sticky.postonly=Alleen Post +label.sticky.prefix=Prefix +label.sticky.request-learn=Request learn +label.sticky.tablesize=Tabel grootte +label.stopped.vms=Uitgeschakelde VMs +label.stop=Stop +label.storage=Opslag +label.storage.tags=Opslag Tags +label.storage.traffic=Opslag Verkeer +label.storage.type=Opslag Type +label.subdomain.access=Subdomein Toegang +label.submitted.by=[Verstuurd door\: ] +label.submit=Verstuur +label.succeeded=Geslaagd +label.sunday=Zondag +label.super.cidr.for.guest.networks=Super CIDR voor Gast Netwerken +label.supported.services=Geondersteunde Diensten +label.supported.source.NAT.type=Ondersteunde Source NAT type +label.suspend.project=Pauzeer Project +label.system.capacity=Systeem Capaciteit +label.system.offering=Systeem Aanbieding +label.system.service.offering=Systeem Service Aanbieding +label.system.vms=Systeem VMs +label.system.vm=Systeem VM +label.system.vm.type=Systeem VM type +label.system.wide.capacity=Systeembreede capaciteit +label.tagged=Tagged +label.tags=Tags +label.target.iqn=Doel IQN +label.task.completed=Taak uitgevoerd +label.template.limits=Template Limieten +label.template=Template +label.TFTP.dir=TFTP Directory +label.theme.default=Standaard Thema +label.theme.grey=Aangepast - Grijs +label.theme.lightblue=Aangepast - Licht Blauw +label.thursday=Donderdag +label.tier.details=Tier details +label.tier=Tier +label.timeout.in.second = Timeout(seconden) +label.timeout=Timeout +label.time=Tijd +label.time.zone=Tijdzone +label.timezone=Tijdzone +label.token=Token +label.total.cpu=Totaal CPU +label.total.CPU=Totaal CPU +label.total.hosts=Totaal Hosts +label.total.memory=Totaal Geheugen +label.total.of.ip=Totaal aantal IP Adressen +label.total.of.vm=Totaal aantal VM +label.total.storage=Totaal Opslag +label.total.vms=Totaal VMs +label.traffic.label=Verkeerslabel +label.traffic.types=Verkeer Types +label.traffic.type=Verkeer Type +label.tuesday=Dinsdag +label.type.id=Type ID +label.type=Type +label.unavailable=Niet beschikbaar +label.unlimited=Ongelimiteerd +label.untagged=Untagged +label.update.project.resources=Update project verbruik +label.update.ssl.cert= SSL Certificaat +label.update.ssl= SSL Certificaat +label.updating=Bezig met updaten +label.upload=Upload +label.upload.volume=Upload Volume +label.url=URL +label.usage.interface=Verbruik Interface +label.used=Gebruikt +label.user=Gebruiker +label.username=Gebruikersnaam +label.users=Gebruikers +label.use.vm.ip=Gebruik VM IP\: +label.value=Waarde +label.vcdcname=vCenter DC naam +label.vcenter.cluster=vCenter Cluster +label.vcenter.datacenter=vCenter Datacenter +label.vcenter.datastore=VCenter Datastore +label.vcenter.host=vCenter Host +label.vcenter.password=vCenter Wachtwoord +label.vcenter.username=vCenter Gebruikersnaam +label.vcipaddress=vCenter IP Adres +label.version=Versie +label.view.all=Toon alle +label.view.console=Toon console +label.viewing=Weergeven +label.view.more=Toon meer +label.view=Toon +label.virtual.appliances=Virtueele Appliances +label.virtual.appliance=Virtuele Appliance +label.virtual.machines=Virtuele machines +label.virtual.network=Virtueel Netwerk +label.virtual.routers=Virtuele Routers +label.virtual.router=Virtuele Router +label.vm.add=Instantie Toevoegen +label.vm.destroy=Verwijder +label.vm.display.name=VM weergave naam +label.VMFS.datastore=VMFS datastore +label.vmfs=VMFS +label.vm.name=VM naam +label.vm.reboot=Reboot +label.VMs.in.tier=VMs in tier +label.vmsnapshot.current=isHuidige +label.vmsnapshot.memory=Snapshot geheugen +label.vmsnapshot.parentname=Bovenliggend +label.vmsnapshot.type=Type +label.vmsnapshot=VM Snapshots +label.vm.start=Start +label.vm.state=VM staat +label.vm.stop=Stop +label.vms=VMs +label.vmware.traffic.label=VMware verkeerslabel +label.volgroup=Volume Groep +label.volume.limits=Volume Limieten +label.volume.name=Volume Naam +label.volumes=Volumes +label.volume=Volume +label.vpc.id=VPC ID +label.VPC.router.details=VPC router details +label.vpc=VPC +label.VPN.connection=VPN Connectie +label.vpn.customer.gateway=VPN Customer Gateway +label.VPN.customer.gateway=VPN Customer Gateway +label.VPN.gateway=VPN Gateway +label.vpn=VPN +label.vsmctrlvlanid=Controle VLAN ID +label.vsmpktvlanid=Pakket VLAN ID +label.vsmstoragevlanid=Opslag VLAN ID +label.vsphere.managed=vSphere beheerd +label.waiting=Wachten +label.warn=Waarschuwing +label.wednesday=Woensdag +label.weekly=Wekelijks +label.welcome.cloud.console=Welkom op de Management Console +label.welcome=Welkom +label.what.is.cloudstack=Wat is CloudStack&\#8482? +label.xen.traffic.label=XenServer verkeerslabel +label.yes=Ja +label.zone.details=Zone details +label.zone.id=Zone ID +label.zone.name=Zone naam +label.zone.step.1.title=Stap 1\: Selecteer een Netwerk +label.zone.step.2.title=Stap 2\: Zone toevoegen +label.zone.step.3.title=Stap 3\: Pod toevoegen +label.zone.step.4.title=Step 4\: IP range toevoegen +label.zones=Zones +label.zone.type=Type Zone +label.zone.wide=Zone breed +label.zoneWizard.trafficType.guest=Gast\: Verkeer tussen virtuele machines van de eindgebruiker +label.zoneWizard.trafficType.public=Publiek\: Verkeer tussen het internet en virtueele machines in de cloud. +label.zoneWizard.trafficType.storage=Opslag\: Verkeer tussen de primaire en secundaire opslag servers zoals VM templates en snapshots +label.zone=Zone +managed.state=Beheersstaat +message.acquire.new.ip=Bevestigen dat je een nieuw IP voor dit netwerk wilt verkrijgen. +message.acquire.new.ip.vpc=Bevestig dat u een nieuw IP wilt verkrijgen voor deze VPC. +message.acquire.public.ip=Selecteer de zone waarvan u een nieuw IP wenst te verkrijgen. +message.action.cancel.maintenance=Het onderhoud voor de host is succesvol geannuleerd. Het daadwerkelijke proces kan echter enkele minuten duren. +message.action.cancel.maintenance.mode=Bevestig dat u het onderhoud wilt annuleren. +message.action.change.service.warning.for.instance=Uw instantie moet uitgeschakeld zijn voordat u de service aanbieding kunt wijzigen. +message.action.change.service.warning.for.router=Uw router moet uitgeschakeld zijn voordat u de service aanbieding kunt wijzigen. +message.action.delete.cluster=Bevestig dat u dit cluster wilt verwijderen. +message.action.delete.disk.offering=Bevestig dat u deze schijf aanbieding wilt verwijderen. +message.action.delete.domain=Bevestig dat u dit domein wilt verwijderen. +message.action.delete.external.firewall=Bevestig dat u deze externe firewall wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde firewall opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. +message.action.delete.external.load.balancer=Bevestig dat u deze externe loadbalancer wilt verwijderen. Waarschuwing\: Als u van plan bent dezelfde loadbalancer opnieuw toe te voegen, dient u de verbruiksstatistieken eerst te resetten. +message.action.delete.ingress.rule=Bevestig dat u deze inkomende regel wilt verwijderen. +message.action.delete.ISO=Bevestig dat u deze ISO wilt verwijderen. +message.action.delete.ISO.for.all.zones=Deze ISO wordt gebruikt door alle zones. Bevestig dat u deze wilt verwijderen van alle zones. +message.action.delete.network=Bevestig dat u dit netwerk wilt verwijderen. +message.action.delete.nexusVswitch=Bevestig dat u deze nexus 1000v wilt verwijderen +message.action.delete.physical.network=Bevestig dat u dit fysieke netwerk wilt verwijderen. +message.action.delete.pod=Bevestig dat u deze pod wilt verwijderen. +message.action.delete.primary.storage=Bevestig dat u deze primaire opslag wilt verwijderen. +message.action.delete.secondary.storage=Bevestig dat u deze secudaire opslag wilt verwijderen. +message.action.delete.security.group=Bevestig dat u deze security group wilt verwijderen. +message.action.delete.service.offering=Bevestig dat u deze service aanbieding wilt verwijderen. +message.action.delete.snapshot=Bevestig dat u deze snapshot wilt verwijderen. +message.action.delete.system.service.offering=Bevestig dat u deze systeem service aanbieding wilt verwijderen. +message.action.delete.template=Bevestig dat u deze template wilt verwijderen +message.action.delete.template.for.all.zones=Deze template wordt gebruikt door alle zones. Bevestig dat u deze wilt verwijderen van alle zones. +message.action.delete.volume=Bevestig dat u dit volume wilt verwijderen +message.action.delete.zone=Bevestig dat u deze zone wilt verwijderen +message.action.destroy.instance=Bevestig dat u deze instantie wilt vernietigen +message.action.destroy.systemvm=Bevestig dat u deze Systeem VM wilt vernietigen +message.action.disable.cluster=Bevestig dat u dit cluster wilt uitschakelen. +message.action.disable.nexusVswitch=Bevestig dat u deze nexus 1000v wilt uitschakelen. +message.action.disable.physical.network=Bevestig dat u dit fysieke netwerk wilt uitschakelen. +message.action.disable.pod=Bevestig dat u deze pod wilt uitschakelen. +message.action.disable.static.NAT=Bevestig dat u static NAT wilt uitschakelen. +message.action.disable.zone=Bevestig dat u deze zone wilt uitschakelen. +message.action.download.iso=Bevestig dat u deze ISO wilt downloaden. +message.action.download.template=Bevestig dat u deze template wilt downloaden. +message.action.enable.cluster=Bevestig dat u dit cluster wilt inschakelen. +message.action.enable.maintenance=Uw host is succesvol voorbereid op onderhoud. Het proces kan echter een paar minuten duren afhankelijk van de hoeveelheid VMs op de host. +message.action.enable.nexusVswitch=Bevestig dat u deze nexus 1000v wilt inschakelen +message.action.enable.physical.network=Bevestig dat u dit fysieke netwerk wilt inschakelen. +message.action.enable.pod=Bevestigd dat u deze pod wilt inschakelen. +message.action.enable.zone=Bevestig dat u deze zone wilt inschakelen. +message.action.force.reconnect=De host is succesvol geforceerd om opnieuw te verbinden. Dit proces kan echter enkele minuten duren. +message.action.host.enable.maintenance.mode=Het inschakelen van de onderhoudsmodus zorgt ervoor dat alle draaiende instanties worden gemigreerd naar andere beschikbare hosts. +message.step.2.desc= +message.step.3.desc= +mode=Modus +notification.reboot.instance=Herstart instantie +state.Allocated=Gebruikt +state.Disabled=Uitgeschakeld +state.Error=Fout diff --git a/client/WEB-INF/classes/resources/messages_pl.properties b/client/WEB-INF/classes/resources/messages_pl.properties new file mode 100644 index 00000000000..9024030f51e --- /dev/null +++ b/client/WEB-INF/classes/resources/messages_pl.properties @@ -0,0 +1,469 @@ +# 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. + +error.invalid.username.password=B\u0142\u0119dna nazwa u\u017cytkownika lub has\u0142o +label.account.id=ID konta +label.account=Konto +label.account.name=Nazwa konta +label.accounts=Konta +label.action.attach.disk=Dodaj dysk +label.action.attach.disk.processing=Dodawanie dysku +label.action.attach.iso=Dodaj obraz ISO +label.action.attach.iso.processing=Dodawanie obrazu ISO +label.action.change.password=Zmie\u0144 has\u0142o +label.action.copy.ISO=Kopiuj ISO +label.action.copy.ISO.processing=Kopiuj ISO.... +label.action.copy.template=Kopij szablon +label.action.copy.template.processing=Kopije szablon.... +label.action.create.template.from.vm=Utw\u00f3rz szablon z VM +label.action.create.template.from.volume=Utw\u00f3rz Szablon z wolumenu +label.action.create.template.processing=Tworz\u0119 szablon +label.action.create.template=Utw\u00f3rz szablon +label.action.create.vm.processing=Tworz\u0119 VM.... +label.action.create.vm=Utw\u00f3rz VM +label.action.create.volume.processing=Tworz\u0119 wolumen.... +label.action.create.volume=Utw\u00f3rz wolumen +label.action.delete.account.processing=Usuwanie dost\u0119pu.... +label.action.delete.account=Usu\u0144 dost\u0119p +label.action.delete.cluster.processing=Usuwam klaster.... +label.action.delete.cluster=Usu\u0144 klaster +label.action.delete.domain.processing=Usuwam domen\u0119.... +label.action.delete.domain=Usu\u0144 domen\u0119 +label.action.delete.firewall.processing=Usuwam Firewall +label.action.delete.firewall=Usu\u0144 regu\u0142\u0119 Firewall +label.action.delete.ISO.processing=Usuwam ISO.... +label.action.delete.ISO=Usu\u0144 ISO +label.action.delete.network.processing=Usuwam sie\u0107.... +label.action.delete.network=Usu\u0144 sie\u0107 +label.action.delete.nexusVswitch=Usu\u0144 Nexus 1000v +label.action.delete.physical.network=Usu\u0144 fizyczn\u0105 sie\u0107 +label.action.delete.user.processing=Usuwam u\u017cytkownika.... +label.action.delete.user=Usu\u0144 u\u017cytkownika +label.action.delete.volume.processing=Usuwam wolumen.... +label.action.delete.volume=Usu\u0144 wolumen +label.action.delete.zone.processing=Usuwam stref\u0119.... +label.action.delete.zone=Usu\u0144 stref\u0119 +label.action.destroy.instance.processing=Usuwam instancj\u0119 +label.action.destroy.instance=Usu\u0144 instancj\u0119 +label.action.detach.disk=Od\u0142\u0105cz dysk +label.action.detach.disk.processing=Od\u0142\u0105czanie dysku.... +label.action.detach.iso=Od\u0142\u0105cz obraz ISO +label.action.detach.iso.processing=Od\u0142\u0105czanie obrazu ISO +label.action.disable.account.processing=Wy\u0142\u0105czam dost\u0119p.... +label.action.disable.account=Wy\u0142\u0105cz dost\u0119p +label.action.disable.cluster.processing=Wy\u0142\u0105czam klaster.... +label.action.disable.cluster=Wy\u0142\u0105cz klaster +label.action.disable.nexusVswitch=Wy\u0142\u0105cz Nexus 1000v +label.action.disable.physical.network=Wy\u0142\u0105cz fizyczn\u0105 sie\u0107 +label.action.disable.user.processing=Wy\u0142\u0105czam u\u017cytkownika +label.action.disable.user=Wy\u0142\u0105cz u\u017cytkownika +label.action.disable.zone.processing=Wy\u0142\u0105czam stref\u0119.... +label.action.disable.zone=Wy\u0142\u0105cz stref\u0119 +label.action.download.ISO=Pobierz ISO +label.action.download.template=Pobierz szablon +label.action.download.volume=Pobierz wolumen +label.action.download.volume.processing=Pobieram wolumen.... +label.action.edit.account=Edytuj dost\u0119p +label.action.edit.domain=Edytuj domen\u0119 +label.action.edit.global.setting=Edytuj Globalne ustawienia +label.action.edit.host=Edytuj host +label.action.edit.instance=Edytuj instancj\u0119 +label.action.edit.ISO=Edytuj ISO +label.action.edit.network=Edytuj sie\u0107 +label.action.edit.network.processing=Zmieniam sie\u0107.... +label.action.edit.template=Edytuj szablon +label.action.edit.user=Edytuj u\u017cytkownika +label.action.edit.zone=Edytuj stref\u0119 +label.action.enable.account.processing=W\u0142\u0105czam dost\u0119p.... +label.action.enable.account=W\u0142\u0105cz dost\u0119p +label.action.enable.cluster.processing=W\u0142\u0105czam klaster.... +label.action.enable.cluster=W\u0142\u0105cz klaster +label.action.enable.nexusVswitch=W\u0142\u0105cz Nexus 1000v +label.action.enable.physical.network=W\u0142\u0105cz fizyczn\u0105 sie\u0107 +label.action.enable.user.processing=W\u0142\u0105czam u\u017cytkownika.... +label.action.enable.user=W\u0142\u0105cz u\u017cytkownika +label.action.enable.zone.processing=W\u0142\u0105czam stref\u0119.... +label.action.enable.zone=W\u0142\u0105cz stref\u0119 +label.action.generate.keys=Generuj klucze +label.action.generate.keys.processing=Generuj\u0119 klucze.... +label.action.list.nexusVswitch=Kista Nexus 1000v +label.action.lock.account.processing=Blokuj\u0119 dost\u0119p.... +label.action.lock.account=Zablokuj dost\u0119p +label.action.manage.cluster.processing=Zarz\u0105dzam klastrem.... +label.action.manage.cluster=Zarz\u0105dzaj klastrem +label.action.migrate.instance=Migruj instancj\u0119 +label.action.migrate.instance.processing=Migruj\u0119 instancj\u0119.... +label.action.migrate.router=Migruj router +label.action.migrate.router.processing=Migruje router.... +label.action.migrate.systemvm=Migruj system VM +label.action.migrate.systemvm.processing=Migruj\u0119 system VM.... +label.action.reboot.instance.processing=Restartuje instancj\u0119 +label.action.reboot.instance=Restartuj instancj\u0119 +label.action.reboot.router.processing=Restartuje router..... +label.action.reboot.router=Restartuj router +label.action.reboot.systemvm.processing=Restartuje system VM.... +label.action.reboot.systemvm=Restartuj system VM +label.action.register.iso=Rejestruj ISO +label.action.register.template=Rejestruj szablon +label.action.remove.host.processing=Usuwam host.... +label.action.remove.host=Usu\u0144 host +label.action.reset.password.processing=Resetuj\u0119 has\u0142o.... +label.action.reset.password=Resetuj has\u0142o +label.action.resize.volume.processing=Zmieniam wielko\u015b\u0107 wolumenu.... +label.action.resize.volume=Zmie\u0144 wielko\u015b\u0107 wolumenu +label.action.restore.instance=Przywr\u00f3\u0107 instancj\u0119 +label.actions=Akcje +label.action.start.instance.processing=Uruchamiam instancj\u0119.... +label.action.start.instance=Uruchom instancj\u0119 +label.action.start.router.processing=Uruchamiam router.... +label.action.start.router=Uruchom router +label.action.start.systemvm.processing=Uruchamiam system VM... +label.action.start.systemvm=Uruchom system VM +label.action.stop.instance.processing=Zatrzymuj\u0119 instancj\u0119.... +label.action.stop.instance=Zatrzymaj instancj\u0119 +label.action.stop.router.processing=Zatrzymuj\u0119 router... +label.action.stop.router=Zatrzymaj router +label.action.stop.systemvm.processing=Zatrzymuj\u0119 system VM.... +label.action.stop.systemvm=Zatrzymaj system VM +label.action.take.snapshot.processing=Tworz\u0119 snapshot.... +label.action.take.snapshot=Zr\u00f3b snapshot +label.activate.project=Aktywuj projekt +label.add.account=Dodaj konto +label.add.accounts=Dodaj konta +label.add.accounts.to=Dodaj konto do +label.add.account.to.project=Dodaj konto do projektu +label.add.ACL=Dodaj ACL +label.add.by.cidr=Dodaj przez CIDR +label.add.by=Dodaj przez +label.add.by.group=Dodaj przez grup\u0119 +label.add.cluster=Dodaj klaster +label.add=Dodaj +label.add.domain=Dodaj domen\u0119 +label.add.firewall=Dodaj regu\u0142\u0119 firewall +label.add.host=Dodaj host +label.adding=Dodawanie +label.adding.failed=Dodanie nieudane +label.adding.processing=Dodawanie +label.adding.succeeded=Dodanie udane +label.add.more=Dodaj wi\u0119cej +label.add.network.device=Dodaj urz\u0105dzenie sieciowe +label.add.network=Dodaj sie\u0107 +label.add.new.F5=Dodaj nowy F5 +label.add.new.SRX=Dodaj nowy SRX +label.add.region=Dodaj region +label.add.rule=Dodaj regu\u0142\u0119 +label.add.to.group=Dodaj do grupy +label.add.user=Dodaj u\u017cytkownika +label.add.vlan=Dodaj VLAN +label.add.vm=Dodaj VM +label.add.vms=Dodaj VM-ny +label.add.volume=Dodaj wolumen +label.add.vpc=Dodaj VPC +label.add.zone=Dodaj stref\u0119 +label.admin=Admin +label.api.key=Klucz API +label.apply=Zastosuj +label.author.name=Imi\u0119 autora +label.available=Dost\u0119pne +label.available.public.ips=Dost\u0119pne publiczne adresy IP +label.back=Wstecz +label.bandwidth=Przepustowo\u015b\u0107 +label.cancel=Zako\u0144cz +label.certificate=Certyfikat +label.cidr=CIDR +label.CIDR.list=Lista CIDR +label.clean.up=Wyczy\u015b\u0107 +label.clear.list=Wyczy\u015b\u0107 list\u0119 +label.close=Zamknij +label.clvm=CLVM +label.code=Kod +label.community=Spo\u0142eczno\u015b\u0107 +label.configuration=Konfiguracja +label.configure=Konfiguruj +label.configure.vpc=Konfiguruj VPC +label.confirmation=Potwierdzenie +label.confirm.password=Potwierd\u017a has\u0142o +label.congratulations=Gratulacje\! +label.continue=Kontynuuj +label.corrections.saved=Poprawka zapisana +label.cpu=CPU +label.cpu.limits=Limit CPU +label.cpu.mhz=CPU (w MHz) +label.created.by.system=Utworzono przez system +label.created=Utworzono +label.create.project=Stw\u00f3rz projekt +label.daily=Dziennie +label.date=Data +label.day.of.month=Dzie\u0144 miesi\u0105ca +label.day.of.week=Dzie\u0144 tygodnia +label.dedicated=Dedykowany +label.default=Domy\u015blnie +label.default.view=Widok domy\u015blny +label.delete.F5=Usu\u0144 F5 +label.delete.project=Usu\u0144 projekt +label.delete.SRX=Usu\u0144 SRX +label.delete=Usu\u0144 +label.deleting.failed=Usuwanie nieudane +label.deleting.processing=Usuwanie.... +label.destroy.router=Zniszcz router +label.destroy=Zniszcz +label.detaching.disk=Od\u0142\u0105czanie dysku +label.details=Szczeg\u00f3\u0142y +label.disabled=Wy\u0142\u0105czony +label.disable.vpn=Wy\u0142\u0105cz VPN +label.disk.size.gb=Wielko\u015b\u0107 dysku (w GB) +label.disk.size=Wielko\u015b\u0107 dysku +label.display.name=Wy\u015bwietlana nazwa +label.domain.admin=Administrator domeny +label.domain=Domena +label.domain.id=ID domeny +label.domain.name=Nazwa domeny +label.done=Sko\u0144czono +label.download.progress=Post\u0119p w pobieraniu +label.drag.new.position=Przenie\u015b w nowe miejsce +label.edit=Edytuj +label.edit.network.details=Edytuj szczeg\u00f3\u0142y sieci +label.edit.project.details=Zmie\u0144 szczeg\u00f3\u0142y projektu +label.edit.vpc=Edytuj VPC +label.elastic=Elastyczny +label.elastic.IP=Zmienne IP +label.email=Poczta +label.enable.vpn=W\u0142\u0105cz VPN +label.error=B\u0142\u0105d +label.f5=F5 +label.featured=Polecane +label.filterBy=Filtrowanie wg +label.firewall=Zapora +label.first.name=Pierwsza nazwa +label.format=Format +label.friday=Pi\u0105tek +label.full.path=Pe\u0142na \u015bcie\u017cka +label.go.step.2=Id\u017a do punktu 2 +label.go.step.3=Id\u017a do punktu 3 +label.go.step.4=Id\u017a do punktu 4 +label.go.step.5=Id\u017a do punktu 5 +label.group=Grupa +label.group.optional=Grupa (opcjonalnie) +label.guest=Go\u015b\u0107 +label.guest.type=Rodzaj go\u015bci +label.help=Pomoc +label.hints=Podpowiedzi +label.id=ID +label.info=Informacje +label.instances=Instancje +label.invitations=Zaproszenia +label.invited.accounts=Zaproszone konta +label.invite.to=Zapro\u015b do +label.invite=Zapro\u015b +label.ip=IP +label.iso=ISO +label.keep=Zostaw +label.key=Klucz +label.lang.english=Angielski +label.lang.french=Francuski +label.lang.japanese=Japo\u0144ski +label.lang.korean=Korea\u0144ski +label.lang.russian=Rosyjski +label.lang.spanish=Hiszpia\u0144ski +label.last.name=Nazwisko +label.least.connections=Ostatnie po\u0142\u0105czenie +label.level=Poziom +label.loading=Wczytywanie +label.local=Lokalne +label.local.storage.enabled=Pami\u0119\u0107 lokalna w\u0142\u0105czona +label.local.storage=Pami\u0119\u0107 lokalna +label.login=Zaloguj +label.logout=Wyloguj +label.lun=LUN +label.LUN.number=LUN \# +label.max.guest.limit=Maksymalna liczba go\u015bci +label.maximum=Maksimum +label.max.public.ips=Maksymalna liczba publicznych adres\u00f3w IP +label.memory.limits=Limit pami\u0119ci (MiB) +label.memory.mb=Pami\u0119\u0107 (w MB) +label.memory=Pami\u0119\u0107 +label.menu.accounts=Konta +label.menu.alerts=Alarmy +label.menu.all.accounts=Wszystkie konta +label.menu.all.instances=Wszystkie instancje +label.menu.configuration=Konfiguracja +label.menu.domains=Domeny +label.menu.infrastructure=Infrastruktura +label.menu.instances=Instancje +label.menu.ipaddresses=Adresy IP +label.menu.isos=ISO +label.menu.my.accounts=Moje konta +label.menu.my.instances=Moje instancje +label.menu.my.isos=Moje ISO +label.menu.network=Sie\u0107 +label.menu.regions=Regiony +label.menu.system=System +label.minimum=Minimum +label.monday=Poniedzia\u0142ek +label.monthly=Miesi\u0119cznie +label.move.down.row=Jeden rz\u0105d na d\u00f3\u0142 +label.move.to.top=Przenie\u015b na sam\u0105 g\u00f3r\u0119 +label.move.up.row=Jeden rz\u0105d do g\u00f3ry +label.my.account=Moje konto +label.my.network=Moja sie\u0107 +label.name=Nazwa +label.name.optional=Nazwa (opcjonalnie) +label.network.id=ID sieci +label.network.name=Nazwa sieci +label.network=Sie\u0107 +label.networks=Sieci +label.new=Nowy +label.new.project=Nowy projekt +label.next=Nast\u0119pny +label.nfs=NFS +label.nfs.server=Serwer NFS +label.no.data=Brak danych +label.none=Brak +label.no=Nie +label.no.thanks=Nie dzi\u0119kuj\u0119 +label.notifications=Przypomnienia +label.number.of.hosts=Liczba host\u00f3w +label.ok=OK +label.order=Zadanie +label.password=Has\u0142o +label.path=\u015acie\u017cka +label.please.wait=Prosz\u0119 czeka\u0107 +label.plugin.details=Szczeg\u00f3\u0142y wtyczki +label.plugins=Wtyczki +label.previous=Wstecz +label.private.network=Sie\u0107 prywatna +label.project.id=Nazwa ID projektu +label.project.invite=Zapro\u015b do projektu +label.project.name=Nazwa projektu +label.project=Projekt +label.projects=Projekty +label.protocol=Protok\u00f3\u0142 +label.providers=Dostawcy +label.public.ip=Publiczny adres IP +label.public.ips=Publiczne adresy IP +label.public.network=Sie\u0107 publiczna +label.public=Pobliczny +label.public.port=Publiczny port +label.reboot=Uruchom ponownie +label.refresh=Od\u015bwie\u017c +label.region=Region +label.remind.later=Przypomnij p\u00f3\u017aniej +label.remove.rule=Usu\u0144 regu\u0142\u0119 +label.remove.vpc=Usu\u0144 VPC +label.removing.user=Usu\u0144 u\u017cytkownika +label.removing=Usuwanie +label.required=Wymagane +label.resource.limits=Limit zasob\u00f3w +label.resources=Zasoby +label.resource=Zas\u00f3b +label.restart.required=Wymagany restart +label.rules=Zasady +label.saturday=Sobota +label.save.and.continue=Zapisz i kontynuuj +label.save=Zapisz +label.saving.processing=Zapisywanie.... +label.search=Szukaj +label.select.instance=Wybierz instancj\u0119 +label.select.project=Wybierz projekt +label.select=Wybierz +label.sent=Wys\u0142ano +label.server=Serwer +label.size=Wielko\u015bc +label.specify.IP.ranges=Wyszczeg\u00f3lnij zasi\u0119g adres\u00f3w IP +label.srx=SRX +label.statistics=Statystyki +label.status=Status +label.step.1=Krok 1 +label.step.2=Krok 2 +label.step.3=Krok 3 +label.step.4=Krok 4 +label.step.5=Krok 5 +label.sticky.domain=Domena +label.sticky.expire=Wygasa +label.sticky.length=D\u0142ugo\u015b\u0107 +label.sticky.mode=Tryb +label.sticky.prefix=Prefiks +label.stop=Stop +label.sunday=Niedziela +label.suspend.project=Zawie\u015b projekt +label.tagged=Otagowany +label.tags=Tagi +label.task.completed=Zadania uko\u0144czone +label.time=Czas +label.time.zone=Strefa czasowa +label.timezone=Strefa czasowa +label.type.id=Wpisz ID +label.type=Wpisz +label.unavailable=Niedost\u0119pny +label.unlimited=Nieograniczony +label.untagged=Nieotagowany +label.updating=Aktualizowanie +label.url=URL +label.used=U\u017cyte +label.username=Nazwa u\u017cytkownika +label.users=U\u017cytkownicy +label.user=U\u017cytkowni +label.version=Wersja +label.view.all=Zobacz wszystko +label.view=Zobacz +label.vm.add=Dodaj instancj\u0119 +label.vm.destroy=Zniszcz +label.vmfs=VMFS +label.vm.name=Nazwa VM +label.vm.reboot=Uruchom ponownie +label.vmsnapshot.type=Wpisz +label.vm.start=Rozpocznij +label.vm.stop=Stop +label.vms=VMs +label.vpc=VPC +label.vpn=VPN +label.waiting=Czekanie +label.warn=Ostrze\u017cenie +label.wednesday=\u015aroda +label.weekly=Tygodniowo +label.welcome=Witaj +label.what.is.cloudstack=Czym jest CloudStack&\#8482? +label.yes=Tak +message.action.delete.nexusVswitch=Potwierd\u017a, \u017ce chcesz usun\u0105\u0107\: nexus 1000v +message.action.download.iso=Potwierd\u017a, \u017ce chcesz pobra\u0107 ten obraz ISO. +message.activate.project=Czy na pewno chcesz aktywowa\u0107 ten projekt? +message.confirm.delete.F5=Czy na pewno chcesz usun\u0105\u0107 F5? +message.confirm.delete.SRX=Czy na pewno chcesz usun\u0105\u0107 SRX? +message.delete.project=Czy na pewno chcesz usun\u0105\u0107 ten projekt? +message.disable.vpn=Czy na pewno chcesz wy\u0142\u0105czy\u0107 VPN? +message.no.projects=Nie posiadasz \u017cadnych projekt\u00f3w.
Utw\u00f3rz nowy projekt w zak\u0142adce projekty +message.please.proceed=Przejd\u017a do nast\u0119pnego punktu +message.step.2.desc= +message.step.3.desc= +message.suspend.project=Czy na pewno chcesz zawiesi\u0107 ten projekt +mode=Tryb +state.Accepted=Akceptowano +state.Active=Aktywny +state.Completed=Uko\u0144czono +state.Creating=Tworzenie +state.Declined=Odrzucono +state.Destroyed=Zniszczono +state.Disabled=Wy\u0142\u0105czony +state.enabled=W\u0142\u0105czone +state.Enabled=W\u0142\u0105czone +state.Error=B\u0142\u0105d +state.ready=Gotowe +state.Ready=Gotowe +state.Starting=Rozpoczynanie +state.Stopped=Zatrzymano +state.Suspended=Zawieszono +ui.listView.filters.all=Wszystko diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties index 86bb83177a8..07fd3f42d76 100644 --- a/client/WEB-INF/classes/resources/messages_pt_BR.properties +++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties @@ -373,6 +373,7 @@ label.compute.and.storage=Processamento e Armazenamento label.compute.offering=Oferta de Computa\u00e7\u00e3o label.configuration=Configura\u00e7\u00e3o label.configure=Configurar +label.configure.ldap=Configurar LDAP label.configure.network.ACLs=Configure ACLs de rede label.configure.vpc=Configurar VPC label.confirmation=Confirma\u00e7\u00e3o @@ -390,6 +391,7 @@ label.cpu.mhz=CPU (em MHz) label.cpu.utilized=CPU Utilizada label.created.by.system=Criado pelo sistema label.created=Criado +label.create.nfs.secondary.staging.store=Criar storage staging secund\u00e1rio NFS label.create.project=Criar um projeto label.create.template=Criar template label.create.VPN.connection=Criar uma conex\u00e3o VPN @@ -418,6 +420,7 @@ label.delete.VPN.gateway=deletar um gateway de VPN label.delete.vpn.user=Deletar usu\u00e1rio VPN label.deleting.failed=Falha ao remover label.deleting.processing=Removendo.... +label.deployment.planner=Deployment planejado label.description=Descri\u00e7\u00e3o label.destination.physical.network.id=ID de destino da rede f\u00edsica label.destination.zone=Zona de Destino @@ -617,6 +620,9 @@ label.launch=Executar label.launch.vm=Executar VM label.launch.zone=Executar zona. label.LB.isolation=Isolamento de LB +label.ldap.configuration=Configura\u00e7\u00e3o do LDAP +label.ldap.group.name=Grupo LDAP +label.ldap.port=Porta do LDAP label.least.connections=Least connections label.level=N\u00edvel label.load.balancer=Load Balancer @@ -784,6 +790,7 @@ label.PING.CIFS.password=PING CIFS password label.PING.CIFS.username=PING CIFS username label.PING.dir=PING Directory label.PING.storage.IP=Disparar PING para IP do Storage +label.planner.mode=Modo planejado label.please.specify.netscaler.info=Por favor especifique as informa\u00e7\u00f5es do Netscaler label.please.wait=Por Favor Aguarde label.pod.name=Nome do Pod @@ -791,6 +798,7 @@ label.pod=POD label.pods=Pods label.port.forwarding=Encaminhamento de Porta label.port.forwarding.policies=Pol\u00edticas de redirecionamento de portas +label.port=Porta label.port.range=Range de Porta label.PreSetup=PreSetup label.previous=Anterior @@ -829,6 +837,15 @@ label.public.zone=Zona P\u00fablica label.purpose=Prop\u00f3sito label.Pxe.server.type=Tipo de Servidor PXE label.quickview=Visualiza\u00e7\u00e3o r\u00e1pida +<<<<<<< HEAD +======= +label.quiesce.vm=Quiesce VM +label.rbd.id=Usu\u00e1rio Ceph +label.rbd.monitor=Monitor Ceph +label.rbd.pool=Pool Ceph +label.rbd=RDB +label.rbd.secret=Cephx secret +>>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.reboot=Reiniciar label.recent.errors=Erros Recentes label.redundant.router.capability=Recurso de roteador redundante @@ -841,6 +858,7 @@ label.remove.egress.rule=Remover regra egress label.remove.from.load.balancer=Removendo Cloud Server do Load Balancer label.remove.ingress.rule=Remover regra ingress label.remove.ip.range=Remover range de IP +label.remove.ldap=Remover LDAP label.remove.pf=Remover regra de redirecionamento de porta label.remove.project.account=Remover conta de projeto label.remove.rule=Remover regra @@ -924,6 +942,9 @@ label.show.ingress.rule=Mostrar Regra de Entrada label.site.to.site.VPN=Site-to-site VPN label.size=Tamanho label.skip.guide=Eu utilizei o CloudStack antes, pular este guia +label.smb.domain=Dom\u00ednio SMB +label.smb.password=Senha SMB +label.smb.username=Usu\u00e1rio SMB label.snapshot.limits=Limites de Snapshot label.snapshot.name=Nome do Snapshot label.snapshot=Snapshot @@ -1080,6 +1101,12 @@ label.vm.state=Estado da VM label.vm.stop=Parar label.vms=VMs label.vmware.traffic.label=Etiqueta de tr\u00e1fego VMware +<<<<<<< HEAD +======= +label.vnet.id=VLAN ID +label.vnet=VLAN +label.volatile=Vol\u00e1til +>>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config label.volgroup=Grupo de Volume label.volume=Disco label.volume.limits=Limites de Disco @@ -1230,6 +1257,7 @@ message.basic.mode.desc=Escolha este modelo de rede se voc\u00ea *n\u00e3o message.change.offering.confirm=Confirme que voc\u00ea deseja mudar o plano deste Cloud Server. message.change.password=Por favor, troque sua senha. message.configure.all.traffic.types=Voc\u00ea tem m\u00faltiplas redes f\u00edsicas; favor configurar etiquetas para cada tipo de tr\u00e1fego clicando no bot\u00e3o Edit. +message.configure.ldap=Por favor, confirme que voc\u00ea deseja configurar o LDAP. message.configuring.guest.traffic=Configurando tr\u00e1fego do guest message.configuring.physical.networks=Configurando redes f\u00edsicas message.configuring.public.traffic=Configurando tr\u00e1fego p\u00fablico @@ -1355,6 +1383,14 @@ message.please.select.a.different.public.and.management.network.before.removing= message.please.select.networks=Por favor selecione as redes para sua m\u00e1quina virtual. message.please.wait.while.zone.is.being.created=Por favor, espere enquanto sua zona est\u00e1 sendo criada; isto pode demorar um pouco... message.project.invite.sent=Convite enviado para o usu\u00e1rio; Eles ser\u00e3o adicionados ao projeto ap\u00f3s aceitarem o convite +<<<<<<< HEAD +======= +message.public.traffic.in.advanced.zone=O tr\u00e1fego p\u00fablico \u00e9 gerado quando as VMs na nuvem acessam a internet. Os IPs acess\u00edveis ao p\u00fablico devem ser alocados para essa finalidade. Os usu\u00e1rios finais podem usar a interface do usu\u00e1rio CloudStack para adquirir esses IPs afim de implementar NAT entre a sua rede de guests e sua rede p\u00fablica.

Forne\u00e7a pelo menos um intervalo de endere\u00e7os IP para o tr\u00e1fego de internet. +message.public.traffic.in.basic.zone=O tr\u00e1fego p\u00fablico \u00e9 gerado quando as VMs na nuvem acessam a Internet ou prestam servi\u00e7os aos clientes atrav\u00e9s da Internet. Os IPs acess\u00edveis ao p\u00fablico devem ser alocados para essa finalidade. Quando uma inst\u00e2ncia \u00e9 criada, um IP a partir deste conjunto de IPs p\u00fablicos ser\u00e3o destinados \u00e0 inst\u00e2ncia, al\u00e9m do endere\u00e7o IP guest. Um NAT est\u00e1tico 1-1 ser\u00e1 criada automaticamente entre o IP p\u00fablico e IP guest. Os usu\u00e1rios finais tamb\u00e9m podem usar a interface de usu\u00e1rio CloudStack para adquirir IPs adicionais afim de se implementar NAT est\u00e1tico entre suas inst\u00e2ncias e o IP p\u00fablico. +message.redirecting.region=Redirecionando para regi\u00e3o... +message.remove.ldap=Voc\u00ea tem certeza que deseja deletar a configura\u00e7\u00e3o LDAP? +message.remove.region=Voc\u00ea tem certeza que deseja remover esta regi\u00e3o deste servidor de gerenciamento? +>>>>>>> 4e449ff... Add Dutch (Netherlands, Polish languages in Web UI Change Japanese code (ja -> ja_JP) Update transifex sync config message.remove.vpc=Favor confirmar que voc\u00ea deseja remover a VPC message.remove.vpn.access=Confirme se voc\u00ea deseja remover acesso VPN do seguinte Usu\u00e1rio. message.reset.password.warning.notPasswordEnabled=O template desta inst\u00e2ncia foi criado sem senha habilitada diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 85715fd6676..e68b53a8eb9 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -72,6 +72,7 @@ migrateVirtualMachine=1 migrateVirtualMachineWithVolume=1 recoverVirtualMachine=7 expungeVirtualMachine=7 +getVirtualMachineUserData=15 #### snapshot commands createSnapshot=15 diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index 8478b312fce..732d7b4e385 100755 --- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -16,31 +16,6 @@ // under the License. package com.cloud.agent.resource.virtualnetwork; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.InetSocketAddress; -import java.net.URL; -import java.net.URLConnection; -import java.nio.channels.SocketChannel; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - -import com.cloud.agent.api.routing.SetMonitorServiceCommand; -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; - -import com.google.gson.Gson; - import com.cloud.agent.api.Answer; import com.cloud.agent.api.BumpUpPriorityCommand; import com.cloud.agent.api.CheckRouterAnswer; @@ -66,6 +41,7 @@ import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand; import com.cloud.agent.api.routing.SavePasswordCommand; import com.cloud.agent.api.routing.SetFirewallRulesAnswer; import com.cloud.agent.api.routing.SetFirewallRulesCommand; +import com.cloud.agent.api.routing.SetMonitorServiceCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer; import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand; @@ -92,6 +68,24 @@ import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.OutputInterpreter; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SshHelper; +import com.google.gson.Gson; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.InetSocketAddress; +import java.net.URL; +import java.net.URLConnection; +import java.nio.channels.SocketChannel; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * VirtualNetworkResource controls and configures virtual networking @@ -105,16 +99,9 @@ import com.cloud.utils.ssh.SshHelper; public class VirtualRoutingResource implements Manager { private static final Logger s_logger = Logger.getLogger(VirtualRoutingResource.class); private String _publicIpAddress; - private String _firewallPath; - private String _loadbPath; - private String _dhcpEntryPath; private String _publicEthIf; private String _privateEthIf; - private String _bumpUpPriorityPath; private String _routerProxyPath; - private String _createIpAliasPath; - private String _deleteIpAliasPath; - private String _callDnsMasqPath; private int _timeout; private int _startTimeout; @@ -240,18 +227,16 @@ public class VirtualRoutingResource implements Manager { FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); String[][] rules = cmd.generateFwRules(); - final Script command = new Script(_firewallPath, _timeout, s_logger); - command.add(routerIp); - command.add("-F"); + String args = " -F"; if (trafficType == FirewallRule.TrafficType.Egress) { - command.add("-E"); + args += "-E"; if (egressDefault.equals("true")) { - command.add("-P ", "1"); + args += " -P 1"; } else if (egressDefault.equals("System")) { - command.add("-P ", "2"); + args += " -P 2"; } else { - command.add("-P ", "0"); + args += " -P 0"; } } @@ -261,10 +246,17 @@ public class VirtualRoutingResource implements Manager { for (int i = 0; i < fwRules.length; i++) { sb.append(fwRules[i]).append(','); } - command.add("-a", sb.toString()); + args += " -a " + sb.toString(); + } + + String result = null; + + if (trafficType == FirewallRule.TrafficType.Egress) { + result = routerProxy("firewall_egress.sh", routerIp, args); + } else { + result = routerProxy("firewall_ingress.sh", routerIp, args); } - String result = command.execute(); if (result != null) { return new SetFirewallRulesAnswer(cmd, false, results); } @@ -278,22 +270,21 @@ public class VirtualRoutingResource implements Manager { int i = 0; boolean endResult = true; for (PortForwardingRuleTO rule : cmd.getRules()) { - String result = null; - final Script command = new Script(_firewallPath, _timeout, s_logger); + StringBuilder args = new StringBuilder(); + args.append(rule.revoked() ? " -D " : " -A "); + args.append(" -P ").append(rule.getProtocol().toLowerCase()); + args.append(" -l ").append(rule.getSrcIp()); + args.append(" -p ").append(rule.getStringSrcPortRange()); + args.append(" -r ").append(rule.getDstIp()); + args.append(" -d ").append(rule.getStringDstPortRange()); - command.add(routerIp); - command.add(rule.revoked() ? "-D" : "-A"); - command.add("-P ", rule.getProtocol().toLowerCase()); - command.add("-l ", rule.getSrcIp()); - command.add("-p ", rule.getStringSrcPortRange()); - command.add("-r ", rule.getDstIp()); - command.add("-d ", rule.getStringDstPortRange()); - result = command.execute(); - if (result == null) { - results[i++] = null; - } else { + String result = routerProxy("firewall_nat.sh", routerIp, args.toString()); + + if (result == null || result.isEmpty()) { results[i++] = "Failed"; endResult = false; + } else { + results[i++] = null; } } @@ -333,35 +324,46 @@ public class VirtualRoutingResource implements Manager { int i = 0; boolean endResult = true; for (StaticNatRuleTO rule : cmd.getRules()) { - String result = null; - final Script command = new Script(_firewallPath, _timeout, s_logger); - command.add(routerIp); - command.add(rule.revoked() ? "-D" : "-A"); - //1:1 NAT needs instanceip;publicip;domrip;op - command.add(" -l ", rule.getSrcIp()); - command.add(" -r ", rule.getDstIp()); + StringBuilder args = new StringBuilder(); + args.append(rule.revoked() ? " -D " : " -A "); + args.append(" -l ").append(rule.getSrcIp()); + args.append(" -r ").append(rule.getDstIp()); if (rule.getProtocol() != null) { - command.add(" -P ", rule.getProtocol().toLowerCase()); + args.append(" -P ").append(rule.getProtocol().toLowerCase()); } - command.add(" -d ", rule.getStringSrcPortRange()); - command.add(" -G "); + args.append(" -d ").append(rule.getStringSrcPortRange()); + args.append(" -G "); - result = command.execute(); - if (result == null) { - results[i++] = null; - } else { + String result = routerProxy("firewall_nat.sh", routerIp, args.toString()); + + if (result == null || result.isEmpty()) { results[i++] = "Failed"; endResult = false; + } else { + results[i++] = null; } } return new SetStaticNatRulesAnswer(cmd, results, endResult); } - protected Answer VPCLoadBalancerConfig(final LoadBalancerConfigCommand cmd) { + protected boolean createFileInVR(String routerIp, String path, String filename, String content) { + File permKey = new File("/root/.ssh/id_rsa.cloud"); + boolean result = true; + + try { + SshHelper.scpTo(routerIp, 3922, "root", permKey, null, path, content.getBytes(), filename, null); + } catch (Exception e) { + s_logger.warn("Fail to create file " + path + filename + " in VR " + routerIp, e); + result = false; + } + return result; + } + + private Answer execute(LoadBalancerConfigCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); if (routerIp == null) { @@ -375,25 +377,24 @@ public class VirtualRoutingResource implements Manager { tmpCfgFileContents += config[i]; tmpCfgFileContents += "\n"; } - File permKey = new File("/root/.ssh/id_rsa.cloud"); + + if (!createFileInVR(routerIp, "/etc/haproxy/", "haproxy.cfg.new", tmpCfgFileContents)) { + return new Answer(cmd, false, "Fail to copy LB config file to VR"); + } try { - SshHelper.scpTo(routerIp, 3922, "root", permKey, null, "/etc/haproxy/", tmpCfgFileContents.getBytes(), "haproxy.cfg.new", null); - String[][] rules = cfgtr.generateFwRules(cmd); String[] addRules = rules[LoadBalancerConfigurator.ADD]; String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; String[] statRules = rules[LoadBalancerConfigurator.STATS]; - String ip = cmd.getNic().getIp(); - String args = " -i " + ip; + String args = ""; StringBuilder sb = new StringBuilder(); if (addRules.length > 0) { for (int i = 0; i < addRules.length; i++) { sb.append(addRules[i]).append(','); } - args += " -a " + sb.toString(); } @@ -415,7 +416,15 @@ public class VirtualRoutingResource implements Manager { args += " -s " + sb.toString(); } - String result = routerProxy("vpc_loadbalancer.sh", routerIp, args); + String result; + + if (cmd.getVpcId() == null) { + args = " -i " + routerIp + args; + result = routerProxy("loadbalancer.sh", routerIp, args); + } else { + args = " -i " + cmd.getNic().getIp() + args; + result = routerProxy("vpc_loadbalancer.sh", routerIp, args); + } if (result != null) { return new Answer(cmd, false, "LoadBalancerConfigCommand failed"); @@ -427,41 +436,6 @@ public class VirtualRoutingResource implements Manager { } } - private Answer execute(LoadBalancerConfigCommand cmd) { - if (cmd.getVpcId() != null) { - return VPCLoadBalancerConfig(cmd); - } - - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - File tmpCfgFile = null; - try { - String cfgFilePath = ""; - LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); - String[] config = cfgtr.generateConfiguration(cmd); - String[][] rules = cfgtr.generateFwRules(cmd); - if (routerIp != null) { - tmpCfgFile = File.createTempFile(routerIp.replace('.', '_'), "cfg"); - final PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile))); - for (int i = 0; i < config.length; i++) { - out.println(config[i]); - } - out.close(); - cfgFilePath = tmpCfgFile.getAbsolutePath(); - } - - final String result = - setLoadBalancerConfig(cfgFilePath, rules[LoadBalancerConfigurator.ADD], rules[LoadBalancerConfigurator.REMOVE], rules[LoadBalancerConfigurator.STATS], - routerIp); - - return new Answer(cmd, result == null, result); - } catch (final IOException e) { - return new Answer(cmd, false, e.getMessage()); - } finally { - if (tmpCfgFile != null) { - tmpCfgFile.delete(); - } - } - } protected Answer execute(VmDataCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); @@ -503,50 +477,10 @@ public class VirtualRoutingResource implements Manager { return new IpAssocAnswer(cmd, results); } - private String setLoadBalancerConfig(final String cfgFile, final String[] addRules, final String[] removeRules, final String[] statsRules, String routerIp) { - - if (routerIp == null) { - routerIp = "none"; - } - - final Script command = new Script(_loadbPath, _timeout, s_logger); - - command.add("-i", routerIp); - command.add("-f", cfgFile); - - StringBuilder sb = new StringBuilder(); - if (addRules.length > 0) { - for (int i = 0; i < addRules.length; i++) { - sb.append(addRules[i]).append(','); - } - command.add("-a", sb.toString()); - } - - sb = new StringBuilder(); - if (removeRules.length > 0) { - for (int i = 0; i < removeRules.length; i++) { - sb.append(removeRules[i]).append(','); - } - command.add("-d", sb.toString()); - } - - sb = new StringBuilder(); - if (statsRules.length > 0) { - for (int i = 0; i < statsRules.length; i++) { - sb.append(statsRules[i]).append(','); - } - command.add("-s", sb.toString()); - } - - return command.execute(); - } - protected Answer execute(final SavePasswordCommand cmd) { final String password = cmd.getPassword(); final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - final String vmName = cmd.getVmName(); final String vmIpAddress = cmd.getVmIpAddress(); - final String local = vmName; String args = "-v " + vmIpAddress; args += " -p " + password; @@ -559,57 +493,51 @@ public class VirtualRoutingResource implements Manager { } protected Answer execute(final DhcpEntryCommand cmd) { - final Script command = new Script(_dhcpEntryPath, _timeout, s_logger); - command.add("-r", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP)); + String args = " -m " + cmd.getVmMac(); if (cmd.getVmIpAddress() != null) { - command.add("-v", cmd.getVmIpAddress()); + args += " -4 " + cmd.getVmIpAddress(); } - command.add("-m", cmd.getVmMac()); - command.add("-n", cmd.getVmName()); + args += " -h " + cmd.getVmName(); if (cmd.getDefaultRouter() != null) { - command.add("-d", cmd.getDefaultRouter()); - } - if (cmd.getStaticRoutes() != null) { - command.add("-s", cmd.getStaticRoutes()); + args += " -d " + cmd.getDefaultRouter(); } if (cmd.getDefaultDns() != null) { - command.add("-N", cmd.getDefaultDns()); + args += " -n " + cmd.getDefaultDns(); + } + + if (cmd.getStaticRoutes() != null) { + args += " -s " + cmd.getStaticRoutes(); } if (cmd.getVmIp6Address() != null) { - command.add("-6", cmd.getVmIp6Address()); - command.add("-u", cmd.getDuid()); + args += " -6 " + cmd.getVmIp6Address(); + args += " -u " + cmd.getDuid(); } if (!cmd.isDefault()) { - command.add("-z"); + args += " -N"; } - final String result = command.execute(); + final String result = routerProxy("edithosts.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); return new Answer(cmd, result == null, result); } protected Answer execute(final CreateIpAliasCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - final Script command = new Script(_createIpAliasPath, _timeout, s_logger); List ipAliasTOs = cmd.getIpAliasList(); String args = ""; - command.add(routerIp); for (IpAliasTO ipaliasto : ipAliasTOs) { args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; } - command.add(args); - final String result = command.execute(); + final String result = routerProxy("createipAlias.sh", routerIp, args); return new Answer(cmd, result == null, result); } protected Answer execute(final DeleteIpAliasCommand cmd) { - final Script command = new Script(_deleteIpAliasPath, _timeout, s_logger); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String args = ""; - command.add(routerIp); List revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; @@ -619,22 +547,18 @@ public class VirtualRoutingResource implements Manager { for (IpAliasTO ipAliasTO : activeIpAliasTOs) { args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; } - command.add(args); - final String result = command.execute(); + final String result = routerProxy("deleteipAlias.sh", routerIp, args); return new Answer(cmd, result == null, result); } protected Answer execute(final DnsMasqConfigCommand cmd) { - final Script command = new Script(_callDnsMasqPath, _timeout, s_logger); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); List dhcpTos = cmd.getIps(); String args = ""; for (DhcpTO dhcpTo : dhcpTos) { args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; } - command.add(routerIp); - command.add(args); - final String result = command.execute(); + final String result = routerProxy("dnsmasq.sh", routerIp, args); return new Answer(cmd, result == null, result); } @@ -693,13 +617,9 @@ public class VirtualRoutingResource implements Manager { } protected Answer execute(BumpUpPriorityCommand cmd) { - final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - final Script command = new Script(_bumpUpPriorityPath, _timeout, s_logger); - final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); - command.add(routerPrivateIPAddress); - String result = command.execute(parser); + String result = routerProxy("bumpup_priority.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null); if (result != null) { - return new Answer(cmd, false, "BumpUpPriorityCommand failed: " + result); + return new Answer(cmd, false, "BumpUpPriorityCommand failed due to " + result); } return new Answer(cmd, true, null); } @@ -1127,21 +1047,6 @@ public class VirtualRoutingResource implements Manager { s_logger.warn("Incoming public ip address is overriden. Will always be using the same ip address: " + _publicIpAddress); } - _firewallPath = findScript("call_firewall.sh"); - if (_firewallPath == null) { - throw new ConfigurationException("Unable to find the call_firewall.sh"); - } - - _loadbPath = findScript("call_loadbalancer.sh"); - if (_loadbPath == null) { - throw new ConfigurationException("Unable to find the call_loadbalancer.sh"); - } - - _dhcpEntryPath = findScript("dhcp_entry.sh"); - if (_dhcpEntryPath == null) { - throw new ConfigurationException("Unable to find dhcp_entry.sh"); - } - _publicEthIf = (String)params.get("public.network.device"); if (_publicEthIf == null) { _publicEthIf = "xenbr1"; @@ -1154,28 +1059,10 @@ public class VirtualRoutingResource implements Manager { } _privateEthIf = _privateEthIf.toLowerCase(); - _bumpUpPriorityPath = findScript("bumpUpPriority.sh"); - if (_bumpUpPriorityPath == null) { - throw new ConfigurationException("Unable to find bumpUpPriority.sh"); - } - _routerProxyPath = findScript("router_proxy.sh"); if (_routerProxyPath == null) { throw new ConfigurationException("Unable to find router_proxy.sh"); } - _createIpAliasPath = findScript("createipAlias.sh"); - if (_createIpAliasPath == null) { - throw new ConfigurationException("unable to find createipAlias.sh"); - } - _deleteIpAliasPath = findScript("deleteipAlias.sh"); - if (_deleteIpAliasPath == null) { - throw new ConfigurationException("unable to find deleteipAlias.sh"); - } - _callDnsMasqPath = findScript("call_dnsmasq.sh"); - if (_callDnsMasqPath == null) { - throw new ConfigurationException("unable to find call_dnsmasq.sh"); - } - return true; } diff --git a/core/src/com/cloud/agent/transport/Request.java b/core/src/com/cloud/agent/transport/Request.java index f4ed5c4b6e6..b5890d90451 100755 --- a/core/src/com/cloud/agent/transport/Request.java +++ b/core/src/com/cloud/agent/transport/Request.java @@ -23,6 +23,7 @@ import java.io.StringReader; import java.lang.reflect.Type; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.zip.GZIPInputStream; @@ -49,6 +50,7 @@ import com.cloud.exception.UnsupportedVersionException; import com.cloud.serializer.GsonHelper; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; +import com.cloud.utils.StringUtils; import com.cloud.utils.exception.CloudRuntimeException; /** @@ -436,11 +438,35 @@ public class Request { } buf.append(", Ver: ").append(_ver.toString()); buf.append(", Flags: ").append(Integer.toBinaryString(getFlags())).append(", "); - buf.append(content); + String cleanContent = content.toString(); + if(cleanContent.contains("password")) { + buf.append(cleanPassword(cleanContent)); + } else { + buf.append(content); + } buf.append(" }"); return buf.toString(); } + public static String cleanPassword(String logString) { + String cleanLogString = null; + if (logString != null) { + cleanLogString = logString; + String[] temp = logString.split(","); + int i = 0; + if (temp != null) { + while (i < temp.length) { + temp[i] = StringUtils.cleanString(temp[i]); + i++; + } + List stringList = new ArrayList(); + Collections.addAll(stringList, temp); + cleanLogString = StringUtils.join(stringList, ","); + } + } + return cleanLogString; + } + /** * Factory method for Request and Response. It expects the bytes to be * correctly formed so it's possible that it throws underflow exceptions diff --git a/engine/components-api/src/com/cloud/vm/VmWorkConstants.java b/engine/components-api/src/com/cloud/vm/VmWorkConstants.java index 20e40b7f84b..4627cfe078b 100644 --- a/engine/components-api/src/com/cloud/vm/VmWorkConstants.java +++ b/engine/components-api/src/com/cloud/vm/VmWorkConstants.java @@ -20,4 +20,5 @@ public interface VmWorkConstants { public static final String VM_WORK_QUEUE = "VmWorkJobQueue"; public static final String VM_WORK_JOB_DISPATCHER = "VmWorkJobDispatcher"; public static final String VM_WORK_JOB_WAKEUP_DISPATCHER = "VmWorkJobWakeupDispatcher"; + public static final String VM_WORK_JOB_PLACEHOLDER = "VmWorkJobPlaceHolder"; } diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 9894d31fba9..8fd542b9669 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -492,7 +492,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId(); - if (volumeExpungeCommands != null && hostId != null) { + if (volumeExpungeCommands != null && volumeExpungeCommands.size() > 0 && hostId != null) { Commands cmds = new Commands(Command.OnError.Stop); for (Command volumeExpungeCommand : volumeExpungeCommands) { @@ -561,6 +561,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _executor.scheduleAtFixedRate(new TransitionTask(), 5000, VmJobStateReportInterval.value(), TimeUnit.SECONDS); _executor.scheduleAtFixedRate(new CleanupTask(), VmOpCleanupInterval.value(), VmOpCleanupInterval.value(), TimeUnit.SECONDS); cancelWorkItems(_nodeId); + + // cleanup left over place holder works + _workJobDao.expungeLeftoverWorkJobs(ManagementServerNode.getManagementServerId()); return true; } @@ -751,7 +754,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateStart(vmUuid, params, planToDeploy, planner); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateStart(vmUuid, params, planToDeploy, planner); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy); @@ -1112,6 +1125,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VolumeVO volume = _volsDao.findById(volumeId); disk.setPath(volume.get_iScsiName()); + + if (disk.getData() instanceof VolumeObjectTO) { + VolumeObjectTO volTo = (VolumeObjectTO)disk.getData(); + + volTo.setPath(volume.get_iScsiName()); + } + volume.setPath(volume.get_iScsiName()); _volsDao.update(volumeId, volume); @@ -1122,20 +1142,22 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac // for managed storage on XenServer and VMware, need to update the DB with a path if the VDI/VMDK file was newly created private void handlePath(DiskTO[] disks, Map iqnToPath) { - if (disks != null) { + if (disks != null && iqnToPath != null) { for (DiskTO disk : disks) { Map details = disk.getDetails(); boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED)); - if (isManaged && disk.getPath() == null) { + if (isManaged) { Long volumeId = disk.getData().getId(); VolumeVO volume = _volsDao.findById(volumeId); String iScsiName = volume.get_iScsiName(); String path = iqnToPath.get(iScsiName); - volume.setPath(path); + if (path != null) { + volume.setPath(path); - _volsDao.update(volumeId, volume); + _volsDao.update(volumeId, volume); + } } } } @@ -1273,7 +1295,19 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateStop(vmUuid, cleanUpEvenIfUnableToStop); + + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateStop(vmUuid, cleanUpEvenIfUnableToStop); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } + } else { Outcome outcome = stopVmThroughJobQueue(vmUuid, cleanUpEvenIfUnableToStop); @@ -1565,7 +1599,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateStorageMigration(vmUuid, destPool); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateStorageMigration(vmUuid, destPool); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = migrateVmStorageThroughJobQueue(vmUuid, destPool); @@ -1647,7 +1691,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateMigrate(vmUuid, srcHostId, dest); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateMigrate(vmUuid, srcHostId, dest); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = migrateVmThroughJobQueue(vmUuid, srcHostId, dest); @@ -1918,7 +1972,19 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateMigrateWithStorage(vmUuid, srcHostId, destHostId, volumeToPool); + + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateMigrateWithStorage(vmUuid, srcHostId, destHostId, volumeToPool); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } + } else { Outcome outcome = migrateVmWithStorageThroughJobQueue(vmUuid, srcHostId, destHostId, volumeToPool); @@ -2161,6 +2227,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.trace("VM Operation Thread Running"); try { _workDao.cleanup(VmOpCleanupWait.value()); + + // TODO. hard-coded to one hour after job has been completed + Date cutDate = new Date(new Date().getTime() - 3600000); + _workJobDao.expungeCompletedWorkJobs(cutDate); } catch (Exception e) { s_logger.error("VM Operations failed due to ", e); } @@ -2197,7 +2267,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateReboot(vmUuid, params); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateReboot(vmUuid, params); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = rebootVmThroughJobQueue(vmUuid, params); @@ -2748,7 +2828,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.warn(e.getMessage()); } } - } else if (serverState == State.Stopping) { + } else if (serverState == State.Stopped) { s_logger.debug("Scheduling a stop command for " + vm); _haMgr.scheduleStop(vm, hostId, WorkType.Stop); } else { @@ -3118,7 +3198,16 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - return orchestrateAddVmToNetwork(vm, network, requested); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + return orchestrateAddVmToNetwork(vm, network, requested); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = addVmToNetworkThroughJobQueue(vm, network, requested); @@ -3221,7 +3310,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - return orchestrateRemoveNicFromVm(vm, nic); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + return orchestrateRemoveNicFromVm(vm, nic); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } + } else { Outcome outcome = removeNicFromVmThroughJobQueue(vm, nic); @@ -3460,7 +3559,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - orchestrateMigrateForScale(vmUuid, srcHostId, dest, oldSvcOfferingId); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + orchestrateMigrateForScale(vmUuid, srcHostId, dest, oldSvcOfferingId); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = migrateVmForScaleThroughJobQueue(vmUuid, srcHostId, dest, oldSvcOfferingId); @@ -3709,7 +3818,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { // avoid re-entrance - return orchestrateReConfigureVm(vmUuid, oldServiceOffering, reconfiguringOnExistingHost); + VmWorkJobVO placeHolder = null; + if (VmJobEnabled.value()) { + VirtualMachine vm = _vmDao.findByUuid(vmUuid); + placeHolder = createPlaceHolderWork(vm.getId()); + } + try { + return orchestrateReConfigureVm(vmUuid, oldServiceOffering, reconfiguringOnExistingHost); + } finally { + if (VmJobEnabled.value()) + _workJobDao.expunge(placeHolder.getId()); + } } else { Outcome outcome = reconfigureVmThroughJobQueue(vmUuid, oldServiceOffering, reconfiguringOnExistingHost); @@ -4185,7 +4304,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(callingAccount.getId()); workJob.setUserId(callingUser.getId()); workJob.setStep(VmWorkJobVO.Step.Starting); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4238,7 +4357,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); workJob.setStep(VmWorkJobVO.Step.Prepare); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4291,7 +4410,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); workJob.setStep(VmWorkJobVO.Step.Prepare); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4341,7 +4460,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4395,7 +4514,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4447,7 +4566,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4499,7 +4618,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4549,7 +4668,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4598,7 +4717,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4647,7 +4766,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4698,7 +4817,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac workJob.setAccountId(account.getId()); workJob.setUserId(user.getId()); - workJob.setVmType(vm.getType()); + workJob.setVmType(VirtualMachine.Type.Instance); workJob.setVmInstanceId(vm.getId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); @@ -4854,4 +4973,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac public Pair handleVmWorkJob(VmWork work) throws Exception { return _jobHandlerProxy.handleVmWorkJob(work); } + + private VmWorkJobVO createPlaceHolderWork(long instanceId) { + VmWorkJobVO workJob = new VmWorkJobVO(""); + + workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_PLACEHOLDER); + workJob.setCmd(""); + workJob.setCmdInfo(""); + + workJob.setAccountId(0); + workJob.setUserId(0); + workJob.setStep(VmWorkJobVO.Step.Starting); + workJob.setVmType(VirtualMachine.Type.Instance); + workJob.setVmInstanceId(instanceId); + workJob.setInitMsid(ManagementServerNode.getManagementServerId()); + + _workJobDao.persist(workJob); + + return workJob; + } } diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java index 285c8a2831e..31b2d9ca2d2 100644 --- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java +++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java @@ -60,9 +60,6 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch String cmd = job.getCmd(); assert (cmd != null); - if (s_logger.isDebugEnabled()) - s_logger.debug("Run VM work job: " + cmd + ", job origin: " + job.getRelated()); - Class workClz = null; try { workClz = Class.forName(job.getCmd()); @@ -80,27 +77,33 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch return; } - if (_handlers == null || _handlers.isEmpty()) { - s_logger.error("Invalid startup configuration, no work job handler is found. cmd: " + job.getCmd() + ", job info: " + job.getCmdInfo() - + ", job origin: " + job.getRelated()); - _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, "Invalid startup configuration. no job handler is found"); - return; + if (s_logger.isDebugEnabled()) + s_logger.debug("Run VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); + try { + if (_handlers == null || _handlers.isEmpty()) { + s_logger.error("Invalid startup configuration, no work job handler is found. cmd: " + job.getCmd() + ", job info: " + job.getCmdInfo() + + ", job origin: " + job.getRelated()); + _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, "Invalid startup configuration. no job handler is found"); + return; + } + + VmWorkJobHandler handler = _handlers.get(work.getHandlerName()); + + if (handler == null) { + s_logger.error("Unable to find work job handler. handler name: " + work.getHandlerName() + ", job cmd: " + job.getCmd() + + ", job info: " + job.getCmdInfo() + ", job origin: " + job.getRelated()); + _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, "Unable to find work job handler"); + return; + } + + CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated()); + + Pair result = handler.handleVmWorkJob(work); + _asyncJobMgr.completeAsyncJob(job.getId(), result.first(), 0, result.second()); + } finally { + if (s_logger.isDebugEnabled()) + s_logger.debug("Done with run of VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); } - - VmWorkJobHandler handler = _handlers.get(work.getHandlerName()); - - if (handler == null) { - s_logger.error("Unable to find work job handler. handler name: " + work.getHandlerName() + ", job cmd: " + job.getCmd() - + ", job info: " + job.getCmdInfo() + ", job origin: " + job.getRelated()); - _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, "Unable to find work job handler"); - return; - } - - CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated()); - - Pair result = handler.handleVmWorkJob(work); - _asyncJobMgr.completeAsyncJob(job.getId(), result.first(), 0, result.second()); - } catch(Throwable e) { s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e); diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 0d6d7185320..d51ed191b9d 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -323,6 +323,13 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, null, poolsToAvoid)) != null) { break; } + + if (pool != null) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Found a suitable pool for create volume: " + pool.getId()); + } + break; + } } } @@ -408,6 +415,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati @DB public VolumeInfo createVolume(VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate template, DataCenter dc, Pod pod, Long clusterId, ServiceOffering offering, DiskOffering diskOffering, List avoids, long size, HypervisorType hyperType) { + // update the volume's hypervisor_ss_reserve from its disk offering (used for managed storage) volume = updateHypervisorSnapshotReserveForVolume(diskOffering, volume, hyperType); StoragePool pool = null; @@ -1089,6 +1097,14 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati // retry one more time in case of template reload is required for Vmware case AsyncCallFuture future = null; if (templateId == null) { + DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId()); + HypervisorType hyperType = vm.getVirtualMachine().getHypervisorType(); + + // update the volume's hypervisor_ss_reserve from its disk offering (used for managed storage) + updateHypervisorSnapshotReserveForVolume(diskOffering, volume, hyperType); + + volume = volFactory.getVolume(newVol.getId(), destPool); + future = volService.createVolumeAsync(volume, destPool); } else { TemplateInfo templ = tmplFactory.getTemplate(templateId, DataStoreRole.Image); @@ -1106,6 +1122,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati throw new StorageUnavailableException("Unable to create " + newVol + ":" + result.getResult(), destPool.getId()); } } + + StoragePoolVO storagePool = _storagePoolDao.findById(destPool.getId()); + + if (newVol.getVolumeType() == Type.DATADISK && storagePool.isManaged()) { + long hostId = vm.getVirtualMachine().getHostId(); + Host host = _hostDao.findById(hostId); + + volService.connectVolumeToHost(volFactory.getVolume(newVol.getId()), host, destPool); + } + newVol = _volsDao.findById(newVol.getId()); break; //break out of template-redeploy retry loop } catch (InterruptedException e) { diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java index a933d03c071..82b6d8481a5 100755 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java @@ -27,11 +27,9 @@ import java.sql.SQLException; import java.sql.Types; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.UUID; import org.apache.log4j.Logger; @@ -83,7 +81,6 @@ public class Upgrade410to420 implements DbUpgrade { persistVswitchConfiguration(conn); createPlaceHolderNics(conn); updateRemoteAccessVpn(conn); - updateSystemVmTemplates(conn); updateOverCommitRatioClusterDetails(conn); updatePrimaryStore(conn); addEgressFwRulesForSRXGuestNw(conn); @@ -634,173 +631,6 @@ public class Upgrade410to420 implements DbUpgrade { } - private void updateSystemVmTemplates(Connection conn) { - // TODO: system vm template migration after storage refactoring - PreparedStatement pstmt = null; - ResultSet rs = null; - s_logger.debug("Updating System Vm template IDs"); - try { - //Get all hypervisors in use - Set hypervisorsListInUse = new HashSet(); - try { - pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); - rs = pstmt.executeQuery(); - while (rs.next()) { - switch (HypervisorType.getType(rs.getString(1))) { - case XenServer: - hypervisorsListInUse.add(HypervisorType.XenServer); - break; - case KVM: - hypervisorsListInUse.add(HypervisorType.KVM); - break; - case VMware: - hypervisorsListInUse.add(HypervisorType.VMware); - break; - case Hyperv: - hypervisorsListInUse.add(HypervisorType.Hyperv); - break; - case LXC: - hypervisorsListInUse.add(HypervisorType.LXC); - break; - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("Error while listing hypervisors in use", e); - } - - Map NewTemplateNameList = new HashMap() { - { - put(HypervisorType.XenServer, "systemvm-xenserver-4.2"); - put(HypervisorType.VMware, "systemvm-vmware-4.2"); - put(HypervisorType.KVM, "systemvm-kvm-4.2"); - put(HypervisorType.LXC, "systemvm-lxc-4.2"); - put(HypervisorType.Hyperv, "systemvm-hyperv-4.2"); - } - }; - - Map routerTemplateConfigurationNames = new HashMap() { - { - put(HypervisorType.XenServer, "router.template.xen"); - put(HypervisorType.VMware, "router.template.vmware"); - put(HypervisorType.KVM, "router.template.kvm"); - put(HypervisorType.LXC, "router.template.lxc"); - put(HypervisorType.Hyperv, "router.template.hyperv"); - } - }; - - Map newTemplateUrl = new HashMap() { - { - put(HypervisorType.XenServer, "http://download.cloud.com/templates/4.2/systemvmtemplate-2013-07-12-master-xen.vhd.bz2"); - put(HypervisorType.VMware, "http://download.cloud.com/templates/4.2/systemvmtemplate-4.2-vh7.ova"); - put(HypervisorType.KVM, "http://download.cloud.com/templates/4.2/systemvmtemplate-2013-06-12-master-kvm.qcow2.bz2"); - put(HypervisorType.LXC, "http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2"); - put(HypervisorType.Hyperv, "http://download.cloud.com/templates/4.2/systemvmtemplate-2013-06-12-master-xen.vhd.bz2"); - } - }; - - Map newTemplateChecksum = new HashMap() { - { - put(HypervisorType.XenServer, "fb1b6e032a160d86f2c28feb5add6d83"); - put(HypervisorType.VMware, "8fde62b1089e5844a9cd3b9b953f9596"); - put(HypervisorType.KVM, "6cea42b2633841648040becb588bd8f0"); - put(HypervisorType.LXC, "2755de1f9ef2ce4d6f2bee2efbb4da92"); - put(HypervisorType.Hyperv, "fb1b6e032a160d86f2c28feb5add6d83"); - } - }; - - for (Map.Entry hypervisorAndTemplateName : NewTemplateNameList.entrySet()) { - s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms"); - try { - //Get 4.2.0 system Vm template Id for corresponding hypervisor - pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1"); - pstmt.setString(1, hypervisorAndTemplateName.getValue()); - rs = pstmt.executeQuery(); - if (rs.next()) { - long templateId = rs.getLong(1); - rs.close(); - pstmt.close(); - // Mark the old system templates as removed - pstmt = - conn.prepareStatement("UPDATE `cloud`.`vm_template` SET removed = now() WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null"); - pstmt.setString(1, hypervisorAndTemplateName.getKey().toString()); - pstmt.executeUpdate(); - pstmt.close(); - // change template type to SYSTEM - pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?"); - pstmt.setLong(1, templateId); - pstmt.executeUpdate(); - pstmt.close(); - // update templete ID of system Vms - pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?"); - pstmt.setLong(1, templateId); - pstmt.setString(2, hypervisorAndTemplateName.getKey().toString()); - pstmt.executeUpdate(); - pstmt.close(); - // Change value of global configuration parameter router.template.* for the corresponding hypervisor - pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?"); - pstmt.setString(1, hypervisorAndTemplateName.getValue()); - pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey())); - pstmt.executeUpdate(); - pstmt.close(); - } else { - if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) { - throw new CloudRuntimeException("4.2.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms"); - } else { - s_logger.warn("4.2.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + - " hypervisor is not used, so not failing upgrade"); - // Update the latest template URLs for corresponding hypervisor - pstmt = - conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1"); - pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey())); - pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey())); - pstmt.setString(3, hypervisorAndTemplateName.getKey().toString()); - pstmt.executeUpdate(); - pstmt.close(); - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("Error while updating " + hypervisorAndTemplateName.getKey() + " systemVm template", e); - } - } - try { - pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` set dynamically_scalable = 1 where name = ? and type = 'SYSTEM'"); - pstmt.setString(1, NewTemplateNameList.get(HypervisorType.VMware)); - pstmt.executeUpdate(); - pstmt.close(); - } catch (SQLException e) { - throw new CloudRuntimeException("Error while updating dynamically_scalable flag to 1 for SYSTEM template systemvm-vmware-4.2"); - } - s_logger.debug("Updating System Vm Template IDs Complete"); - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (pstmt != null) { - pstmt.close(); - } - } catch (SQLException e) { - } - } - /* - pstmt = null; - try { - pstmt = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'"); - pstmt.executeUpdate(); - } catch (SQLException e) { - throw new CloudRuntimeException("Failed to upgrade vm template data store uuid: " + e.toString()); - } finally { - if (pstmt != null) { - try { - pstmt.close(); - } catch (SQLException e) { - } - } - } - */ - } - //KVM snapshot flag: only turn on if Customers is using snapshot; private void setKVMSnapshotFlag(Connection conn) { s_logger.debug("Verify and set the KVM snapshot flag if snapshot was used. "); diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java index 9702792bb5b..7e26132d9e0 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java @@ -24,10 +24,15 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; @@ -63,7 +68,9 @@ public class Upgrade421to430 implements DbUpgrade { @Override public void performDataMigration(Connection conn) { encryptLdapConfigParams(conn); + encryptImageStoreDetails(conn); upgradeMemoryOfSsvmOffering(conn); + updateSystemVmTemplates(conn); } private void upgradeMemoryOfSsvmOffering(Connection conn) { @@ -183,6 +190,174 @@ public class Upgrade421to430 implements DbUpgrade { } + private void updateSystemVmTemplates(Connection conn) { + PreparedStatement pstmt = null; + ResultSet rs = null; + s_logger.debug("Updating System Vm template IDs"); + try{ + //Get all hypervisors in use + Set hypervisorsListInUse = new HashSet(); + try { + pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); + rs = pstmt.executeQuery(); + while(rs.next()){ + switch (Hypervisor.HypervisorType.getType(rs.getString(1))) { + case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer); + break; + case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM); + break; + case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware); + break; + case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv); + break; + case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC); + break; + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Error while listing hypervisors in use", e); + } + + Map NewTemplateNameList = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.3"); + put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.3"); + put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.3"); + put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.3"); + put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.3"); + } + }; + + Map routerTemplateConfigurationNames = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "router.template.xen"); + put(Hypervisor.HypervisorType.VMware, "router.template.vmware"); + put(Hypervisor.HypervisorType.KVM, "router.template.kvm"); + put(Hypervisor.HypervisorType.LXC, "router.template.lxc"); + put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv"); + } + }; + + Map newTemplateUrl = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-xen.vhd.bz2"); + put(Hypervisor.HypervisorType.VMware, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-vmware.ova"); + put(Hypervisor.HypervisorType.KVM, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2"); + put(Hypervisor.HypervisorType.LXC, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2"); + put(Hypervisor.HypervisorType.Hyperv, "http://download.cloud.com/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2"); + } + }; + + Map newTemplateChecksum = new HashMap(){ + { put(Hypervisor.HypervisorType.XenServer, "74b92f031cc5c2089ee89efb81344dcf"); + put(Hypervisor.HypervisorType.VMware, "ef593a061f3b7594ab0bfd9b0ed0a0d4"); + put(Hypervisor.HypervisorType.KVM, "85a1bed07bf43cbf022451cb2ecae4ff"); + put(Hypervisor.HypervisorType.LXC, "85a1bed07bf43cbf022451cb2ecae4ff"); + put(Hypervisor.HypervisorType.Hyperv, "5df45ee6ebe1b703a8805f4e1f4d0818"); + } + }; + + for (Map.Entry hypervisorAndTemplateName : NewTemplateNameList.entrySet()){ + s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms"); + try { + //Get 4.3.0 system Vm template Id for corresponding hypervisor + pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1"); + pstmt.setString(1, hypervisorAndTemplateName.getValue()); + rs = pstmt.executeQuery(); + if(rs.next()){ + long templateId = rs.getLong(1); + rs.close(); + pstmt.close(); +// // Mark the old system templates as removed +// pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET removed = now() WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null"); +// pstmt.setString(1, hypervisorAndTemplateName.getKey().toString()); +// pstmt.executeUpdate(); +// pstmt.close(); + // change template type to SYSTEM + pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?"); + pstmt.setLong(1, templateId); + pstmt.executeUpdate(); + pstmt.close(); + // update templete ID of system Vms + pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?"); + pstmt.setLong(1, templateId); + pstmt.setString(2, hypervisorAndTemplateName.getKey().toString()); + pstmt.executeUpdate(); + pstmt.close(); + // Change value of global configuration parameter router.template.* for the corresponding hypervisor + pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?"); + pstmt.setString(1, hypervisorAndTemplateName.getValue()); + pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey())); + pstmt.executeUpdate(); + pstmt.close(); + } else { + if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){ + throw new CloudRuntimeException("4.3.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms"); + } else { + s_logger.warn("4.3.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade"); + // Update the latest template URLs for corresponding hypervisor + pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1"); + pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey())); + pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey())); + pstmt.setString(3, hypervisorAndTemplateName.getKey().toString()); + pstmt.executeUpdate(); + pstmt.close(); + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Error while updating "+ hypervisorAndTemplateName.getKey() +" systemVm template", e); + } + } + s_logger.debug("Updating System Vm Template IDs Complete"); + } finally { + try { + if (rs != null) { + rs.close(); + } + + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + } + + private void encryptImageStoreDetails(Connection conn) { + s_logger.debug("Encrypting image store details"); + PreparedStatement pstmt = null; + ResultSet rs = null; + try { + pstmt = conn.prepareStatement("select id, value from `cloud`.`image_store_details` where name = 'key' or name = 'secretkey'"); + rs = pstmt.executeQuery(); + while (rs.next()) { + long id = rs.getLong(1); + String value = rs.getString(2); + if (value == null) { + continue; + } + String encryptedValue = DBEncryptionUtil.encrypt(value); + pstmt = conn.prepareStatement("update `cloud`.`image_store_details` set value=? where id=?"); + pstmt.setBytes(1, encryptedValue.getBytes("UTF-8")); + pstmt.setLong(2, id); + pstmt.executeUpdate(); + } + } catch (SQLException e) { + throw new CloudRuntimeException("Unable encrypt image_store_details values ", e); + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Unable encrypt image_store_details values ", e); + } finally { + try { + if (rs != null) { + rs.close(); + } + + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + s_logger.debug("Done encrypting image_store_details"); + } + @Override public File[] getCleanupScripts() { String script = Script.findScript("", "db/schema-421to430-cleanup.sql"); diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java index c9be8a777df..3158905b876 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java @@ -25,6 +25,7 @@ import java.sql.SQLException; import org.apache.log4j.Logger; +import com.cloud.network.Network; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; @@ -59,6 +60,7 @@ public class Upgrade430to440 implements DbUpgrade { @Override public void performDataMigration(Connection conn) { populateACLGroupAccountMap(conn); + secondaryIpsAccountAndDomainIdsUpdate(conn); } // populate acl_group_account_map table for existing accounts @@ -106,6 +108,167 @@ public class Upgrade430to440 implements DbUpgrade { s_logger.debug("Completed populate acl_group_account_map for existing accounts."); } + + + private void secondaryIpsAccountAndDomainIdsUpdate(Connection conn) { + PreparedStatement pstmt = null; + PreparedStatement pstmtVm = null; + PreparedStatement pstmtNw = null; + PreparedStatement pstmtUpdate = null; + + ResultSet rs1 = null; + ResultSet vmRs = null; + ResultSet networkRs = null; + + String secondIpsSql = "SELECT id, vmId, network_id, account_id, domain_id, ip4_address FROM `cloud`.`nic_secondary_ips`"; + + try { + pstmt = conn.prepareStatement(secondIpsSql); + rs1 = pstmt.executeQuery(); + + while(rs1.next()) { + long ipId = rs1.getLong(1); + long vmId = rs1.getLong(2); + long networkId = rs1.getLong(3); + long accountId = rs1.getLong(4); + long domainId = rs1.getLong(5); + String ipAddr = rs1.getString(6); + + pstmtVm = conn.prepareStatement("SELECT account_id, domain_id FROM `cloud`.`vm_instance` where id = ?"); + pstmtVm.setLong(1,vmId); + + vmRs = pstmtVm.executeQuery(); + + if (vmRs.next()) { + long vmAccountId = vmRs.getLong(1); + long vmDomainId = vmRs.getLong(2); + + if (vmAccountId != accountId && vmAccountId != domainId) { + // update the secondary ip accountid and domainid to vm accountid domainid + // check the network type. If network is shared accountid doaminid needs to be updated in + // in both nic_secondary_ips table and user_ip_address table + + pstmtUpdate = conn.prepareStatement("UPDATE `cloud`.`nic_secondary_ips` SET account_id = ?, domain_id= ? WHERE id = ?"); + pstmtUpdate.setLong(1, vmAccountId); + pstmtUpdate.setLong(2,vmDomainId); + pstmtUpdate.setLong(3,ipId); + pstmtUpdate.executeUpdate(); + pstmtUpdate.close(); + + pstmtNw = conn.prepareStatement("SELECT guest_type FROM `cloud`.`networks` where id = ?"); + pstmtNw.setLong(1,networkId); + + networkRs = pstmtNw.executeQuery(); + if (networkRs.next()) { + String guesttype = networkRs.getString(1); + + if (guesttype == Network.GuestType.Shared.toString()) { + pstmtUpdate = conn.prepareStatement("UPDATE `cloud`.`user_ip_address` SET account_id = ?, domain_id= ? WHERE public_ip_address = ?"); + pstmtUpdate.setLong(1,vmAccountId); + pstmtUpdate.setLong(2,vmDomainId); + pstmtUpdate.setString(3,ipAddr); + pstmtUpdate.executeUpdate(); + pstmtUpdate.close(); + + } + } + + + if (networkRs != null) { + try { + networkRs.close(); + } catch (SQLException e) { + } + } + + + if (pstmtNw != null) { + try { + pstmtNw.close(); + + } catch (SQLException e) { + } + } + + } + } //if + + + if (vmRs != null) { + try { + vmRs.close(); + } catch (SQLException e) { + } + } + + if (networkRs != null) { + try { + networkRs.close(); + } catch (SQLException e) { + } + } + + + } // while + + + } catch (SQLException e) { + throw new CloudRuntimeException("Exception while Moving private zone information to dedicated resources", e); + } finally { + + if (pstmt != null) { + try { + pstmt.close(); + + } catch (SQLException e) { + } + } + + + if (pstmtVm != null) { + try { + pstmtVm.close(); + } catch (SQLException e) { + } + } + + + if (pstmtNw != null) { + try { + pstmtNw.close(); + + } catch (SQLException e) { + } + } + + if (rs1 != null) { + try { + rs1.close(); + } catch (SQLException e) { + } + } + + if (vmRs != null) { + try { + vmRs.close(); + } catch (SQLException e) { + } + } + + if (networkRs != null) { + try { + networkRs.close(); + } catch (SQLException e) { + } + } + } + s_logger.debug("Done updating vm nic secondary ip account and domain ids"); + } + + + + + @Override public File[] getCleanupScripts() { String script = Script.findScript("", "db/schema-430to440-cleanup.sql"); diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java index bf5d646ef02..a4c423c861b 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java @@ -26,6 +26,7 @@ import javax.inject.Inject; import org.springframework.stereotype.Component; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailVO; @@ -35,6 +36,7 @@ import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; import com.cloud.storage.DataStoreRole; import com.cloud.storage.ScopeType; +import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; @Component @@ -104,7 +106,12 @@ public class ImageStoreHelper { ImageStoreDetailVO detail = new ImageStoreDetailVO(); detail.setStoreId(store.getId()); detail.setName(key); - detail.setValue(details.get(key)); + String value = details.get(key); + // encrypt swift key or s3 secret key + if (key.equals(ApiConstants.KEY) || key.equals(ApiConstants.S3_SECRET_KEY)) { + value = DBEncryptionUtil.encrypt(value); + } + detail.setValue(value); imageStoreDetailsDao.persist(detail); } } diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java index 659a14894c6..56feb26e6bc 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java @@ -24,9 +24,11 @@ import javax.ejb.Local; import org.springframework.stereotype.Component; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailVO; import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; +import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; @@ -68,7 +70,12 @@ public class ImageStoreDetailsDaoImpl extends GenericDaoBase details = listBy(sc); Map detailsMap = new HashMap(); for (ImageStoreDetailVO detail : details) { - detailsMap.put(detail.getName(), detail.getValue()); + String name = detail.getName(); + String value = detail.getValue(); + if (name.equals(ApiConstants.KEY) || name.equals(ApiConstants.S3_SECRET_KEY)) { + value = DBEncryptionUtil.decrypt(value); + } + detailsMap.put(name, value); } return detailsMap; diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java index ac507cf4629..3e5a5466fd0 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java @@ -158,8 +158,9 @@ public class VolumeServiceImpl implements VolumeService { return null; } + @Override public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { - DataStoreDriver dataStoreDriver = dataStore.getDriver(); + DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null; if (dataStoreDriver instanceof PrimaryDataStoreDriver) { return ((PrimaryDataStoreDriver)dataStoreDriver).connectVolumeToHost(volumeInfo, host, dataStore); @@ -168,8 +169,9 @@ public class VolumeServiceImpl implements VolumeService { return false; } + @Override public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { - DataStoreDriver dataStoreDriver = dataStore.getDriver(); + DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null; if (dataStoreDriver instanceof PrimaryDataStoreDriver) { ((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore); diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManager.java b/framework/cluster/src/com/cloud/cluster/ClusterManager.java index f59e63cc52c..ffdf3663f7b 100644 --- a/framework/cluster/src/com/cloud/cluster/ClusterManager.java +++ b/framework/cluster/src/com/cloud/cluster/ClusterManager.java @@ -26,7 +26,6 @@ public interface ClusterManager extends Manager { "Interval to check for the heart beat between management server nodes", false); final ConfigKey HeartbeatThreshold = new ConfigKey(Integer.class, "cluster.heartbeat.threshold", "management-server", "150000", "Threshold before self-fence the management server", true); - final ConfigKey ManagementHostIPAdr = new ConfigKey("Advanced", String.class, "host", "localhost", "The ip address of management server", true); void OnReceiveClusterServicePdu(ClusterServicePdu pdu); diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java index ca0b031a5c2..622aa62f073 100644 --- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java +++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java @@ -1099,7 +1099,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] {HeartbeatInterval, HeartbeatThreshold, ManagementHostIPAdr}; + return new ConfigKey[] {HeartbeatInterval, HeartbeatThreshold}; } private boolean pingManagementNode(ManagementServerHostVO mshost) { diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java index 50e9d898a50..1ed37ab9969 100644 --- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java +++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java @@ -29,4 +29,6 @@ public interface ConfigDepot { Set> getConfigListByScope(String scope); void set(ConfigKey key, T value); + + void createOrUpdateConfigObject(String componentName, ConfigKey key, String value); } diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java index 929b299be7c..c1ab6b89101 100644 --- a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java +++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java @@ -27,15 +27,14 @@ import java.util.Set; import javax.annotation.PostConstruct; import javax.inject.Inject; -import org.apache.commons.lang.ObjectUtils; -import org.apache.log4j.Logger; - import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigDepotAdmin; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.ScopedConfigStorage; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.commons.lang.ObjectUtils; +import org.apache.log4j.Logger; import com.cloud.utils.Pair; import com.cloud.utils.exception.CloudRuntimeException; @@ -116,23 +115,8 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin { } _allKeys.put(key.key(), new Pair>(configurable.getConfigComponentName(), key)); - ConfigurationVO vo = _configDao.findById(key.key()); - if (vo == null) { - vo = new ConfigurationVO(configurable.getConfigComponentName(), key); - vo.setUpdated(date); - _configDao.persist(vo); - } else { - if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || - !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) || - !ObjectUtils.equals(vo.getScope(), key.scope().toString())) { - vo.setDynamic(key.isDynamic()); - vo.setDescription(key.description()); - vo.setDefaultValue(key.defaultValue()); - vo.setScope(key.scope().toString()); - vo.setUpdated(date); - _configDao.persist(vo); - } - } + createOrupdateConfigObject(date, configurable.getConfigComponentName(), key, null); + if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global)) { Set> currentConfigs = _scopeLevelConfigsMap.get(key.scope()); currentConfigs.add(key); @@ -142,6 +126,28 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin { _configured.add(configurable); } + private void createOrupdateConfigObject(Date date, String componentName, ConfigKey key, String value) { + ConfigurationVO vo = _configDao.findById(key.key()); + if (vo == null) { + vo = new ConfigurationVO(componentName, key); + vo.setUpdated(date); + if (value != null) { + vo.setValue(value); + } + _configDao.persist(vo); + } else { + if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) + || !ObjectUtils.equals(vo.getScope(), key.scope().toString())) { + vo.setDynamic(key.isDynamic()); + vo.setDescription(key.description()); + vo.setDefaultValue(key.defaultValue()); + vo.setScope(key.scope().toString()); + vo.setUpdated(date); + _configDao.persist(vo); + } + } + } + @Override public void populateConfiguration(Configurable configurable) { populateConfiguration(new Date(), configurable); @@ -193,4 +199,10 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin { public void set(ConfigKey key, T value) { _configDao.update(key.key(), value.toString()); } + + @Override + public void createOrUpdateConfigObject(String componentName, ConfigKey key, String value) { + createOrupdateConfigObject(new Date(), componentName, key, value); + + } } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java index f558e013712..20125f43e66 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java @@ -30,7 +30,9 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; -public class AsyncJobExecutionContext { +public class AsyncJobExecutionContext { + private static final Logger s_logger = Logger.getLogger(AsyncJobExecutionContext.class); + private AsyncJob _job; static private AsyncJobManager s_jobMgr; @@ -112,7 +114,8 @@ public class AsyncJobExecutionContext { } // - // check failure exception before we disjoin the worker job + // check failure exception before we disjoin the worker job, work job usually fails with exception + // this will help propogate exception between jobs // TODO : it is ugly and this will become unnecessary after we switch to full-async mode // public void disjoinJob(long joinedJobId) throws InsufficientCapacityException, @@ -120,21 +123,34 @@ public class AsyncJobExecutionContext { assert (_job != null); AsyncJobJoinMapVO record = s_joinMapDao.getJoinRecord(_job.getId(), joinedJobId); - if (record.getJoinStatus() == JobInfo.Status.FAILED && record.getJoinResult() != null) { - Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult()); - if (exception != null && exception instanceof Exception) { - if (exception instanceof InsufficientCapacityException) - throw (InsufficientCapacityException)exception; - else if (exception instanceof ConcurrentOperationException) - throw (ConcurrentOperationException)exception; - else if (exception instanceof ResourceUnavailableException) - throw (ResourceUnavailableException)exception; - else - throw new RuntimeException((Exception)exception); + s_jobMgr.disjoinJob(_job.getId(), joinedJobId); + + if (record.getJoinStatus() == JobInfo.Status.FAILED) { + if (record.getJoinResult() != null) { + Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult()); + if (exception != null && exception instanceof Exception) { + if (exception instanceof InsufficientCapacityException) { + s_logger.error("Job " + joinedJobId + " failed with InsufficientCapacityException"); + throw (InsufficientCapacityException)exception; + } + else if (exception instanceof ConcurrentOperationException) { + s_logger.error("Job " + joinedJobId + " failed with ConcurrentOperationException"); + throw (ConcurrentOperationException)exception; + } + else if (exception instanceof ResourceUnavailableException) { + s_logger.error("Job " + joinedJobId + " failed with ResourceUnavailableException"); + throw (ResourceUnavailableException)exception; + } + else { + s_logger.error("Job " + joinedJobId + " failed with exception"); + throw new RuntimeException((Exception)exception); + } + } + } else { + s_logger.error("Job " + joinedJobId + " failed without providing an error object"); + throw new RuntimeException("Job " + joinedJobId + " failed without providing an error object"); } } - - s_jobMgr.disjoinJob(_job.getId(), joinedJobId); } public void completeJoin(JobInfo.Status joinStatus, String joinResult) { @@ -151,6 +167,8 @@ public class AsyncJobExecutionContext { public static AsyncJobExecutionContext getCurrentExecutionContext() { AsyncJobExecutionContext context = s_currentExectionContext.get(); if (context == null) { + // TODO, this has security implicitions + s_logger.warn("Job is executed without a context, setup psudo job for the executing thread"); context = registerPseudoExecutionContext(CallContext.current().getCallingAccountId(), CallContext.current().getCallingUserId()); } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDao.java index a3dbddf0eb6..44e39e40291 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDao.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDao.java @@ -35,4 +35,6 @@ public interface VmWorkJobDao extends GenericDao { void updateStep(long workJobId, Step step); void expungeCompletedWorkJobs(Date cutDate); + + void expungeLeftoverWorkJobs(long msid); } diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java index 5e0ffb68c39..cf3e17392b5 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java @@ -16,8 +16,11 @@ // under the License. package org.apache.cloudstack.framework.jobs.dao; +import java.sql.PreparedStatement; +import java.sql.SQLException; import java.util.Date; import java.util.List; +import java.util.TimeZone; import javax.annotation.PostConstruct; @@ -31,13 +34,16 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.TransactionCallbackNoReturn; +import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.db.TransactionStatus; import com.cloud.vm.VirtualMachine; public class VmWorkJobDaoImpl extends GenericDaoBase implements VmWorkJobDao { protected SearchBuilder PendingWorkJobSearch; protected SearchBuilder PendingWorkJobByCommandSearch; - protected SearchBuilder ExpungeWorkJobSearch; public VmWorkJobDaoImpl() { } @@ -48,7 +54,6 @@ public class VmWorkJobDaoImpl extends GenericDaoBase implemen PendingWorkJobSearch.and("jobStatus", PendingWorkJobSearch.entity().getStatus(), Op.EQ); PendingWorkJobSearch.and("vmType", PendingWorkJobSearch.entity().getVmType(), Op.EQ); PendingWorkJobSearch.and("vmInstanceId", PendingWorkJobSearch.entity().getVmInstanceId(), Op.EQ); - PendingWorkJobSearch.and("step", PendingWorkJobSearch.entity().getStep(), Op.NEQ); PendingWorkJobSearch.done(); PendingWorkJobByCommandSearch = createSearchBuilder(); @@ -58,11 +63,6 @@ public class VmWorkJobDaoImpl extends GenericDaoBase implemen PendingWorkJobByCommandSearch.and("step", PendingWorkJobByCommandSearch.entity().getStep(), Op.NEQ); PendingWorkJobByCommandSearch.and("cmd", PendingWorkJobByCommandSearch.entity().getCmd(), Op.EQ); PendingWorkJobByCommandSearch.done(); - - ExpungeWorkJobSearch = createSearchBuilder(); - ExpungeWorkJobSearch.and("lastUpdated", ExpungeWorkJobSearch.entity().getLastUpdated(), Op.LT); - ExpungeWorkJobSearch.and("jobStatus", ExpungeWorkJobSearch.entity().getStatus(), Op.NEQ); - ExpungeWorkJobSearch.done(); } @Override @@ -115,11 +115,80 @@ public class VmWorkJobDaoImpl extends GenericDaoBase implemen } @Override - public void expungeCompletedWorkJobs(Date cutDate) { - SearchCriteria sc = ExpungeWorkJobSearch.create(); - sc.setParameters("lastUpdated", cutDate); - sc.setParameters("jobStatus", JobInfo.Status.IN_PROGRESS); + public void expungeCompletedWorkJobs(final Date cutDate) { + // current DAO machenism does not support following usage + /* + SearchCriteria sc = ExpungeWorkJobSearch.create(); + sc.setParameters("lastUpdated",cutDate); + sc.setParameters("jobStatus", JobInfo.Status.IN_PROGRESS); - expunge(sc); + expunge(sc); + */ + Transaction.execute(new TransactionCallbackNoReturn() { + @Override + public void doInTransactionWithoutResult(TransactionStatus status) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + + PreparedStatement pstmt = null; + try { + pstmt = txn.prepareAutoCloseStatement( + "DELETE FROM vm_work_job WHERE id IN (SELECT id FROM async_job WHERE job_dispatcher='VmWorkJobDispatcher' AND job_status != 0 AND last_updated < ?)"); + pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate)); + + pstmt.execute(); + } catch (SQLException e) { + } catch (Throwable e) { + } + + try { + pstmt = txn.prepareAutoCloseStatement( + "DELETE FROM async_job WHERE job_dispatcher='VmWorkJobDispatcher' AND job_status != 0 AND last_updated < ?"); + pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate)); + + pstmt.execute(); + } catch (SQLException e) { + } catch (Throwable e) { + } + } + }); + } + + @Override + public void expungeLeftoverWorkJobs(final long msid) { + // current DAO machenism does not support following usage + /* + SearchCriteria sc = ExpungePlaceHolderWorkJobSearch.create(); + sc.setParameters("dispatcher", "VmWorkJobPlaceHolder"); + sc.setParameters("msid", msid); + + expunge(sc); + */ + Transaction.execute(new TransactionCallbackNoReturn() { + @Override + public void doInTransactionWithoutResult(TransactionStatus status) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + + PreparedStatement pstmt = null; + try { + pstmt = txn.prepareAutoCloseStatement( + "DELETE FROM vm_work_job WHERE id IN (SELECT id FROM async_job WHERE (job_dispatcher='VmWorkJobPlaceHolder' OR job_dispatcher='VmWorkJobDispatcher') AND job_init_msid=?)"); + pstmt.setLong(1, msid); + + pstmt.execute(); + } catch (SQLException e) { + } catch (Throwable e) { + } + + try { + pstmt = txn.prepareAutoCloseStatement( + "DELETE FROM async_job WHERE (job_dispatcher='VmWorkJobPlaceHolder' OR job_dispatcher='VmWorkJobDispatcher') AND job_init_msid=?"); + pstmt.setLong(1, msid); + + pstmt.execute(); + } catch (SQLException e) { + } catch (Throwable e) { + } + } + }); } } diff --git a/framework/spring/module/pom.xml b/framework/spring/module/pom.xml index 14bcfbef6f7..33196a73ec2 100644 --- a/framework/spring/module/pom.xml +++ b/framework/spring/module/pom.xml @@ -20,6 +20,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cloud-framework-spring-module + Apache CloudStack Framework - Spring Module org.apache.cloudstack cloud-maven-standard diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index 7132d4f2cc4..8029b61cc31 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -111,6 +111,7 @@ The Apache CloudStack files shared between agent and management server %package agent Summary: CloudStack Agent for KVM hypervisors +Requires: openssh-clients Requires: java >= 1.6.0 Requires: %{name}-common = %{_ver} Requires: libvirt diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 94837a2becd..a1c91a5b642 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -1590,6 +1590,11 @@ namespace HypervResource string templatePropFile = Path.Combine(path, "template.properties"); using (StreamWriter sw = new StreamWriter(File.Open(templatePropFile, FileMode.Create), Encoding.GetEncoding("iso-8859-1"))) { + if (format != null) + { + format = format.ToLower(); + } + sw.NewLine = "\n"; sw.WriteLine("id=" + templateId); sw.WriteLine("filename=" + templateUuid + "." + format); @@ -1599,7 +1604,7 @@ namespace HypervResource sw.WriteLine("virtualsize=" + virtualSize); sw.WriteLine(format + ".virtualsize=" + virtualSize); sw.WriteLine("size=" + physicalSize); - sw.WriteLine("vhd.size=" + physicalSize); + sw.WriteLine(format + ".size=" + physicalSize); sw.WriteLine("public=false"); } } diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java index 519f45796e9..d6ffa1db5c2 100644 --- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java +++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java @@ -31,6 +31,8 @@ import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,6 +43,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.ClientProtocolException; @@ -130,7 +133,6 @@ import com.cloud.utils.net.NetUtils; import com.cloud.utils.ssh.SshHelper; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineName; - /** * Implementation of dummy resource to be returned from discoverer. **/ @@ -433,7 +435,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S // Only Answer instances are returned by remote agents. // E.g. see Response.getAnswers() Answer[] result = s_gson.fromJson(ansStr, Answer[].class); - s_logger.debug("executeRequest received response " + s_gson.toJson(result)); + String logResult = cleanPassword(StringEscapeUtils.unescapeJava(result.toString())); + s_logger.debug("executeRequest received response " + logResult); if (result.length > 0) { return result[0]; } @@ -1679,7 +1682,10 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S // comment to use Apache HttpClient // http://stackoverflow.com/a/2793153/939250, but final comment is to // use Apache. - s_logger.debug("POST request to" + agentUri.toString() + " with contents" + jsonCmd); + String logMessage = StringEscapeUtils.unescapeJava(jsonCmd); + logMessage = cleanPassword(logMessage); + s_logger.debug("POST request to " + agentUri.toString() + + " with contents " + logMessage); // Create request HttpClient httpClient = null; @@ -1719,7 +1725,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S StringEntity cmdJson = new StringEntity(jsonCmd); request.addHeader("content-type", "application/json"); request.setEntity(cmdJson); - s_logger.debug("Sending cmd to " + agentUri.toString() + " cmd data:" + jsonCmd); + s_logger.debug("Sending cmd to " + agentUri.toString() + + " cmd data:" + logMessage); HttpResponse response = httpClient.execute(request); // Unsupported commands will not route. @@ -1736,7 +1743,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S return null; } else { result = EntityUtils.toString(response.getEntity()); - s_logger.debug("POST response is" + result); + String logResult = cleanPassword(StringEscapeUtils.unescapeJava(result)); + s_logger.debug("POST response is " + logResult); } } catch (ClientProtocolException protocolEx) { // Problem with HTTP message exchange @@ -1862,4 +1870,22 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S return "Unable to connect"; } + public static String cleanPassword(String logString) { + String cleanLogString = null; + if (logString != null) { + cleanLogString = logString; + String[] temp = logString.split(","); + int i = 0; + if (temp != null) { + while (i < temp.length) { + temp[i] = StringUtils.cleanString(temp[i]); + i++; + } + List stringList = new ArrayList(); + Collections.addAll(stringList, temp); + cleanLogString = StringUtils.join(stringList, ","); + } + } + return cleanLogString; + } } diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java index 90b8c3b7a2f..aa7570c3638 100644 --- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java +++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java @@ -20,6 +20,7 @@ package com.cloud.hypervisor.kvm.resource; import junit.framework.TestCase; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef; public class LibvirtVMDefTest extends TestCase { @@ -65,4 +66,28 @@ public class LibvirtVMDefTest extends TestCase { } + public void testDiskDef() { + String filePath = "/var/lib/libvirt/images/disk.qcow2"; + String diskLabel = "vda"; + + DiskDef disk = new DiskDef(); + DiskDef.diskBus bus = DiskDef.diskBus.VIRTIO; + DiskDef.diskFmtType type = DiskDef.diskFmtType.QCOW2; + DiskDef.diskCacheMode cacheMode = DiskDef.diskCacheMode.WRITEBACK; + + disk.defFileBasedDisk(filePath, diskLabel, bus, type); + disk.setCacheMode(cacheMode); + + assertEquals(filePath, disk.getDiskPath()); + assertEquals(diskLabel, disk.getDiskLabel()); + assertEquals(bus, disk.getBusType()); + assertEquals(DiskDef.deviceType.DISK, disk.getDeviceType()); + + String xmlDef = disk.toString(); + String expectedXml = "\n\n" + + "\n\n\n"; + + assertEquals(xmlDef, expectedXml); + } + } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/LegacyZoneVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/LegacyZoneVO.java index c31dab61712..93533bc6e61 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/LegacyZoneVO.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/LegacyZoneVO.java @@ -27,13 +27,15 @@ import javax.persistence.Table; import com.cloud.utils.NumbersUtil; /** -* LegacyZoneVO contains id of CloudStack zone containing clusters from multiple VMware vCetners and/or VMware Datacenters. -*/ + * LegacyZoneVO contains id of CloudStack zone containing clusters from multiple VMware vCetners and/or VMware Datacenters. + */ @Entity @Table(name = "legacy_zones") public class LegacyZoneVO implements LegacyZone { + private static final long serialVersionUID = -3979866054555152793L; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -60,7 +62,7 @@ public class LegacyZoneVO implements LegacyZone { @Override public boolean equals(Object obj) { if (obj instanceof LegacyZoneVO) { - return ((LegacyZoneVO)obj).getId() == this.getId(); + return ((LegacyZoneVO)obj).getId() == getId(); } else { return false; } @@ -70,7 +72,7 @@ public class LegacyZoneVO implements LegacyZone { } public LegacyZoneVO(long zoneId) { - this.id = zoneId; + id = zoneId; } public LegacyZoneVO(long id, long zoneId) { diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java index b7746f945c0..d3b001ae9eb 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.hypervisor.vmware; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -98,16 +97,6 @@ public class VmwareCleanupMaid { return _checkPoint; } - private synchronized static void addLeftOverVM(VmwareCleanupMaid cleanupMaid) { - List l = s_leftoverDummyVMs.get(cleanupMaid.getVCenterServer()); - if (l == null) { - l = new ArrayList(); - s_leftoverDummyVMs.put(cleanupMaid.getVCenterServer(), l); - } - - l.add(cleanupMaid); - } - public synchronized static void gcLeftOverVMs(VmwareContext context) { List l = s_leftoverDummyVMs.get(context.getServerAddress()); VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java index 881b44fb074..86597b2e5c9 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java @@ -37,6 +37,8 @@ import com.cloud.utils.db.Encrypt; @Table(name = "vmware_data_center") public class VmwareDatacenterVO implements VmwareDatacenter { + private static final long serialVersionUID = -9114941929893819232L; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -105,11 +107,11 @@ public class VmwareDatacenterVO implements VmwareDatacenter { } public void setVmwareDatacenterName(String name) { - this.vmwareDatacenterName = name; + vmwareDatacenterName = name; } public void setVcenterHost(String vCenterHost) { - this.vcenterHost = vCenterHost; + vcenterHost = vCenterHost; } public void setUser(String user) { @@ -134,17 +136,17 @@ public class VmwareDatacenterVO implements VmwareDatacenter { @Override public boolean equals(Object obj) { if (obj instanceof VmwareDatacenterVO) { - return ((VmwareDatacenterVO)obj).getId() == this.getId(); + return ((VmwareDatacenterVO)obj).getId() == getId(); } else { return false; } } public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) { - this.uuid = UUID.randomUUID().toString(); - this.vmwareDatacenterName = name; + uuid = UUID.randomUUID().toString(); + vmwareDatacenterName = name; this.guid = guid; - this.vcenterHost = vCenterHost; + vcenterHost = vCenterHost; this.user = user; this.password = password; } @@ -155,7 +157,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter { } public VmwareDatacenterVO() { - this.uuid = UUID.randomUUID().toString(); + uuid = UUID.randomUUID().toString(); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java index ae9ccbf6f95..a8d88b40502 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java @@ -32,6 +32,8 @@ import javax.persistence.Table; @Table(name = "vmware_data_center_zone_map") public class VmwareDatacenterZoneMapVO implements VmwareDatacenterZoneMap { + private static final long serialVersionUID = -2155826205976479040L; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index ad3620dd03f..3cd7a9f0e9e 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -126,7 +126,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer @Override public Map> - find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { + find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { if (s_logger.isInfoEnabled()) s_logger.info("Discover host. dc: " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + url.getHost()); @@ -158,7 +158,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer if (usernameNotProvided || passwordNotProvided) { // Retrieve credentials associated with VMware DC s_logger.info("Username and/or Password not provided while adding cluster to cloudstack zone. " - + "Hence using both username & password provided while adding VMware DC to CloudStack zone."); + + "Hence using both username & password provided while adding VMware DC to CloudStack zone."); username = vmwareDc.getUser(); password = vmwareDc.getPassword(); clusterDetails.put("username", username); @@ -252,7 +252,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer // Process traffic label information provided at zone level and cluster level publicTrafficLabelObj = - getTrafficInfo(TrafficType.Public, publicTrafficLabel, defaultVirtualSwitchType, paramPublicVswitchType, paramPublicVswitchName, clusterId); + getTrafficInfo(TrafficType.Public, publicTrafficLabel, defaultVirtualSwitchType, paramPublicVswitchType, paramPublicVswitchName, clusterId); // Configuration Check: A physical network cannot be shared by different types of virtual switches. // @@ -272,7 +272,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer if (pNetworkListGuestTraffic.contains(pNetworkPublic)) { if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) { String msg = - "Both public traffic and guest traffic is over same physical network " + pNetworkPublic + + "Both public traffic and guest traffic is over same physical network " + pNetworkPublic + ". And virtual switch type chosen for each traffic is different" + ". A physical network cannot be shared by different types of virtual switches."; s_logger.error(msg); @@ -295,7 +295,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } Pair vsmInfo = new Pair(false, 0L); if (nexusDVS && (guestTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) || - ((zoneType == NetworkType.Advanced) && (publicTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch))) { + ((zoneType == NetworkType.Advanced) && (publicTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch))) { // Expect Cisco Nexus VSM details only if following 2 condition met // 1) The global config parameter vmware.use.nexus.vswitch // 2) Atleast 1 traffic type uses Nexus distributed virtual switch as backend. @@ -335,14 +335,14 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer context.registerStockObject("vsmcredentials", vsmCredentials); } } - List morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, URLDecoder.decode(url.getPath())); + List morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, URLDecoder.decode(url.getPath(), "UTF-8")); if (morHosts == null) s_logger.info("Found 0 hosts."); if (privateTrafficLabel != null) context.uregisterStockObject("privateTrafficLabel"); if (morHosts == null) { - s_logger.error("Unable to find host or cluster based on url: " + URLDecoder.decode(url.getPath())); + s_logger.error("Unable to find host or cluster based on url: " + URLDecoder.decode(url.getPath(), "UTF-8")); return null; } @@ -350,7 +350,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer clusterDetails = _clusterDetailsDao.findDetails(clusterId); if (clusterDetails.get("url") != null) { URI uriFromCluster = new URI(UriUtils.encodeURIComponent(clusterDetails.get("url"))); - morCluster = context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath())); + morCluster = context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath(), "UTF-8")); if (morCluster == null || !morCluster.getType().equalsIgnoreCase("ClusterComputeResource")) { s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails.get("url")); @@ -491,13 +491,13 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer if (!vCenterHost.equalsIgnoreCase(url.getHost())) { msg = - "This cluster " + clusterName + " belongs to vCenter " + url.getHost() + ". But this zone is associated with VMware DC from vCenter " + vCenterHost + + "This cluster " + clusterName + " belongs to vCenter " + url.getHost() + ". But this zone is associated with VMware DC from vCenter " + vCenterHost + ". Make sure the cluster being added belongs to vCenter " + vCenterHost + " and VMware DC " + vmwareDcNameFromDb; s_logger.error(msg); throw new DiscoveryException(msg); } else if (!vmwareDcNameFromDb.equalsIgnoreCase(vmwareDcNameFromApi)) { msg = - "This cluster " + clusterName + " belongs to VMware DC " + vmwareDcNameFromApi + " .But this zone is associated with VMware DC " + vmwareDcNameFromDb + + "This cluster " + clusterName + " belongs to VMware DC " + vmwareDcNameFromApi + " .But this zone is associated with VMware DC " + vmwareDcNameFromDb + ". Make sure the cluster being added belongs to VMware DC " + vmwareDcNameFromDb + " in vCenter " + vCenterHost; s_logger.error(msg); throw new DiscoveryException(msg); @@ -567,8 +567,8 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer if (tmplt == null) { id = _tmpltDao.getNextInSequence(Long.class, "id"); VMTemplateVO template = - VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, - null, "VMware Tools Installer ISO", false, 1, false, HypervisorType.VMware); + VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, + null, "VMware Tools Installer ISO", false, 1, false, HypervisorType.VMware); _tmpltDao.persist(template); } else { id = tmplt.getId(); @@ -627,7 +627,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWideTrafficLabel, VirtualSwitchType defaultVirtualSwitchType, String vSwitchType, - String vSwitchName, Long clusterId) { + String vSwitchName, Long clusterId) { VmwareTrafficLabel trafficLabelObj = null; Map clusterDetails = null; try { @@ -664,7 +664,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWideTrafficLabel, Map clusterDetails, - VirtualSwitchType defVirtualSwitchType) { + VirtualSwitchType defVirtualSwitchType) { VmwareTrafficLabel trafficLabelObj = null; try { trafficLabelObj = new VmwareTrafficLabel(zoneWideTrafficLabel, trafficType, defVirtualSwitchType); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareHostService.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareHostService.java index a77679faa35..91a03ca6098 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareHostService.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareHostService.java @@ -21,7 +21,6 @@ import java.util.List; import com.vmware.vim25.ManagedObjectReference; import com.cloud.agent.api.Command; -import com.cloud.hypervisor.vmware.mo.DatastoreMO; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.util.VmwareContext; @@ -34,11 +33,9 @@ public interface VmwareHostService { String getWorkerName(VmwareContext context, Command cmd, int workerSequence); - ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, String iqn, - String initiatorChapName, String initiatorChapSecret, String mutualChapName, String mutualChapSecret) throws Exception; - - void createVmdk(Command cmd, DatastoreMO dsMo, String volumeDatastorePath, Long volumeSize) throws Exception; - + ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName, + String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret, + String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception; void handleDatastoreAndVmdkDetach(String iqn, String storageHost, int storagePort) throws Exception; void removeManagedTargetsFromCluster(List managedIqns) throws Exception; diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index 96f411e9559..482e8a626aa 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -40,7 +40,6 @@ import org.apache.log4j.Logger; import com.google.gson.Gson; import com.vmware.vim25.AboutInfo; -import com.vmware.vim25.HostConnectSpec; import com.vmware.vim25.ManagedObjectReference; import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd; @@ -94,11 +93,9 @@ import com.cloud.hypervisor.vmware.mo.DiskControllerType; import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO; import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper; -import com.cloud.hypervisor.vmware.mo.TaskMO; import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType; import com.cloud.hypervisor.vmware.mo.VmwareHostType; import com.cloud.hypervisor.vmware.resource.VmwareContextFactory; -import com.cloud.hypervisor.vmware.util.VmwareClient; import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.hypervisor.vmware.util.VmwareHelper; import com.cloud.network.CiscoNexusVSMDeviceVO; @@ -400,7 +397,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw @Override public List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, String hostInventoryPath) - throws Exception { + throws Exception { ManagedObjectReference mor = null; if (serviceContext != null) { mor = serviceContext.getHostMorByPath(hostInventoryPath); @@ -415,7 +412,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw List returnedHostList = new ArrayList(); if (mor.getType().equals("ComputeResource")) { - List hosts = (List)serviceContext.getVimClient().getDynamicProperty(mor, "host"); + List hosts = serviceContext.getVimClient().getDynamicProperty(mor, "host"); assert (hosts != null && hosts.size() > 0); // For ESX host, we need to enable host firewall to allow VNC access @@ -425,7 +422,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw returnedHostList.add(hosts.get(0)); return returnedHostList; } else if (mor.getType().equals("ClusterComputeResource")) { - List hosts = (List)serviceContext.getVimClient().getDynamicProperty(mor, "host"); + List hosts = serviceContext.getVimClient().getDynamicProperty(mor, "host"); assert (hosts != null); if (hosts.size() > 0) { @@ -462,45 +459,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw return null; } - @Deprecated - private ManagedObjectReference - addHostToVCenterCluster(VmwareContext serviceContext, ManagedObjectReference morCluster, String host, String userName, String password) throws Exception { - - VmwareClient vclient = serviceContext.getVimClient(); - ManagedObjectReference morHost = vclient.getDecendentMoRef(morCluster, "HostSystem", host); - if (morHost == null) { - HostConnectSpec hostSpec = new HostConnectSpec(); - hostSpec.setUserName(userName); - hostSpec.setPassword(password); - hostSpec.setHostName(host); - hostSpec.setForce(true); // forcely take over the host - - ManagedObjectReference morTask = serviceContext.getService().addHostTask(morCluster, hostSpec, true, null, null); - boolean taskResult = vclient.waitForTask(morTask); - if (!taskResult) { - s_logger.error("Unable to add host " + host + " to vSphere cluster due to " + TaskMO.getTaskFailureInfo(serviceContext, morTask)); - throw new CloudRuntimeException("Unable to add host " + host + " to vSphere cluster due to " + taskResult); - } - serviceContext.waitForTaskProgressDone(morTask); - - // init morHost after it has been created - morHost = vclient.getDecendentMoRef(morCluster, "HostSystem", host); - if (morHost == null) { - throw new CloudRuntimeException( - "Successfully added host into vSphere but unable to find it later on?!. Please make sure you are either using IP address or full qualified domain name for host"); - } - } - - // For ESX host, we need to enable host firewall to allow VNC access - HostMO hostMo = new HostMO(serviceContext, morHost); - HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO(); - if (firewallMo != null) { - firewallMo.enableRuleset("vncServer"); - firewallMo.refreshFirewall(); - } - return morHost; - } - @Override public String getSecondaryStorageStoreUrl(long dcId) { @@ -579,7 +537,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw return false; } - long startTick = Long.parseLong(tokens[0]); + Long.parseLong(tokens[0]); long msid = Long.parseLong(tokens[1]); long runid = Long.parseLong(tokens[2]); @@ -603,7 +561,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw s_logger.info("Worker VM expired, seconds elapsed: " + (System.currentTimeMillis() - startTick) / 1000); return true; } - */ + */ return false; } @@ -631,7 +589,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw _configServer.updateKeyPairs(); s_logger.info("Copy System VM patch ISO file to secondary storage. source ISO: " + srcIso.getAbsolutePath() + ", destination: " + - destIso.getAbsolutePath()); + destIso.getAbsolutePath()); try { FileUtil.copyfile(srcIso, destIso); } catch (IOException e) { @@ -1040,7 +998,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw if (vCenterHost == null) { throw new InvalidParameterValueException("Missing or invalid parameter name. " - + "Please provide valid VMware vCenter server's IP address or fully qualified domain name."); + + "Please provide valid VMware vCenter server's IP address or fully qualified domain name."); } if (zoneId == null) { @@ -1060,11 +1018,11 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw VmwareDatacenterVO associatedVmwareDc = _vmwareDcDao.findById(associatedVmwareDcId); if (associatedVmwareDc.getVcenterHost().equalsIgnoreCase(vCenterHost) && associatedVmwareDc.getVmwareDatacenterName().equalsIgnoreCase(vmwareDcName)) { s_logger.info("Ignoring API call addVmwareDc, because VMware DC " + vCenterHost + "/" + vmwareDcName + - " is already associated with specified zone with id " + zoneId); + " is already associated with specified zone with id " + zoneId); return associatedVmwareDc; } else { throw new CloudRuntimeException("Zone " + zoneId + " is already associated with a VMware datacenter. " + - "Only 1 VMware DC can be associated with a zone."); + "Only 1 VMware DC can be associated with a zone."); } } // Zone validation to check if the zone already has resources. @@ -1158,8 +1116,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw String userName; String password; DatacenterMO dcMo = null; - Transaction txn; - final VmwareDatacenterZoneMapVO vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId); // Check if zone is associated with VMware DC if (vmwareDcZoneMap == null) { diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java index a7089cedda2..e37bf38a5af 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java @@ -198,9 +198,6 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { String installPath = volume.getPath(); int index = installPath.lastIndexOf(File.separator); String volumeUuid = installPath.substring(index + 1); - String details = null; - boolean success = false; - String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); //The real volume path String volumePath = installPath + File.separator + volumeUuid + ".ova"; @@ -351,8 +348,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } snapshotBackupUuid = - backupSnapshotToSecondaryStorage(vmMo, accountId, volumeId, cmd.getVolumePath(), snapshotUuid, secondaryStorageUrl, prevSnapshotUuid, prevBackupUuid, - hostService.getWorkerName(context, cmd, 1)); + backupSnapshotToSecondaryStorage(vmMo, accountId, volumeId, cmd.getVolumePath(), snapshotUuid, secondaryStorageUrl, prevSnapshotUuid, prevBackupUuid, + hostService.getWorkerName(context, cmd, 1)); success = (snapshotBackupUuid != null); if (success) { @@ -407,7 +404,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { if (vmMo == null) { if (s_logger.isDebugEnabled()) { s_logger.debug("Unable to find the owner VM for CreatePrivateTemplateFromVolumeCommand on host " + hyperHost.getHyperHostName() + - ", try within datacenter"); + ", try within datacenter"); } vmMo = hyperHost.findVmOnPeerHyperHost(cmd.getVmName()); @@ -419,8 +416,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } Ternary result = - createTemplateFromVolume(vmMo, accountId, templateId, cmd.getUniqueName(), secondaryStoragePoolURL, volumePath, - hostService.getWorkerName(context, cmd, 0)); + createTemplateFromVolume(vmMo, accountId, templateId, cmd.getUniqueName(), secondaryStoragePoolURL, volumePath, + hostService.getWorkerName(context, cmd, 0)); return new CreatePrivateTemplateAnswer(cmd, true, null, result.first(), result.third(), result.second(), cmd.getUniqueName(), ImageFormat.OVA); @@ -477,8 +474,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { Pair result; if (cmd.toSecondaryStorage()) { result = - copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, volumeId, cmd.getPool().getUuid(), volumePath, secondaryStorageURL, - hostService.getWorkerName(context, cmd, 0)); + copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, volumeId, cmd.getPool().getUuid(), volumePath, secondaryStorageURL, + hostService.getWorkerName(context, cmd, 0)); } else { StorageFilerTO poolTO = cmd.getPool(); @@ -549,10 +546,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { // templateName: name in secondary storage // templateUuid: will be used at hypervisor layer private void copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl, - String templatePathAtSecondaryStorage, String templateName, String templateUuid) throws Exception { + String templatePathAtSecondaryStorage, String templateName, String templateUuid) throws Exception { s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + - templatePathAtSecondaryStorage + ", templateName: " + templateName); + templatePathAtSecondaryStorage + ", templateName: " + templateName); String secondaryMountPoint = _mountService.getMountPoint(secondaryStorageUrl); s_logger.info("Secondary storage mount point: " + secondaryMountPoint); @@ -587,7 +584,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); if (vmMo == null) { String msg = - "Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage + + "Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage + ", templateName: " + templateName + ", templateUuid: " + templateUuid; s_logger.error(msg); throw new Exception(msg); @@ -605,7 +602,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private Ternary createTemplateFromVolume(VirtualMachineMO vmMo, long accountId, long templateId, String templateUniqueName, String secStorageUrl, - String volumePath, String workerVmName) throws Exception { + String volumePath, String workerVmName) throws Exception { String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId); @@ -670,7 +667,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private Ternary createTemplateFromSnapshot(long accountId, long templateId, String templateUniqueName, String secStorageUrl, long volumeId, - String backedUpSnapshotUuid) throws Exception { + String backedUpSnapshotUuid) throws Exception { String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId); @@ -854,14 +851,14 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private String createVolumeFromSnapshot(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, long accountId, long volumeId, - String secStorageUrl, String snapshotBackupUuid) throws Exception { + String secStorageUrl, String snapshotBackupUuid) throws Exception { restoreVolumeFromSecStorage(hyperHost, primaryDsMo, newVolumeName, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), snapshotBackupUuid); return null; } private void restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String secStorageDir, - String backupName) throws Exception { + String backupName) throws Exception { String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); String srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/" + backupName + "." + ImageFormat.OVA.getFileExtension(); @@ -921,7 +918,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private String backupSnapshotToSecondaryStorage(VirtualMachineMO vmMo, long accountId, long volumeId, String volumePath, String snapshotUuid, String secStorageUrl, - String prevSnapshotUuid, String prevBackupUuid, String workerVmName) throws Exception { + String prevSnapshotUuid, String prevBackupUuid, String workerVmName) throws Exception { String backupUuid = UUID.randomUUID().toString(); exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), backupUuid, workerVmName); @@ -929,7 +926,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private void exportVolumeToSecondaryStroage(VirtualMachineMO vmMo, String volumePath, String secStorageUrl, String secStorageDir, String exportName, - String workerVmName) throws Exception { + String workerVmName) throws Exception { String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); String exportPath = secondaryMountPoint + "/" + secStorageDir + "/" + exportName; @@ -973,40 +970,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } } - private String deleteSnapshotOnSecondaryStorge(long accountId, long volumeId, String secStorageUrl, String backupUuid) throws Exception { - - String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); - String snapshotMountRoot = secondaryMountPoint + "/" + getSnapshotRelativeDirInSecStorage(accountId, volumeId); - File file = new File(snapshotMountRoot + "/" + backupUuid + ".ovf"); - if (file.exists()) { - File snapshotdir = new File(snapshotMountRoot); - File[] ssfiles = snapshotdir.listFiles(); - // List filenames = new ArrayList(); - for (int i = 0; i < ssfiles.length; i++) { - String vmdkfile = ssfiles[i].getName(); - if (vmdkfile.toLowerCase().startsWith(backupUuid) && vmdkfile.toLowerCase().endsWith(".vmdk")) { - // filenames.add(vmdkfile); - new File(vmdkfile).delete(); - } - } - if (file.delete()) { - return null; - } - } else { - File file1 = new File(snapshotMountRoot + "/" + backupUuid + ".ova"); - if (file1.exists()) { - if (file1.delete()) { - return null; - } - } else { - return "Backup file does not exist. backupUuid: " + backupUuid; - } - } - return "Failed to delete snapshot backup file, backupUuid: " + backupUuid; - } - private Pair copyVolumeToSecStorage(VmwareHostService hostService, VmwareHypervisorHost hyperHost, CopyVolumeCommand cmd, String vmName, - long volumeId, String poolId, String volumePath, String secStorageUrl, String workerVmName) throws Exception { + long volumeId, String poolId, String volumePath, String secStorageUrl, String workerVmName) throws Exception { String volumeFolder = String.valueOf(volumeId) + "/"; VirtualMachineMO workerVm = null; @@ -1043,7 +1008,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { vmMo.createSnapshot(exportName, "Temporary snapshot for copy-volume command", false, false); exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, "volumes/" + volumeFolder, exportName, - hostService.getWorkerName(hyperHost.getContext(), cmd, 1)); + hostService.getWorkerName(hyperHost.getContext(), cmd, 1)); return new Pair(volumeFolder, exportName); } finally { @@ -1066,7 +1031,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } private Pair copyVolumeFromSecStorage(VmwareHypervisorHost hyperHost, long volumeId, DatastoreMO dsMo, String secStorageUrl, String exportName) - throws Exception { + throws Exception { String volumeFolder = String.valueOf(volumeId) + "/"; String newVolume = UUID.randomUUID().toString().replaceAll("-", ""); @@ -1085,69 +1050,54 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { s_logger.info("getOVAfromMetaFile: " + metafileName); try { strm = new FileInputStream(ova_metafile); - if (null == strm) { - String msg = "Cannot read ova meta file."; + + s_logger.info("loading properties from ova meta file: " + metafileName); + props = new Properties(); + props.load(strm); + ovaFileName = props.getProperty("ova.filename"); + s_logger.info("ovafilename: " + ovaFileName); + String ovfFileName = props.getProperty("ovf"); + s_logger.info("ovffilename: " + ovfFileName); + int diskNum = Integer.parseInt(props.getProperty("numDisks")); + if (diskNum <= 0) { + String msg = "VMDK disk file number is 0. Error"; s_logger.error(msg); throw new Exception(msg); } - - s_logger.info("loading properties from ova meta file: " + metafileName); - if (null != ova_metafile) { - props = new Properties(); - props.load(strm); - if (props == null) { - s_logger.info("getOVAfromMetaFile: props is null. "); - } + String[] disks = new String[diskNum]; + for (int i = 0; i < diskNum; i++) { + // String diskNameKey = "disk" + Integer.toString(i+1) + ".name"; // Fang use this + String diskNameKey = "disk1.name"; + disks[i] = props.getProperty(diskNameKey); + s_logger.info("diskname " + disks[i]); } - if (null != props) { - ovaFileName = props.getProperty("ova.filename"); - s_logger.info("ovafilename: " + ovaFileName); - String ovfFileName = props.getProperty("ovf"); - s_logger.info("ovffilename: " + ovfFileName); - int diskNum = Integer.parseInt(props.getProperty("numDisks")); - if (diskNum <= 0) { - String msg = "VMDK disk file number is 0. Error"; - s_logger.error(msg); - throw new Exception(msg); - } - String[] disks = new String[diskNum]; - for (int i = 0; i < diskNum; i++) { - // String diskNameKey = "disk" + Integer.toString(i+1) + ".name"; // Fang use this - String diskNameKey = "disk1.name"; - disks[i] = props.getProperty(diskNameKey); - s_logger.info("diskname " + disks[i]); - } - String exportDir = ova_metafile.getParent(); - s_logger.info("exportDir: " + exportDir); - // Important! we need to sync file system before we can safely use tar to work around a linux kernal bug(or feature) - s_logger.info("Sync file system before we package OVA..., before tar "); - s_logger.info("ova: " + ovaFileName + ", ovf:" + ovfFileName + ", vmdk:" + disks[0] + "."); - Script commandSync = new Script(true, "sync", 0, s_logger); - commandSync.execute(); - Script command = new Script(false, "tar", 0, s_logger); - command.setWorkDir(exportDir); // Fang: pass this in to the method? - command.add("-cf", ovaFileName); - command.add(ovfFileName); // OVF file should be the first file in OVA archive - for (String diskName : disks) { - command.add(diskName); - } - command.execute(); - s_logger.info("Package OVA for template in dir: " + exportDir + "cmd: " + command.toString()); - // to be safe, physically test existence of the target OVA file - if ((new File(exportDir + ovaFileName)).exists()) { - s_logger.info("ova file is created and ready to extract "); - return (ovaFileName); - } else { - String msg = exportDir + File.separator + ovaFileName + ".ova is not created as expected"; - s_logger.error(msg); - throw new Exception(msg); - } + String exportDir = ova_metafile.getParent(); + s_logger.info("exportDir: " + exportDir); + // Important! we need to sync file system before we can safely use tar to work around a linux kernal bug(or feature) + s_logger.info("Sync file system before we package OVA..., before tar "); + s_logger.info("ova: " + ovaFileName + ", ovf:" + ovfFileName + ", vmdk:" + disks[0] + "."); + Script commandSync = new Script(true, "sync", 0, s_logger); + commandSync.execute(); + Script command = new Script(false, "tar", 0, s_logger); + command.setWorkDir(exportDir); // Fang: pass this in to the method? + command.add("-cf", ovaFileName); + command.add(ovfFileName); // OVF file should be the first file in OVA archive + for (String diskName : disks) { + command.add(diskName); + } + command.execute(); + s_logger.info("Package OVA for template in dir: " + exportDir + "cmd: " + command.toString()); + // to be safe, physically test existence of the target OVA file + if ((new File(exportDir + ovaFileName)).exists()) { + s_logger.info("ova file is created and ready to extract "); + return (ovaFileName); } else { - String msg = "Error reading the ova meta file: " + metafileName; + String msg = exportDir + File.separator + ovaFileName + ".ova is not created as expected"; s_logger.error(msg); throw new Exception(msg); } } catch (Exception e) { + s_logger.error("Exception in getOVAFromMetafile", e); return null; // Do something, re-throw the exception } finally { @@ -1252,7 +1202,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { // wait if there are already VM snapshot task running ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); - List tasks = (ArrayList)context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); + List tasks = context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); for (ManagedObjectReference taskMor : tasks) { TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info")); @@ -1465,7 +1415,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { // wait if there are already VM revert task running ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); - List tasks = (ArrayList)context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); + List tasks = context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); for (ManagedObjectReference taskMor : tasks) { TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info")); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index 8b252763e78..69543cea623 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit; import javax.naming.ConfigurationException; +import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; import org.apache.log4j.NDC; @@ -60,7 +61,6 @@ import com.vmware.vim25.DistributedVirtualPort; import com.vmware.vim25.DistributedVirtualSwitchPortConnection; import com.vmware.vim25.DistributedVirtualSwitchPortCriteria; import com.vmware.vim25.DynamicProperty; -import com.vmware.vim25.GuestInfo; import com.vmware.vim25.HostCapability; import com.vmware.vim25.HostHostBusAdapter; import com.vmware.vim25.HostInternetScsiHba; @@ -262,6 +262,7 @@ import com.cloud.agent.api.to.VolumeTO; import com.cloud.configuration.Config; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.Vlan; +import com.cloud.exception.CloudException; import com.cloud.exception.InternalErrorException; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor.HypervisorType; @@ -314,6 +315,7 @@ import com.cloud.utils.DateUtil; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.StringUtils; +import com.cloud.utils.Ternary; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.ExceptionUtil; @@ -600,7 +602,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa _cmdMBeans.remove(0); JmxUtil.unregisterMBean("VMware " + _morHyperHost.getValue(), - "Command " + mbeanToRemove.getProp("Sequence") + "-" + mbeanToRemove.getProp("Name")); + "Command " + mbeanToRemove.getProp("Sequence") + "-" + mbeanToRemove.getProp("Name")); } } catch (Exception e) { if (s_logger.isTraceEnabled()) @@ -718,7 +720,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_staticroute.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_staticroute.sh " + args); if (s_logger.isDebugEnabled()) s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/vpc_staticroute.sh " + args); @@ -767,7 +769,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair resultPair = - SshHelper.sshExecute(privateIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_netusage.sh " + args); + SshHelper.sshExecute(privateIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_netusage.sh " + args); if (!resultPair.first()) { throw new Exception(" vpc network usage plugin call failed "); @@ -794,7 +796,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } catch (Throwable e) { s_logger.error( - "Unable to execute NetworkUsage command on DomR (" + privateIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); + "Unable to execute NetworkUsage command on DomR (" + privateIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); } return new NetworkUsageAnswer(cmd, "success", 0L, 0L); } @@ -814,7 +816,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/monitor_service.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/monitor_service.sh " + args); if (!result.first()) { String msg = "monitor_service.sh failed on domain router " + controlIp + " failed " + result.second(); @@ -851,10 +853,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/firewall.sh " + args); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/firewall_nat.sh " + args); if (s_logger.isDebugEnabled()) - s_logger.debug("Executing script on domain router " + controlIp + ": /root/firewall.sh " + args); + s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/firewall_nat.sh " + args); if (!result.first()) { s_logger.error("SetPortForwardingRulesCommand failure on setting one rule. args: " + args); @@ -909,16 +911,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa Pair result = null; if (trafficType == FirewallRule.TrafficType.Egress) { - result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/firewallRule_egress.sh " + args); + result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/firewall_egress.sh " + args); } else { - result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/firewall_rule.sh " + args); + result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/firewall_ingress.sh " + args); } if (s_logger.isDebugEnabled()) { if (trafficType == FirewallRule.TrafficType.Egress) { - s_logger.debug("Executing script on domain router " + controlIp + ": /root/firewallRule_egress.sh " + args); + s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/firewall_egress.sh " + args); } else { - s_logger.debug("Executing script on domain router " + controlIp + ": /root/firewall_rule.sh " + args); + s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/firewall_ingress.sh " + args); } } @@ -964,7 +966,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // Invoke command on VPC VR. try { Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_staticnat.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_staticnat.sh " + args); if (s_logger.isDebugEnabled()) s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/vpc_staticnat.sh " + args); @@ -1016,10 +1018,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); String controlIp = getRouterSshControlIp(cmd); - Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/firewall.sh " + args); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/firewall_nat.sh " + args); if (s_logger.isDebugEnabled()) - s_logger.debug("Executing script on domain router " + controlIp + ": /root/firewall.sh " + args); + s_logger.debug("Executing script on domain router " + controlIp + ": /opt/cloud/bin/firewall_nat.sh " + args); if (!result.first()) { s_logger.error("SetStaticNatRulesCommand failure on setting one rule. args: " + args); @@ -1037,97 +1039,22 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new SetStaticNatRulesAnswer(cmd, results, endResult); } - protected Answer VPCLoadBalancerConfig(final LoadBalancerConfigCommand cmd) { + protected boolean createFileInVR(String routerIp, String filePath, String fileName, String content) { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); File keyFile = mgr.getSystemVMKeyFile(); - - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String controlIp = getRouterSshControlIp(cmd); - - assert (controlIp != null); - - LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); - String[] config = cfgtr.generateConfiguration(cmd); - - String tmpCfgFilePath = "/etc/haproxy/haproxy.cfg.new"; - String tmpCfgFileContents = ""; - for (int i = 0; i < config.length; i++) { - tmpCfgFileContents += config[i]; - tmpCfgFileContents += "\n"; - } + boolean result = true; try { - SshHelper.scpTo(controlIp, DefaultDomRSshPort, "root", keyFile, null, "/etc/haproxy/", tmpCfgFileContents.getBytes(), "haproxy.cfg.new", null); - - try { - String[][] rules = cfgtr.generateFwRules(cmd); - - String[] addRules = rules[LoadBalancerConfigurator.ADD]; - String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; - String[] statRules = rules[LoadBalancerConfigurator.STATS]; - - String args = ""; - String ip = cmd.getNic().getIp(); - args += " -i " + ip; - StringBuilder sb = new StringBuilder(); - if (addRules.length > 0) { - for (int i = 0; i < addRules.length; i++) { - sb.append(addRules[i]).append(','); - } - - args += " -a " + sb.toString(); - } - - sb = new StringBuilder(); - if (removeRules.length > 0) { - for (int i = 0; i < removeRules.length; i++) { - sb.append(removeRules[i]).append(','); - } - - args += " -d " + sb.toString(); - } - - sb = new StringBuilder(); - if (statRules.length > 0) { - for (int i = 0; i < statRules.length; i++) { - sb.append(statRules[i]).append(','); - } - - args += " -s " + sb.toString(); - } - - // Invoke the command - Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_loadbalancer.sh " + args); - - if (!result.first()) { - String msg = "LoadBalancerConfigCommand on domain router " + routerIp + " failed. message: " + result.second(); - s_logger.error(msg); - - return new Answer(cmd, false, msg); - } - - if (s_logger.isInfoEnabled()) { - s_logger.info("VPCLoadBalancerConfigCommand on domain router " + routerIp + " completed"); - } - } finally { - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "rm " + tmpCfgFilePath); - } - return new Answer(cmd); - } catch (Throwable e) { - s_logger.error("Unexpected exception: " + e.toString(), e); - return new Answer(cmd, false, "VPCLoadBalancerConfigCommand failed due to " + VmwareHelper.getExceptionMessage(e)); + SshHelper.scpTo(routerIp, 3922, "root", keyFile, null, filePath, content.getBytes(), fileName, null); + } catch (Exception e) { + s_logger.warn("Fail to create file " + filePath + fileName + " in VR " + routerIp, e); + result = false; } + return result; } protected Answer execute(final LoadBalancerConfigCommand cmd) { - - if (cmd.getVpcId() != null) { - return VPCLoadBalancerConfig(cmd); - } - VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - File keyFile = mgr.getSystemVMKeyFile(); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String controlIp = getRouterSshControlIp(cmd); @@ -1137,82 +1064,74 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); String[] config = cfgtr.generateConfiguration(cmd); - String[][] rules = cfgtr.generateFwRules(cmd); - String tmpCfgFilePath = "/tmp/" + routerIp.replace('.', '_') + ".cfg"; String tmpCfgFileContents = ""; + String tmpCfgFileName = "haproxy.cfg.new"; + String tmpCfgFilePath = "/etc/haproxy/"; for (int i = 0; i < config.length; i++) { tmpCfgFileContents += config[i]; tmpCfgFileContents += "\n"; } + if (!createFileInVR(controlIp, tmpCfgFilePath, tmpCfgFileName, tmpCfgFileContents)) { + return new Answer(cmd, false, "Fail to create LB config file in VR"); + } + try { - SshHelper.scpTo(controlIp, DefaultDomRSshPort, "root", keyFile, null, "/tmp/", tmpCfgFileContents.getBytes(), routerIp.replace('.', '_') + ".cfg", null); - try { - String[] addRules = rules[LoadBalancerConfigurator.ADD]; - String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; - String[] statRules = rules[LoadBalancerConfigurator.STATS]; + String[][] rules = cfgtr.generateFwRules(cmd); - String args = ""; - args += "-i " + routerIp; - args += " -f " + tmpCfgFilePath; + String[] addRules = rules[LoadBalancerConfigurator.ADD]; + String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; + String[] statRules = rules[LoadBalancerConfigurator.STATS]; - StringBuilder sb = new StringBuilder(); - if (addRules.length > 0) { - for (int i = 0; i < addRules.length; i++) { - sb.append(addRules[i]).append(','); - } - - args += " -a " + sb.toString(); + String args = ""; + StringBuilder sb = new StringBuilder(); + if (addRules.length > 0) { + for (int i = 0; i < addRules.length; i++) { + sb.append(addRules[i]).append(','); } - sb = new StringBuilder(); - if (removeRules.length > 0) { - for (int i = 0; i < removeRules.length; i++) { - sb.append(removeRules[i]).append(','); - } - - args += " -d " + sb.toString(); - } - - sb = new StringBuilder(); - if (statRules.length > 0) { - for (int i = 0; i < statRules.length; i++) { - sb.append(statRules[i]).append(','); - } - - args += " -s " + sb.toString(); - } - - Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "scp " + tmpCfgFilePath + - " /etc/haproxy/haproxy.cfg.new"); - - if (!result.first()) { - s_logger.error("Unable to copy haproxy configuration file"); - return new Answer(cmd, false, "LoadBalancerConfigCommand failed due to uanble to copy haproxy configuration file"); - } - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Run command on domain router " + routerIp + ", /root/loadbalancer.sh " + args); - } - - result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/loadbalancer.sh " + args); - - if (!result.first()) { - String msg = "LoadBalancerConfigCommand on domain router " + routerIp + " failed. message: " + result.second(); - s_logger.error(msg); - - return new Answer(cmd, false, msg); - } - - if (s_logger.isInfoEnabled()) { - s_logger.info("LoadBalancerConfigCommand on domain router " + routerIp + " completed"); - } - } finally { - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "rm " + tmpCfgFilePath); + args += " -a " + sb.toString(); } + sb = new StringBuilder(); + if (removeRules.length > 0) { + for (int i = 0; i < removeRules.length; i++) { + sb.append(removeRules[i]).append(','); + } + + args += " -d " + sb.toString(); + } + + sb = new StringBuilder(); + if (statRules.length > 0) { + for (int i = 0; i < statRules.length; i++) { + sb.append(statRules[i]).append(','); + } + + args += " -s " + sb.toString(); + } + + Pair result; + if (cmd.getVpcId() == null) { + args = " -i " + routerIp + args; + result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/loadbalancer.sh " + args); + } else { + args = " -i " + cmd.getNic().getIp() + args; + result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_loadbalancer.sh " + args); + } + // Invoke the command + + if (!result.first()) { + String msg = "LoadBalancerConfigCommand on domain router " + routerIp + " failed. message: " + result.second(); + s_logger.error(msg); + + return new Answer(cmd, false, msg); + } + + if (s_logger.isInfoEnabled()) { + s_logger.info("LoadBalancerConfigCommand on domain router " + routerIp + " completed"); + } return new Answer(cmd); } catch (Throwable e) { s_logger.error("Unexpected exception: " + e.toString(), e); @@ -1220,39 +1139,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } - // - // list available ethx devices - // ls /proc/sys/net/ipv4/conf - // - private int allocRouterEthDeviceIndex(String domrName, String routerIp) throws Exception { - VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - - Pair result = SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "ls /proc/sys/net/ipv4/conf"); - - if (result.first()) { - String[] tokens = result.second().split("\\s+"); - HashMap deviceNames = new HashMap(); - for (String token : tokens) { - if (!("all".equalsIgnoreCase(token) || "default".equalsIgnoreCase(token) || "lo".equalsIgnoreCase(token))) { - deviceNames.put(token, token); - } - } - - for (int i = 1;; i++) { - if (!deviceNames.containsKey("eth" + i)) - return i; - } - } - - return -1; - } - - // - // find mac address of a specified ethx device - // ip address show ethx | grep link/ether | sed -e 's/^[ \t]*//' | cut -d' ' -f2 - // returns - // eth0:xx.xx.xx.xx - // // list IP with eth devices // ifconfig ethx |grep -B1 "inet addr" | awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' @@ -1283,8 +1169,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isDebugEnabled()) s_logger.debug("Run domr script " + cmd); Pair result2 = SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, - // TODO need to find the dev index inside router based on IP address - cmd); + // TODO need to find the dev index inside router based on IP address + cmd); if (s_logger.isDebugEnabled()) s_logger.debug("result: " + result2.first() + ", output: " + result2.second()); @@ -1361,7 +1247,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } Pair result = - SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_guestnw.sh " + args); + SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_guestnw.sh " + args); if (!result.first()) { String msg = "SetupGuestNetworkCommand on domain router " + routerIp + " failed. message: " + result.second(); @@ -1428,7 +1314,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args += "eth" + ethDeviceNum; Pair result = - SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_snat.sh " + args); + SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_snat.sh " + args); if (!result.first()) { String msg = "SetupGuestNetworkCommand on domain router " + routerIp + " failed. message: " + result.second(); @@ -1533,7 +1419,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { Pair sshResult = - SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_portforwarding.sh " + args); + SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_portforwarding.sh " + args); if (!sshResult.first()) { results[i++] = "Failed"; @@ -1653,7 +1539,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.debug(errMsg); return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg); } - */ + */ // TODO need a way to specify the control of NIC device type VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000; @@ -1677,13 +1563,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa dvSwitchUuid = dataCenterMo.getDvSwitchUuid(dvsMor); s_logger.info("Preparing NIC device on dvSwitch : " + dvSwitchUuid); nic = - VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), dvSwitchUuid, nicTo.getMac(), deviceNumber, - deviceNumber + 1, true, true); + VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), dvSwitchUuid, nicTo.getMac(), deviceNumber, + deviceNumber + 1, true, true); } else { s_logger.info("Preparing NIC device on network " + networkInfo.second()); nic = - VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), nicTo.getMac(), deviceNumber, deviceNumber + 1, true, - true); + VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), nicTo.getMac(), deviceNumber, deviceNumber + 1, true, + true); } VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); @@ -1735,7 +1621,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.debug(errMsg); return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg); } - */ + */ VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac()); if (nic == null) { return new UnPlugNicAnswer(cmd, true, "success"); @@ -1802,7 +1688,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); Pair result = - SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_ipassoc.sh " + args); + SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_ipassoc.sh " + args); if (!result.first()) { throw new InternalErrorException("Unable to assign public IP address"); @@ -1815,7 +1701,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa snatArgs += "eth" + ethDeviceNum; Pair result_gateway = - SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_privateGateway.sh " + snatArgs); + SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_privateGateway.sh " + snatArgs); if (!result_gateway.first()) { throw new InternalErrorException("Unable to configure source NAT for public IP address."); @@ -1824,8 +1710,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } protected void assignPublicIpAddress(VirtualMachineMO vmMo, final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, - final boolean firstIP, final boolean sourceNat, final String broadcastId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) - throws Exception { + final boolean firstIP, final boolean sourceNat, final String broadcastId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) + throws Exception { /** * TODO support other networks @@ -1907,7 +1793,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = - SshHelper.sshExecute(privateIpAddress, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/ipassoc.sh " + args); + SshHelper.sshExecute(privateIpAddress, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/ipassoc.sh " + args); if (!result.first()) { s_logger.error("ipassoc command on domain router " + privateIpAddress + " failed. message: " + result.second()); @@ -1950,13 +1836,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) { synchronized (vmMo.getRunningHost().getMor().getValue().intern()) { networkInfo = - HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, null, - _opsTimeout, true, BroadcastDomainType.Vlan, null); + HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, null, + _opsTimeout, true, BroadcastDomainType.Vlan, null); } } else { networkInfo = - HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, null, null, - _opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan); + HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, null, null, + _opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan); } int nicIndex = allocPublicNicIndex(vmMo); @@ -2054,7 +1940,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa for (IpAddressTO ip : ips) { assignPublicIpAddress(vmMo, routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getBroadcastUri(), - ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress()); + ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress()); results[i++] = ip.getPublicIp() + " - success"; } } catch (Throwable e) { @@ -2072,7 +1958,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource SavePasswordCommand. vmName: " + cmd.getVmName() + ", vmIp: " + cmd.getVmIpAddress() + ", password: " + - StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); + StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); } String controlIp = getRouterSshControlIp(cmd); @@ -2084,7 +1970,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on domain router " + controlIp + ", /opt/cloud/bin/savepassword.sh " + args + " -p " + - StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); + StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); } args += " -p " + password; @@ -2092,7 +1978,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/savepassword.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/savepassword.sh " + args); if (!result.first()) { s_logger.error("savepassword command on domain router " + controlIp + " failed, message: " + result.second()); @@ -2147,13 +2033,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } if (s_logger.isDebugEnabled()) { - s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/edithosts.sh " + args); + s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/edithosts.sh " + args); } try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); String controlIp = getRouterSshControlIp(cmd); - Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/edithosts.sh " + args); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/edithosts.sh " + args); if (!result.first()) { s_logger.error("dhcp_entry command on domR " + controlIp + " failed, message: " + result.second()); @@ -2185,14 +2071,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; } if (s_logger.isDebugEnabled()) { - s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/createIpAlias " + args); + s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/createIpAlias " + args); } try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); String controlIp = getRouterSshControlIp(cmd); Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/createIpAlias.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/createIpAlias.sh " + args); if (!result.first()) { s_logger.error("CreateIpAlias command on domr " + controlIp + " failed, message: " + result.second()); @@ -2229,14 +2115,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; } if (s_logger.isDebugEnabled()) { - s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/deleteIpAlias " + args); + s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/deleteIpAlias " + args); } try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); String controlIp = getRouterSshControlIp(cmd); Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/deleteIpAlias.sh " + args); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/deleteIpAlias.sh " + args); if (!result.first()) { s_logger.error("deleteIpAlias command on domr " + controlIp + " failed, message: " + result.second()); @@ -2272,12 +2158,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; } VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - File keyFile = mgr.getSystemVMKeyFile(); + mgr.getSystemVMKeyFile(); try { - Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/dnsmasq.sh " + args); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/dnsmasq.sh " + args); if (s_logger.isDebugEnabled()) { - s_logger.debug("Run command on domain router " + routerIp + ", /root/dnsmasq.sh"); + s_logger.debug("Run command on domain router " + routerIp + ", /opt/cloud/bin/dnsmasq.sh"); } if (!result.first()) { @@ -2316,7 +2202,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (!result.first()) { s_logger.error("check site-to-site vpn connections command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " failed, message: " + - result.second()); + result.second()); return new CheckS2SVpnConnectionsAnswer(cmd, false, result.second()); } @@ -2397,14 +2283,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa protected Answer execute(BumpUpPriorityCommand cmd) { if (s_logger.isDebugEnabled()) { s_logger.debug("Executing resource BumpUpPriorityCommand: " + _gson.toJson(cmd)); - s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/bumpup_priority.sh "); + s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/bumpup_priority.sh "); } Pair result; try { VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); String controlIp = getRouterSshControlIp(cmd); - result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/bumpup_priority.sh "); + result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/bumpup_priority.sh "); if (!result.first()) { s_logger.error("BumpUpPriority command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " failed, message: " + result.second()); @@ -2431,55 +2317,29 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Executing resource VmDataCommand: " + _gson.toJson(cmd)); } - String routerPrivateIpAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String controlIp = getRouterSshControlIp(cmd); + Map> data = new HashMap>(); + data.put(cmd.getVmIpAddress(), cmd.getVmData()); - String vmIpAddress = cmd.getVmIpAddress(); - List vmData = cmd.getVmData(); - String[] vmDataArgs = new String[vmData.size() * 2 + 4]; - vmDataArgs[0] = "routerIP"; - vmDataArgs[1] = routerPrivateIpAddress; - vmDataArgs[2] = "vmIP"; - vmDataArgs[3] = vmIpAddress; - int i = 4; - for (String[] vmDataEntry : vmData) { - String folder = vmDataEntry[0]; - String file = vmDataEntry[1]; - String contents = (vmDataEntry[2] != null) ? vmDataEntry[2] : "none"; + String json = new Gson().toJson(data); + s_logger.debug("VM data JSON IS:" + json); - vmDataArgs[i] = folder + "," + file; - vmDataArgs[i + 1] = contents; - i += 2; - } + json = Base64.encodeBase64String(json.getBytes()); - String content = encodeDataArgs(vmDataArgs); - String tmpFileName = UUID.randomUUID().toString(); + String args = "-d " + json; - if (s_logger.isDebugEnabled()) { - s_logger.debug("Run vm_data command on domain router " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", data: " + content); - } + VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); try { - VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - SshHelper.scpTo(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/tmp", content.getBytes(), tmpFileName, null); - - try { - Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/userdata.py " + tmpFileName); - - if (!result.first()) { - s_logger.error("vm_data command on domain router " + controlIp + " failed. messge: " + result.second()); - return new Answer(cmd, false, "VmDataCommand failed due to " + result.second()); - } - } finally { - - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "rm /tmp/" + tmpFileName); + Pair result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vmdata.py " + args); + if (!result.first()) { + s_logger.error("vm_data command on domain router " + controlIp + " failed. messge: " + result.second()); + return new Answer(cmd, false, "VmDataCommand failed due to " + result.second()); } if (s_logger.isInfoEnabled()) { s_logger.info("vm_data command on domain router " + controlIp + " completed"); } - } catch (Throwable e) { String msg = "VmDataCommand failed due to " + VmwareHelper.getExceptionMessage(e); s_logger.error(msg, e); @@ -2488,17 +2348,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new Answer(cmd); } - private String encodeDataArgs(String[] dataArgs) { - StringBuilder sb = new StringBuilder(); - - for (String arg : dataArgs) { - sb.append(arg); - sb.append("\n"); - } - - return sb.toString(); - } - protected CheckSshAnswer execute(CheckSshCommand cmd) { String vmName = cmd.getName(); String privateIp = cmd.getIp(); @@ -2590,7 +2439,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa hotaddMemoryLimitInMb = vmMo.getHotAddMemoryLimitInMb(); if (requestedMaxMemoryInMb > hotaddMemoryLimitInMb) { throw new CloudRuntimeException("Memory of VM " + vmMo.getVmName() + " cannot be scaled to " + requestedMaxMemoryInMb + "MB." + - " Requested memory limit is beyond the hotadd memory limit for this VM at the moment is " + hotaddMemoryLimitInMb + "MB."); + " Requested memory limit is beyond the hotadd memory limit for this VM at the moment is " + hotaddMemoryLimitInMb + "MB."); } // Check increment is multiple of increment size @@ -2602,7 +2451,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // Check if license supports the feature VmwareHelper.isFeatureLicensed(hyperHost, FeatureKeyConstants.HOTPLUG); VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), vmSpec.getMinSpeed(), (int)requestedMaxMemoryInMb, ramMb, - vmSpec.getLimitCpuUse()); + vmSpec.getLimitCpuUse()); if (!vmMo.configureVm(vmConfigSpec)) { throw new Exception("Unable to execute ScaleVmCommand"); @@ -2640,8 +2489,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa DiskTO[] disks = validateDisks(vmSpec.getDisks()); assert (disks.length > 0); NicTO[] nics = vmSpec.getNics(); + Map iqnToPath = new HashMap(); - HashMap> dataStoresDetails = inferDatastoreDetailsFromDiskInfo(hyperHost, context, disks); + HashMap> dataStoresDetails = inferDatastoreDetailsFromDiskInfo(hyperHost, context, disks, iqnToPath, cmd); if ((dataStoresDetails == null) || (dataStoresDetails.isEmpty())) { String msg = "Unable to locate datastore details of the volumes to be attached"; s_logger.error(msg); @@ -2699,6 +2549,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa for (DiskTO vol : disks) { if (vol.getType() == Volume.Type.ROOT) { DataStoreTO primaryStore = vol.getData().getDataStore(); + /** @todo Mike T. update this in 4.4 to support root disks on managed storage */ rootDiskDataStoreDetails = dataStoresDetails.get(primaryStore.getUuid()); } } @@ -2708,12 +2559,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (rootDiskDataStoreDetails.second().folderExists(String.format("[%s]", rootDiskDataStoreDetails.second().getName()), vmNameOnVcenter)) { s_logger.warn("WARN!!! Folder already exists on datastore for new VM " + vmNameOnVcenter + ", erase it"); rootDiskDataStoreDetails.second().deleteFile(String.format("[%s] %s/", rootDiskDataStoreDetails.second().getName(), vmNameOnVcenter), - dcMo.getMor(), false); + dcMo.getMor(), false); } if (!hyperHost.createBlankVm(vmNameOnVcenter, vmInternalCSName, vmSpec.getCpus(), vmSpec.getMaxSpeed().intValue(), - getReservedCpuMHZ(vmSpec), vmSpec.getLimitCpuUse(), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec), - translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(), rootDiskDataStoreDetails.first(), false)) { + getReservedCpuMHZ(vmSpec), vmSpec.getLimitCpuUse(), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec), + translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(), rootDiskDataStoreDetails.first(), false)) { throw new Exception("Failed to create VM. vmName: " + vmInternalCSName); } } @@ -2740,14 +2591,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String guestOsId = translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(); VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), - getReservedCpuMHZ(vmSpec), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec), - guestOsId, vmSpec.getLimitCpuUse()); + getReservedCpuMHZ(vmSpec), (int)(vmSpec.getMaxRam() / (1024 * 1024)), getReservedMemoryMb(vmSpec), + guestOsId, vmSpec.getLimitCpuUse()); // Check for hotadd settings vmConfigSpec.setMemoryHotAddEnabled(vmMo.isMemoryHotAddSupported(guestOsId)); vmConfigSpec.setCpuHotAddEnabled(vmMo.isCpuHotAddSupported(guestOsId)); configNestedHVSupport(vmMo, vmSpec, vmConfigSpec); + // Check for multi-cores per socket settings + String coresPerSocket = vmSpec.getDetails().get("cpu.corespersocket"); + if (coresPerSocket != null) { + vmConfigSpec.setNumCoresPerSocket(NumbersUtil.parseInt(coresPerSocket, 1)); + } + VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[totalChangeDevices]; int i = 0; int ideUnitNumber = 0; @@ -2780,8 +2637,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec(); Pair isoInfo = - VmwareHelper.prepareIsoDevice(vmMo, String.format("[%s] systemvm/%s", secDsMo.getName(), mgr.getSystemVMIsoFileNameOnDatastore()), secDsMo.getMor(), - true, true, ideUnitNumber++, i + 1); + VmwareHelper.prepareIsoDevice(vmMo, String.format("[%s] systemvm/%s", secDsMo.getName(), mgr.getSystemVMIsoFileNameOnDatastore()), secDsMo.getMor(), + true, true, ideUnitNumber++, i + 1); deviceConfigSpecArray[i].setDevice(isoInfo.first()); if (isoInfo.second()) { if (s_logger.isDebugEnabled()) @@ -2811,7 +2668,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec(); Pair isoInfo = - VmwareHelper.prepareIsoDevice(vmMo, isoDatastoreInfo.first(), isoDatastoreInfo.second(), true, true, ideUnitNumber++, i + 1); + VmwareHelper.prepareIsoDevice(vmMo, isoDatastoreInfo.first(), isoDatastoreInfo.second(), true, true, ideUnitNumber++, i + 1); deviceConfigSpecArray[i].setDevice(isoInfo.first()); if (isoInfo.second()) { if (s_logger.isDebugEnabled()) @@ -2859,20 +2716,35 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VolumeObjectTO volumeTO = (VolumeObjectTO)vol.getData(); DataStoreTO primaryStore = volumeTO.getDataStore(); - Pair volumeDsDetails = dataStoresDetails.get(primaryStore.getUuid()); + Map details = vol.getDetails(); + boolean managed = false; + String iScsiName = null; + + if (details != null) { + managed = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); + iScsiName = details.get(DiskTO.IQN); + } + + // if the storage is managed, iScsiName should not be null + String datastoreName = managed ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid(); + Pair volumeDsDetails = dataStoresDetails.get(datastoreName); + assert (volumeDsDetails != null); - String[] diskChain = syncDiskChain(dcMo, vmMo, vmSpec, vol, matchingExistingDisk, dataStoresDetails); - if (controllerKey == scsiControllerKey && VmwareHelper.isReservedScsiDeviceNumber(scsiUnitNumber)) + String[] diskChain = syncDiskChain(dcMo, vmMo, vmSpec, + vol, matchingExistingDisk, + dataStoresDetails); + if(controllerKey == scsiControllerKey && VmwareHelper.isReservedScsiDeviceNumber(scsiUnitNumber)) scsiUnitNumber++; - VirtualDevice device = - VmwareHelper.prepareDiskDevice(vmMo, null, controllerKey, diskChain, volumeDsDetails.first(), + VirtualDevice device = VmwareHelper.prepareDiskDevice(vmMo, null, controllerKey, + diskChain, + volumeDsDetails.first(), (controllerKey == ideControllerKey) ? ideUnitNumber++ : scsiUnitNumber++, i + 1); deviceConfigSpecArray[i].setDevice(device); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.ADD); - if (s_logger.isDebugEnabled()) + if(s_logger.isDebugEnabled()) s_logger.debug("Prepare volume at new device " + _gson.toJson(device)); i++; @@ -2910,12 +2782,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa dvSwitchUuid = dataCenterMo.getDvSwitchUuid(dvsMor); s_logger.info("Preparing NIC device on dvSwitch : " + dvSwitchUuid); nic = - VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), dvSwitchUuid, nicTo.getMac(), nicUnitNumber++, - i + 1, true, true); + VmwareHelper.prepareDvNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), dvSwitchUuid, nicTo.getMac(), nicUnitNumber++, + i + 1, true, true); } else { s_logger.info("Preparing NIC device on network " + networkInfo.second()); nic = - VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), nicTo.getMac(), nicUnitNumber++, i + 1, true, true); + VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), nicTo.getMac(), nicUnitNumber++, i + 1, true, true); } deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec(); @@ -2951,7 +2823,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (vmSpec.getDetails() != null) keyboardLayout = vmSpec.getDetails().get(VmDetailConstants.KEYBOARD); vmConfigSpec.getExtraConfig().addAll( - Arrays.asList(configureVnc(extraOptions.toArray(new OptionValue[0]), hyperHost, vmInternalCSName, vmSpec.getVncPassword(), keyboardLayout))); + Arrays.asList(configureVnc(extraOptions.toArray(new OptionValue[0]), hyperHost, vmInternalCSName, vmSpec.getVncPassword(), keyboardLayout))); // // Configure VM @@ -2976,7 +2848,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } state = State.Running; - return new StartAnswer(cmd); + + StartAnswer startAnswer = new StartAnswer(cmd); + + startAnswer.setIqnToPath(iqnToPath); + + return startAnswer; } catch (Throwable e) { if (e instanceof RemoteException) { s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context"); @@ -2997,6 +2874,25 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } + @Override + public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName, + String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret, + String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception { + ManagedObjectReference morDs = getVmfsDatastore(hyperHost, VmwareResource.getDatastoreName(iScsiName), + storageHost, storagePort, VmwareResource.trimIqn(iScsiName), chapInitiatorUsername, chapInitiatorSecret, + chapTargetUsername, chapTargetSecret); + + DatastoreMO dsMo = new DatastoreMO(getServiceContext(null), morDs); + + String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), dsMo.getName()); + + if (!dsMo.fileExists(volumeDatastorePath)) { + createVmdk(cmd, dsMo, volumeDatastorePath, size); + } + + return morDs; + } + int getReservedMemoryMb(VirtualMachineTO vmSpec) { if (vmSpec.getDetails().get(Config.VmwareReserveMem.key()).equalsIgnoreCase("true")) { return (int)(vmSpec.getMinRam() / (1024 * 1024)); @@ -3012,7 +2908,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return vmSpec.getMinSpeed(); } else if (vmSpec.getMinSpeed().intValue() != vmSpec.getMaxSpeed().intValue()) { s_logger.warn("cpu overprovisioning factor is set to " + (vmSpec.getMaxSpeed().intValue() / vmSpec.getMinSpeed().intValue()) + - " ignoring the flag vmware.reserve.cpu"); + " ignoring the flag vmware.reserve.cpu"); return vmSpec.getMinSpeed(); } return 0; @@ -3020,16 +2916,28 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // return the finalized disk chain for startup, from top to bottom private String[] syncDiskChain(DatacenterMO dcMo, VirtualMachineMO vmMo, VirtualMachineTO vmSpec, DiskTO vol, VirtualMachineDiskInfo diskInfo, - HashMap> dataStoresDetails) throws Exception { + HashMap> dataStoresDetails) throws Exception { VolumeObjectTO volumeTO = (VolumeObjectTO)vol.getData(); DataStoreTO primaryStore = volumeTO.getDataStore(); Map details = vol.getDetails(); - boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED)); + boolean isManaged = false; + String iScsiName = null; + + if (details != null) { + isManaged = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); + iScsiName = details.get(DiskTO.IQN); + } + + // if the storage is managed, iScsiName should not be null + String datastoreName = isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid(); + Pair volumeDsDetails = dataStoresDetails.get(datastoreName); - Pair volumeDsDetails = dataStoresDetails.get(primaryStore.getUuid()); if (volumeDsDetails == null) + { throw new Exception("Primary datastore " + primaryStore.getUuid() + " is not mounted on host."); + } + DatastoreMO dsMo = volumeDsDetails.second(); // we will honor vCenter's meta if it exists @@ -3262,7 +3170,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED)); VirtualMachineDiskInfo diskInfo = - diskInfoBuilder.getDiskInfoByBackingFileBaseName(isManaged ? new DatastoreFile(volume.getPath()).getFileBaseName() : volume.getPath()); + diskInfoBuilder.getDiskInfoByBackingFileBaseName(isManaged ? new DatastoreFile(volume.getPath()).getFileBaseName() : volume.getPath()); if (diskInfo != null) { s_logger.info("Found existing disk info from volume path: " + volume.getPath()); return diskInfo; @@ -3314,11 +3222,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (vmDetails != null && vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER) != null) { if (vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER).equalsIgnoreCase("scsi")) { s_logger.info("Chose disk controller for vol " + vol.getType() + " -> scsi, based on root disk controller settings: " + - vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER)); + vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER)); controllerKey = scsiControllerKey; } else { s_logger.info("Chose disk controller for vol " + vol.getType() + " -> ide, based on root disk controller settings: " + - vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER)); + vmDetails.get(VmDetailConstants.ROOK_DISK_CONTROLLER)); controllerKey = ideControllerKey; } } else { @@ -3336,7 +3244,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private void postDiskConfigBeforeStart(VirtualMachineMO vmMo, VirtualMachineTO vmSpec, DiskTO[] sortedDisks, int ideControllerKey, int scsiControllerKey) - throws Exception { + throws Exception { VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder(); @@ -3374,32 +3282,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return null; } - @Deprecated - private Map validateVmDetails(Map vmDetails) { - - Map validatedDetails = new HashMap(); - - if (vmDetails != null && vmDetails.size() > 0) { - for (Map.Entry entry : vmDetails.entrySet()) { - if ("machine.id".equalsIgnoreCase(entry.getKey())) - continue; - else if ("devices.hotplug".equalsIgnoreCase(entry.getKey())) - continue; - else if ("RemoteDisplay.vnc.enabled".equalsIgnoreCase(entry.getKey())) - continue; - else if ("RemoteDisplay.vnc.password".equalsIgnoreCase(entry.getKey())) - continue; - else if ("RemoteDisplay.vnc.port".equalsIgnoreCase(entry.getKey())) - continue; - else if ("RemoteDisplay.vnc.keymap".equalsIgnoreCase(entry.getKey())) - continue; - else - validatedDetails.put(entry.getKey(), entry.getValue()); - } - } - return validatedDetails; - } - private static NicTO[] sortNicsByDeviceId(NicTO[] nics) { List listForSort = new ArrayList(); @@ -3447,51 +3329,103 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private HashMap> inferDatastoreDetailsFromDiskInfo(VmwareHypervisorHost hyperHost, VmwareContext context, - DiskTO[] disks) throws Exception { - HashMap> poolMors = new HashMap>(); + DiskTO[] disks, Map iqnToPath, Command cmd) throws Exception { + HashMap> mapIdToMors = new HashMap>(); assert (hyperHost != null) && (context != null); + for (DiskTO vol : disks) { if (vol.getType() != Volume.Type.ISO) { VolumeObjectTO volumeTO = (VolumeObjectTO)vol.getData(); DataStoreTO primaryStore = volumeTO.getDataStore(); String poolUuid = primaryStore.getUuid(); - if (poolMors.get(poolUuid) == null) { + + if (mapIdToMors.get(poolUuid) == null) { boolean isManaged = false; - String iScsiName = null; Map details = vol.getDetails(); if (details != null) { isManaged = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); - iScsiName = details.get(DiskTO.IQN); } - ManagedObjectReference morDataStore = - HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, isManaged ? VmwareResource.getDatastoreName(iScsiName) : poolUuid); - if (morDataStore == null) { - String msg = "Failed to get the mounted datastore for the volume's pool " + poolUuid; - s_logger.error(msg); - throw new Exception(msg); + if (isManaged) { + String iScsiName = details.get(DiskTO.IQN); // details should not be null for managed storage (it may or may not be null for non-managed storage) + String datastoreName = VmwareResource.getDatastoreName(iScsiName); + ManagedObjectReference morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, datastoreName); + + // if the datastore is not present, we need to discover the iSCSI device that will support it, + // create the datastore, and create a VMDK file in the datastore + if (morDatastore == null) { + morDatastore = prepareManagedStorage(hyperHost, iScsiName, + details.get(DiskTO.STORAGE_HOST), Integer.parseInt(details.get(DiskTO.STORAGE_PORT)), + details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), + details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET), + Long.parseLong(details.get(DiskTO.VOLUME_SIZE)), cmd); + + DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDatastore); + String datastoreVolumePath = dsMo.getDatastorePath(dsMo.getName() + ".vmdk"); + + iqnToPath.put(iScsiName, datastoreVolumePath); + + volumeTO.setPath(datastoreVolumePath); + vol.setPath(datastoreVolumePath); + } + + mapIdToMors.put(datastoreName, new Pair(morDatastore, new DatastoreMO(context, morDatastore))); + } + else { + ManagedObjectReference morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, poolUuid); + + if (morDatastore == null) { + String msg = "Failed to get the mounted datastore for the volume's pool " + poolUuid; + + s_logger.error(msg); + + throw new Exception(msg); + } + + mapIdToMors.put(poolUuid, new Pair(morDatastore, new DatastoreMO(context, morDatastore))); } - poolMors.put(poolUuid, new Pair(morDataStore, new DatastoreMO(context, morDataStore))); } } } - return poolMors; + + return mapIdToMors; } private DatastoreMO getDatastoreThatRootDiskIsOn(HashMap> dataStoresDetails, DiskTO disks[]) { - Pair rootDiskDataStoreDetails = null; + for (DiskTO vol : disks) { if (vol.getType() == Volume.Type.ROOT) { - DataStoreTO primaryStore = vol.getData().getDataStore(); - rootDiskDataStoreDetails = dataStoresDetails.get(primaryStore.getUuid()); + Map details = vol.getDetails(); + boolean managed = false; + + if (details != null) { + managed = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); + } + + if (managed) { + String datastoreName = VmwareResource.getDatastoreName(details.get(DiskTO.IQN)); + + rootDiskDataStoreDetails = dataStoresDetails.get(datastoreName); + + break; + } + else { + DataStoreTO primaryStore = vol.getData().getDataStore(); + + rootDiskDataStoreDetails = dataStoresDetails.get(primaryStore.getUuid()); + + break; + } } } - if (rootDiskDataStoreDetails != null) + if (rootDiskDataStoreDetails != null) { return rootDiskDataStoreDetails.second(); + } + return null; } @@ -3528,24 +3462,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return defaultVlan; } - private Pair prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, VirtualMachine.Type vmType) - throws Exception { - Pair switchName; - TrafficType trafficType; - VirtualSwitchType switchType; + private Pair prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, VirtualMachine.Type vmType) throws Exception { - switchName = getTargetSwitch(nicTo); - trafficType = nicTo.getType(); - // Get switch type from resource property which is dictated by cluster property - // If a virtual switch type is specified while adding cluster that will be used. - // Else If virtual switch type is specified in physical traffic label that will be used - // Else use standard vSwitch - switchType = VirtualSwitchType.StandardVirtualSwitch; - if (trafficType == TrafficType.Guest && _guestTrafficInfo != null) { - switchType = _guestTrafficInfo.getVirtualSwitchType(); - } else if (trafficType == TrafficType.Public && _publicTrafficInfo != null) { - switchType = _publicTrafficInfo.getVirtualSwitchType(); - } + Ternary switchDetails = getTargetSwitch(nicTo); + nicTo.getType(); + VirtualSwitchType switchType = VirtualSwitchType.getType(switchDetails.second()); + String switchName = switchDetails.first(); + String vlanToken = switchDetails.third(); String namePrefix = getNetworkNamePrefix(nicTo); Pair networkInfo = null; @@ -3553,13 +3476,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Prepare network on " + switchType + " " + switchName + " with name prefix: " + namePrefix); if (VirtualSwitchType.StandardVirtualSwitch == switchType) { - synchronized (hostMo.getMor().getValue().intern()) { - networkInfo = - HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), - nicTo.getNetworkRateMulticastMbps(), _opsTimeout, !namePrefix.startsWith("cloud.private"), nicTo.getBroadcastType(), nicTo.getUuid()); + synchronized(hostMo.getMor().getValue().intern()) { + networkInfo = HypervisorHostHelper.prepareNetwork(switchName, namePrefix, hostMo, getVlanInfo(nicTo, vlanToken), nicTo.getNetworkRateMbps(), + nicTo.getNetworkRateMulticastMbps(), _opsTimeout, + !namePrefix.startsWith("cloud.private"), nicTo.getBroadcastType(), nicTo.getUuid()); } - } else { - String vlanId = getVlanInfo(nicTo, switchName.second()); + } + else { + String vlanId = getVlanInfo(nicTo, vlanToken); String svlanId = null; boolean pvlannetwork = (getPvlanInfo(nicTo) == null) ? false : true; if (vmType != null && vmType.equals(VirtualMachine.Type.DomainRouter) && pvlannetwork) { @@ -3569,48 +3493,65 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // plumb this network to the isolated vlan. svlanId = getPvlanInfo(nicTo); } - networkInfo = - HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, vlanId, svlanId, nicTo.getNetworkRateMbps(), - nicTo.getNetworkRateMulticastMbps(), _opsTimeout, switchType, _portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, - nicTo.getBroadcastType()); + networkInfo = HypervisorHostHelper.prepareNetwork(switchName, namePrefix, hostMo, vlanId, svlanId, + nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _opsTimeout, switchType, + _portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, nicTo.getBroadcastType()); } return networkInfo; } - // return Pair - private Pair getTargetSwitch(NicTO nicTo) throws Exception { - if (nicTo.getType() == Networks.TrafficType.Guest) { - return new Pair(_guestTrafficInfo.getVirtualSwitchName(), Vlan.UNTAGGED); - } else if (nicTo.getType() == Networks.TrafficType.Public) { - return new Pair(_publicTrafficInfo.getVirtualSwitchName(), Vlan.UNTAGGED); + // return Ternary + private Ternary getTargetSwitch(NicTO nicTo) throws CloudException { + TrafficType[] supportedTrafficTypes = + new TrafficType[] { + TrafficType.Guest, + TrafficType.Public, + TrafficType.Control, + TrafficType.Management, + TrafficType.Storage + }; + + TrafficType trafficType = nicTo.getType(); + if (!Arrays.asList(supportedTrafficTypes).contains(trafficType)) { + throw new CloudException("Traffic type " + trafficType.toString() + " for nic " + nicTo.toString() + " is not supported."); } - if (nicTo.getName() != null && !nicTo.getName().isEmpty()) { + String switchName = null; + VirtualSwitchType switchType = VirtualSwitchType.StandardVirtualSwitch; + String vlanToken = Vlan.UNTAGGED; + + // Get switch details from the nicTO object + if(nicTo.getName() != null && !nicTo.getName().isEmpty()) { String[] tokens = nicTo.getName().split(","); // Format of network traffic label is ,, // If all 3 fields are mentioned then number of tokens would be 3. // If only , are mentioned then number of tokens would be 2. - if (tokens.length == 2 || tokens.length == 3) { - String vlanToken = tokens[1]; + switchName = tokens[0]; + if(tokens.length == 2 || tokens.length == 3) { + vlanToken = tokens[1]; if (vlanToken.isEmpty()) { vlanToken = Vlan.UNTAGGED; } - return new Pair(tokens[0], vlanToken); - } else { - return new Pair(nicTo.getName(), Vlan.UNTAGGED); + if (tokens.length == 3) { + switchType = VirtualSwitchType.getType(tokens[2]); + } + } + } else { + if (trafficType == TrafficType.Guest && _guestTrafficInfo != null) { + switchType = _guestTrafficInfo.getVirtualSwitchType(); + switchName = _guestTrafficInfo.getVirtualSwitchName(); + } else if (trafficType == TrafficType.Public && _publicTrafficInfo != null) { + switchType = _publicTrafficInfo.getVirtualSwitchType(); + switchName = _publicTrafficInfo.getVirtualSwitchName(); } } - if (nicTo.getType() == Networks.TrafficType.Control || nicTo.getType() == Networks.TrafficType.Management) { - return new Pair(_privateNetworkVSwitchName, Vlan.UNTAGGED); - } else if (nicTo.getType() == Networks.TrafficType.Storage) { - return new Pair(_privateNetworkVSwitchName, Vlan.UNTAGGED); - } else if (nicTo.getType() == Networks.TrafficType.Vpn) { - throw new Exception("Unsupported traffic type: " + nicTo.getType().toString()); - } else { - throw new Exception("Unsupported traffic type: " + nicTo.getType().toString()); + if (nicTo.getType() == Networks.TrafficType.Control || nicTo.getType() == Networks.TrafficType.Management || nicTo.getType() == Networks.TrafficType.Storage) { + switchName = _privateNetworkVSwitchName; } + + return new Ternary(switchName, switchType.toString(), vlanToken); } private String getNetworkNamePrefix(NicTO nicTo) throws Exception { @@ -3634,14 +3575,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa StringBuffer argsBuf = new StringBuffer(); if (cmd.isCreate()) { argsBuf.append(" -r ") - .append(cmd.getIpRange()) - .append(" -p ") - .append(cmd.getPresharedKey()) - .append(" -s ") - .append(cmd.getVpnServerIp()) - .append(" -l ") - .append(cmd.getLocalIp()) - .append(" -c "); + .append(cmd.getIpRange()) + .append(" -p ") + .append(cmd.getPresharedKey()) + .append(" -s ") + .append(cmd.getVpnServerIp()) + .append(" -l ") + .append(cmd.getLocalIp()) + .append(" -c "); } else { argsBuf.append(" -d ").append(" -s ").append(cmd.getVpnServerIp()); @@ -3657,7 +3598,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpn_l2tp.sh " + argsBuf.toString()); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpn_l2tp.sh " + argsBuf.toString()); if (!result.first()) { s_logger.error("RemoteAccessVpnCfg command on domR failed, message: " + result.second()); @@ -3702,7 +3643,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } Pair result = - SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpn_l2tp.sh " + argsBuf.toString()); + SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpn_l2tp.sh " + argsBuf.toString()); if (!result.first()) { s_logger.error("VpnUserCfg command on domR failed, message: " + result.second()); @@ -4203,8 +4144,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VirtualMachineRelocateSpecDiskLocator diskLocator = null; boolean isFirstDs = true; - String srcDiskName = ""; - String srcDsName = ""; String tgtDsName = ""; String tgtDsNfsHost; String tgtDsNfsPath; @@ -4243,7 +4182,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa volume = entry.getKey(); filerTo = entry.getValue(); - srcDsName = volume.getPoolUuid().replace("-", ""); + volume.getPoolUuid().replace("-", ""); tgtDsName = filerTo.getUuid().replace("-", ""); tgtDsNfsHost = filerTo.getHost(); tgtDsNfsPath = filerTo.getPath(); @@ -4270,8 +4209,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa relocateSpec.setDatastore(morDsAtSource); isFirstDs = false; } - srcDiskName = - VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(new DatastoreMO(srcHyperHost.getContext(), morDsAtSource), vmName, volume.getPath() + + VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(new DatastoreMO(srcHyperHost.getContext(), morDsAtSource), vmName, volume.getPath() + ".vmdk"); diskLocator = new VirtualMachineRelocateSpecDiskLocator(); diskLocator.setDatastore(morDsAtSource); @@ -4337,7 +4275,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa srcHyperHost.unmountDatastore(mountedDatastore); } catch (Exception unmountEx) { s_logger.debug("Failed to unmount datastore " + mountedDatastore + " at " + _hostName + ". Seems the datastore is still being used by " + _hostName + - ". Please unmount manually to cleanup."); + ". Please unmount manually to cleanup."); } s_logger.debug("Successfully unmounted datastore " + mountedDatastore + " at " + _hostName); } @@ -4366,7 +4304,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa List diskLocators = new ArrayList(); VirtualMachineRelocateSpecDiskLocator diskLocator = null; - String srcDiskName = ""; String tgtDsName = ""; try { @@ -4390,8 +4327,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception(msg); } - srcDiskName = - VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(new DatastoreMO(srcHyperHost.getContext(), morDs), vmName, volumePath + ".vmdk"); + VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(new DatastoreMO(srcHyperHost.getContext(), morDs), vmName, volumePath + ".vmdk"); diskLocator = new VirtualMachineRelocateSpecDiskLocator(); diskLocator.setDatastore(morDs); diskLocator.setDiskId(getVirtualDiskInfo(vmMo, volumePath + ".vmdk")); @@ -4461,7 +4397,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, pool.getUuid()); if (morDatastore == null) morDatastore = - hyperHost.mountDatastore(pool.getType() == StoragePoolType.VMFS, pool.getHost(), pool.getPort(), pool.getPath(), pool.getUuid().replace("-", "")); + hyperHost.mountDatastore(pool.getType() == StoragePoolType.VMFS, pool.getHost(), pool.getPort(), pool.getPath(), pool.getUuid().replace("-", "")); assert (morDatastore != null); DatastoreSummary summary = new DatastoreMO(getServiceContext(), morDatastore).getSummary(); @@ -4511,7 +4447,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return str.replace('/', '-'); } - public static String trimIqn(String iqn) { + private static String trimIqn(String iqn) { String[] tmp = iqn.split("/"); if (tmp.length != 3) { @@ -4525,8 +4461,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return tmp[1].trim(); } - @Override - public void createVmdk(Command cmd, DatastoreMO dsMo, String vmdkDatastorePath, Long volumeSize) throws Exception { + private void createVmdk(Command cmd, DatastoreMO dsMo, String vmdkDatastorePath, Long volumeSize) throws Exception { VmwareContext context = getServiceContext(); VmwareHypervisorHost hyperHost = getHyperHost(context); @@ -4550,7 +4485,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareContext context = getServiceContext(); VmwareHypervisorHost hyperHost = getHyperHost(context); - deleteVmfsDatastore(hyperHost, getDatastoreName(iqn), storageHost, storagePort, trimIqn(iqn)); + deleteVmfsDatastore(hyperHost, VmwareResource.getDatastoreName(iqn), storageHost, storagePort, VmwareResource.trimIqn(iqn)); } protected Answer execute(AttachVolumeCommand cmd) { @@ -4575,18 +4510,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa ManagedObjectReference morDs = null; if (cmd.getAttach() && cmd.isManaged()) { - morDs = - getVmfsDatastore(hyperHost, getDatastoreName(cmd.get_iScsiName()), cmd.getStorageHost(), cmd.getStoragePort(), trimIqn(cmd.get_iScsiName()), - cmd.getChapInitiatorUsername(), cmd.getChapInitiatorPassword(), cmd.getChapTargetUsername(), cmd.getChapTargetPassword()); - - DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDs); - - String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), dsMo.getName()); - - if (!dsMo.fileExists(volumeDatastorePath)) { - createVmdk(cmd, dsMo, volumeDatastorePath, cmd.getVolumeSize()); - } - } else { + morDs = prepareManagedStorage(hyperHost, cmd.get_iScsiName(), cmd.getStorageHost(), cmd.getStoragePort(), + cmd.getChapInitiatorUsername(), cmd.getChapInitiatorPassword(), + cmd.getChapTargetUsername(), cmd.getChapTargetPassword(), cmd.getVolumeSize(), cmd); + } + else { morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, cmd.getPoolUuid()); } @@ -4670,7 +4598,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private void addRemoveInternetScsiTargetsToAllHosts(final boolean add, final List lstTargets, - final List> lstHosts) throws Exception { + final List> lstHosts) throws Exception { VmwareContext context = getServiceContext(); ExecutorService executorService = Executors.newFixedThreadPool(lstHosts.size()); @@ -4786,9 +4714,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } - @Override - public ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, String iqn, - String chapName, String chapSecret, String mutualChapName, String mutualChapSecret) throws Exception { + private ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, + String iqn, String chapName, String chapSecret, String mutualChapName, String mutualChapSecret) throws Exception { VmwareContext context = getServiceContext(); ManagedObjectReference morCluster = hyperHost.getHyperHostCluster(); ClusterMO cluster = new ClusterMO(context, morCluster); @@ -5025,7 +4952,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String actualSnapshotBackupUuid = null; String actualSnapshotUuid = null; return new ValidateSnapshotAnswer(cmd, false, "ValidateSnapshotCommand is not supported for vmware yet", expectedSnapshotBackupUuid, actualSnapshotBackupUuid, - actualSnapshotUuid); + actualSnapshotUuid); } protected Answer execute(ManageSnapshotCommand cmd) { @@ -5212,7 +5139,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isDebugEnabled()) { s_logger.debug("Datastore summary info, storageId: " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + - cmd.getPooltype() + ", capacity: " + capacity + ", free: " + free + ", used: " + used); + cmd.getPooltype() + ", capacity: " + capacity + ", free: " + free + ", used: " + used); } if (summary.getCapacity() <= 0) { @@ -5222,8 +5149,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new GetStorageStatsAnswer(cmd, capacity, used); } else { String msg = - "Could not find datastore for GetStorageStatsCommand storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + - cmd.getPooltype(); + "Could not find datastore for GetStorageStatsCommand storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + + cmd.getPooltype(); s_logger.error(msg); return new GetStorageStatsAnswer(cmd, msg); @@ -5235,7 +5162,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } String msg = - "Unable to execute GetStorageStatsCommand(storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + cmd.getPooltype() + + "Unable to execute GetStorageStatsCommand(storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + cmd.getPooltype() + ") due to " + VmwareHelper.getExceptionMessage(e); s_logger.error(msg, e); return new GetStorageStatsAnswer(cmd, msg); @@ -5313,7 +5240,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new Answer(cmd); } catch (Exception e) { s_logger.error( - "Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); + "Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); } return new Answer(cmd, false, "PingTestCommand failed"); } @@ -5644,7 +5571,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private boolean createVMFullClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, String vmdkName, ManagedObjectReference morDatastore, - ManagedObjectReference morPool) throws Exception { + ManagedObjectReference morPool) throws Exception { if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmdkName)) dsMo.deleteFile(String.format("[%s] %s/", dsMo.getName(), vmdkName), dcMo.getMor(), false); @@ -5660,16 +5587,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // to move files s_logger.info("Move volume out of volume-wrapper VM "); dsMo.moveDatastoreFile(String.format("[%s] %s/%s.vmdk", dsMo.getName(), vmdkName, vmdkName), dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); dsMo.moveDatastoreFile(String.format("[%s] %s/%s-flat.vmdk", dsMo.getName(), vmdkName, vmdkName), dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s-flat.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + String.format("[%s] %s-flat.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); return true; } private boolean createVMLinkedClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, String vmdkName, ManagedObjectReference morDatastore, - ManagedObjectReference morPool) throws Exception { + ManagedObjectReference morPool) throws Exception { ManagedObjectReference morBaseSnapshot = vmTemplate.getSnapshotMor("cloud.template.base"); if (morBaseSnapshot == null) { @@ -5692,10 +5619,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // to move files s_logger.info("Move volume out of volume-wrapper VM "); dsMo.moveDatastoreFile(String.format("[%s] %s/%s.vmdk", dsMo.getName(), vmdkName, vmdkName), dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); dsMo.moveDatastoreFile(String.format("[%s] %s/%s-delta.vmdk", dsMo.getName(), vmdkName, vmdkName), dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s-delta.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + String.format("[%s] %s-delta.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); return true; } @@ -5742,8 +5669,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vmMo.detachDisk(volumeDatastorePath, false); VolumeTO vol = - new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), vmdkName, dskch.getSize(), - null); + new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), vmdkName, dskch.getSize(), + null); return new CreateAnswer(cmd, vol); } finally { vmMo.detachAllDisks(); @@ -5779,7 +5706,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa dsMo.deleteFile(srcFile, dcMo.getMor(), true); VolumeTO vol = - new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), vmdkName, dskch.getSize(), null); + new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), vmdkName, dskch.getSize(), null); return new CreateAnswer(cmd, vol); } } else { @@ -5801,8 +5728,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vmMo.detachDisk(volumeDatastorePath, false); VolumeTO vol = - new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), volumeUuid, dskch.getSize(), - null); + new VolumeTO(cmd.getVolumeId(), dskch.getType(), pool.getType(), pool.getUuid(), dskch.getName(), pool.getPath(), volumeUuid, dskch.getSize(), + null); return new CreateAnswer(cmd, vol); } finally { s_logger.info("Destroy dummy VM after volume creation"); @@ -6001,7 +5928,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa DatastoreSummary dsSummary = dsMo.getSummary(); String address = hostMo.getHostName(); StoragePoolInfo pInfo = - new StoragePoolInfo(poolUuid, address, dsMo.getMor().getValue(), "", StoragePoolType.LVM, dsSummary.getCapacity(), dsSummary.getFreeSpace()); + new StoragePoolInfo(poolUuid, address, dsMo.getMor().getValue(), "", StoragePoolType.LVM, dsSummary.getCapacity(), dsSummary.getFreeSpace()); StartupStorageCommand cmd = new StartupStorageCommand(); cmd.setName(poolUuid); cmd.setPoolInfo(pInfo); @@ -6219,7 +6146,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (oldState != State.Starting && oldState != State.Migrating) { s_logger.debug("VM " + vm + - " is now missing from host report and VM is not at starting/migrating state, remove it from host VM-sync map, oldState: " + oldState); + " is now missing from host report and VM is not at starting/migrating state, remove it from host VM-sync map, oldState: " + oldState); _vms.remove(vm); } else { s_logger.debug("VM " + vm + " is missing from host report, but we will ignore VM " + vm + " in transition state " + oldState); @@ -6265,7 +6192,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } protected OptionValue[] configureVnc(OptionValue[] optionsToMerge, VmwareHypervisorHost hyperHost, String vmName, String vncPassword, String keyboardLayout) - throws Exception { + throws Exception { VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); @@ -6468,7 +6395,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa PerfCounterInfo rxPerfCounterInfo = null; PerfCounterInfo txPerfCounterInfo = null; - List cInfo = (List)getServiceContext().getVimClient().getDynamicProperty(perfMgr, "perfCounter"); + List cInfo = getServiceContext().getVimClient().getDynamicProperty(perfMgr, "perfCounter"); for (PerfCounterInfo info : cInfo) { if ("net".equalsIgnoreCase(info.getGroupInfo().getKey())) { if ("transmitted".equalsIgnoreCase(info.getNameInfo().getKey())) { @@ -6487,7 +6414,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String instanceNameCustomField = "value[" + key + "]"; ObjectContent[] ocs = - hyperHost.getVmPropertiesOnHyperHost(new String[] {"name", "summary.config.numCpu", "summary.quickStats.overallCpuUsage", instanceNameCustomField}); + hyperHost.getVmPropertiesOnHyperHost(new String[] {"name", "summary.config.numCpu", "summary.quickStats.overallCpuUsage", instanceNameCustomField}); if (ocs != null && ocs.length > 0) { for (ObjectContent oc : ocs) { List objProps = oc.getPropSet(); @@ -6509,7 +6436,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa maxCpuUsage = objProp.getVal().toString(); } } - VirtualMachineMO vmMo = new VirtualMachineMO(hyperHost.getContext(), oc.getObj()); + new VirtualMachineMO(hyperHost.getContext(), oc.getObj()); if (vmInternalCSName != null) { name = vmInternalCSName; } else { @@ -6523,13 +6450,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa ManagedObjectReference vmMor = hyperHost.findVmOnHyperHost(name).getMor(); assert (vmMor != null); - ArrayList vmNetworkMetrics = new ArrayList(); + ArrayList vmNetworkMetrics = new ArrayList(); // get all the metrics from the available sample period List perfMetrics = service.queryAvailablePerfMetric(perfMgr, vmMor, null, null, null); if (perfMetrics != null) { for (int index = 0; index < perfMetrics.size(); ++index) { if (((rxPerfCounterInfo != null) && (perfMetrics.get(index).getCounterId() == rxPerfCounterInfo.getKey())) || - ((txPerfCounterInfo != null) && (perfMetrics.get(index).getCounterId() == txPerfCounterInfo.getKey()))) { + ((txPerfCounterInfo != null) && (perfMetrics.get(index).getCounterId() == txPerfCounterInfo.getKey()))) { vmNetworkMetrics.add(perfMetrics.get(index)); } } @@ -6542,7 +6469,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (vmNetworkMetrics.size() != 0) { PerfQuerySpec qSpec = new PerfQuerySpec(); qSpec.setEntity(vmMor); - PerfMetricId[] availableMetricIds = (PerfMetricId[])vmNetworkMetrics.toArray(new PerfMetricId[0]); + PerfMetricId[] availableMetricIds = vmNetworkMetrics.toArray(new PerfMetricId[0]); qSpec.getMetricId().addAll(Arrays.asList(availableMetricIds)); List qSpecs = new ArrayList(); qSpecs.add(qSpec); @@ -6603,7 +6530,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = - SshHelper.sshExecute(privateIpAddress, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/netusage.sh " + args); + SshHelper.sshExecute(privateIpAddress, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/netusage.sh " + args); if (!result.first()) { return null; @@ -6612,8 +6539,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return result.second(); } catch (Throwable e) { s_logger.error( - "Unable to execute NetworkUsage command on DomR (" + privateIpAddress + "), domR may not be ready yet. failure due to " + - VmwareHelper.getExceptionMessage(e), e); + "Unable to execute NetworkUsage command on DomR (" + privateIpAddress + "), domR may not be ready yet. failure due to " + + VmwareHelper.getExceptionMessage(e), e); } return null; @@ -6782,7 +6709,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(context, context.getServiceContent().getCustomFieldsManager()); cfmMo.ensureCustomFieldDef("Datastore", CustomFieldConstants.CLOUD_UUID); if (_publicTrafficInfo != null && _publicTrafficInfo.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch || _guestTrafficInfo != null && - _guestTrafficInfo.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch) { + _guestTrafficInfo.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch) { cfmMo.ensureCustomFieldDef("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP); } cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC); @@ -6797,7 +6724,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa Map vsmCredentials; if (_guestTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch || - _publicTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) { + _publicTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) { vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster)); if (vsmCredentials != null) { s_logger.info("Stocking credentials while configuring resource."); @@ -6837,8 +6764,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa _portsPerDvPortGroup = intObj.intValue(); s_logger.info("VmwareResource network configuration info." + " private traffic over vSwitch: " + _privateNetworkVSwitchName + ", public traffic over " + - _publicTrafficInfo.getVirtualSwitchType() + " : " + _publicTrafficInfo.getVirtualSwitchName() + ", guest traffic over " + - _guestTrafficInfo.getVirtualSwitchType() + " : " + _guestTrafficInfo.getVirtualSwitchName()); + _publicTrafficInfo.getVirtualSwitchType() + " : " + _publicTrafficInfo.getVirtualSwitchName() + ", guest traffic over " + + _guestTrafficInfo.getVirtualSwitchType() + " : " + _guestTrafficInfo.getVirtualSwitchName()); value = params.get("vmware.create.full.clone").toString(); if (value != null && value.equalsIgnoreCase("true")) { @@ -6858,7 +6785,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa int timeout = NumbersUtil.parseInt(value, 1440) * 1000; VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); VmwareStorageProcessor storageProcessor = - new VmwareStorageProcessor((VmwareHostService)this, _fullCloneFlag, (VmwareStorageMount)mgr, timeout, this, _shutdownWaitMs, null); + new VmwareStorageProcessor((VmwareHostService)this, _fullCloneFlag, (VmwareStorageMount)mgr, timeout, this, _shutdownWaitMs, null); storageHandler = new VmwareStorageSubsystemCommandHandler(storageProcessor); return true; @@ -7029,9 +6956,4 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new Answer(cmd, false, msg); } } - - private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception { - GuestInfo guestInfo = vmMo.getVmGuestInfo(); - return (guestInfo != null && guestInfo.getGuestState() != null && guestInfo.getGuestState().equalsIgnoreCase("running")); - } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceVO.java b/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceVO.java index afc52b56edf..0cb40286e3d 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceVO.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceVO.java @@ -40,6 +40,8 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice { // We need to know what properties a VSM has. Put them here. + private static final long serialVersionUID = 3091674059522739481L; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -167,11 +169,11 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice { // Setter methods public void setHostId(long hostid) { - this.hostId = hostid; + hostId = hostid; } public void setVsmUserName(String username) { - this.vsmUserName = username; + vsmUserName = username; } public void setVsmName(String vsmName) { @@ -179,7 +181,7 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice { } public void setVsmPassword(String password) { - this.vsmPassword = password; + vsmPassword = password; } public void setMgmtIpAddr(String ipaddr) { @@ -187,50 +189,50 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice { } public void setManagementVlan(int vlan) { - this.managementVlan = vlan; + managementVlan = vlan; } public void setControlVlan(int vlan) { - this.controlVlan = vlan; + controlVlan = vlan; } public void setPacketVlan(int vlan) { - this.packetVlan = vlan; + packetVlan = vlan; } public void setStorageVlan(int vlan) { - this.storageVlan = vlan; + storageVlan = vlan; } public void setVsmDomainId(long id) { - this.vsmDomainId = id; + vsmDomainId = id; } public void setVsmConfigMode(VSMConfigMode mode) { - this.vsmConfigMode = mode; + vsmConfigMode = mode; } public void setVsmConfigState(VSMConfigState state) { - this.vsmConfigState = state; + vsmConfigState = state; } public void setVsmDeviceState(VSMDeviceState devState) { - this.vsmDeviceState = devState; + vsmDeviceState = devState; } // Constructors. public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String password) { // Set all the VSM's properties here. - this.uuid = UUID.randomUUID().toString(); - this.setMgmtIpAddr(vsmIpAddr); - this.setVsmUserName(username); - this.setVsmPassword(password); - this.setVsmName(vsmName); - this.setVsmDeviceState(VSMDeviceState.Enabled); + uuid = UUID.randomUUID().toString(); + setMgmtIpAddr(vsmIpAddr); + setVsmUserName(username); + setVsmPassword(password); + setVsmName(vsmName); + setVsmDeviceState(VSMDeviceState.Enabled); } public CiscoNexusVSMDeviceVO() { - this.uuid = UUID.randomUUID().toString(); + uuid = UUID.randomUUID().toString(); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java index e92954e99b8..c33af27d244 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java @@ -269,8 +269,6 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme throw new CloudRuntimeException(msg); } - Transaction txn; - // If VSM already exists and is mapped to a cluster, fail this operation. vsm = _vsmDao.getVSMbyIpaddress(vsmIp); if (vsm != null) { diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java index 7e08aeceac9..baaaf217332 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java @@ -42,13 +42,11 @@ import com.cloud.hypervisor.vmware.manager.VmwareStorageManager; import com.cloud.hypervisor.vmware.manager.VmwareStorageManagerImpl; import com.cloud.hypervisor.vmware.manager.VmwareStorageMount; import com.cloud.hypervisor.vmware.mo.ClusterMO; -import com.cloud.hypervisor.vmware.mo.DatastoreMO; import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.VmwareHostType; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary; import com.cloud.hypervisor.vmware.util.VmwareContext; -import com.cloud.hypervisor.vmware.util.VmwareHelper; import com.cloud.serializer.GsonHelper; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; @@ -126,7 +124,7 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe } protected Answer execute(CreateEntityDownloadURLCommand cmd) { - boolean result = _storageMgr.execute(this, cmd); + _storageMgr.execute(this, cmd); return _resource.defaultAction(cmd); } @@ -316,54 +314,10 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe return _resource.getRootDir(storageUrl); } - private boolean validateContext(VmwareContext context, Command cmd) { - String guid = cmd.getContextParam("guid"); - assert (guid != null); - - String[] tokens = guid.split("@"); - assert (tokens != null && tokens.length == 2); - - ManagedObjectReference morHyperHost = new ManagedObjectReference(); - String[] hostTokens = tokens[0].split(":"); - assert (hostTokens.length == 2); - - morHyperHost.setType(hostTokens[0]); - morHyperHost.setValue(hostTokens[1]); - - if (morHyperHost.getType().equalsIgnoreCase("HostSystem")) { - HostMO hostMo = new HostMO(context, morHyperHost); - try { - VmwareHypervisorHostNetworkSummary netSummary = - hostMo.getHyperHostNetworkSummary(hostMo.getHostType() == VmwareHostType.ESXi ? cmd.getContextParam("manageportgroup") - : cmd.getContextParam("serviceconsole")); - assert (netSummary != null); - if (netSummary.getHostIp() != null && !netSummary.getHostIp().isEmpty()) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Context validation succeeded. Validated via host: " + netSummary.getHostIp() + ", guid: " + guid); - } - return true; - } - - s_logger.warn("Context validation failed due to invalid host network summary"); - return false; - } catch (Throwable e) { - s_logger.warn("Context validation failed due to " + VmwareHelper.getExceptionMessage(e)); - return false; - } - } - - assert (false); - return true; - } - @Override - public ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, String iqn, - String initiatorChapName, String initiatorChapSecret, String mutualChapName, String mutualChapSecret) throws Exception { - throw new OperationNotSupportedException(); - } - - @Override - public void createVmdk(Command cmd, DatastoreMO dsMo, String volumeDatastorePath, Long volumeSize) throws Exception { + public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName, + String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret, + String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception { throw new OperationNotSupportedException(); } diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index 70c8c885817..0ed09c4c82b 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -1155,22 +1155,13 @@ public class VmwareStorageProcessor implements StorageProcessor { if (isAttach && isManaged) { Map details = disk.getDetails(); - morDs = - hostService.getVmfsDatastore(hyperHost, VmwareResource.getDatastoreName(iScsiName), storageHost, storagePort, VmwareResource.trimIqn(iScsiName), - details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), details.get(DiskTO.CHAP_TARGET_USERNAME), - details.get(DiskTO.CHAP_TARGET_SECRET)); - - DatastoreMO dsMo = new DatastoreMO(hostService.getServiceContext(null), morDs); - - String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), dsMo.getName()); - - if (!dsMo.fileExists(volumeDatastorePath)) { - hostService.createVmdk(cmd, dsMo, volumeDatastorePath, volumeTO.getSize()); - } - } else { - morDs = - HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, - isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid()); + morDs = hostService.prepareManagedStorage(hyperHost, iScsiName, storageHost, storagePort, + details.get(DiskTO.CHAP_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), + details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET), + volumeTO.getSize(), cmd); + } + else { + morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid()); } if (morDs == null) { diff --git a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java index 9f817add11d..2e3d41c0485 100644 --- a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java +++ b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java @@ -86,7 +86,7 @@ public class VmwareResourceTest { doReturn(false).when(vmSpec).getLimitCpuUse(); when(vmMo.configureVm(vmConfigSpec)).thenReturn(true); - ScaleVmAnswer answer = _resource.execute(cmd); + _resource.execute(cmd); verify(_resource).execute(cmd); } diff --git a/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java b/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java index 44296c93b2b..e3cc2f6056f 100644 --- a/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java +++ b/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java @@ -142,7 +142,7 @@ public class VmwareStorageMotionStrategyTest { when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); - assertTrue("Migration within cluster isn't successful.", this.result.isSuccess()); + assertTrue("Migration within cluster isn't successful.", result.isSuccess()); } @Test @@ -166,7 +166,7 @@ public class VmwareStorageMotionStrategyTest { when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); - assertFalse("Migration within cluster didn't fail.", this.result.isSuccess()); + assertFalse("Migration within cluster didn't fail.", result.isSuccess()); } @Test @@ -190,7 +190,7 @@ public class VmwareStorageMotionStrategyTest { when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); - assertTrue("Migration across cluster isn't successful.", this.result.isSuccess()); + assertTrue("Migration across cluster isn't successful.", result.isSuccess()); } @Test @@ -214,25 +214,20 @@ public class VmwareStorageMotionStrategyTest { when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); - assertFalse("Migration across cluster didn't fail.", this.result.isSuccess()); + assertFalse("Migration across cluster didn't fail.", result.isSuccess()); } private class MockContext extends AsyncRpcContext { - final Map volumeToPool; - final AsyncCallFuture future; - /** * @param callback */ public MockContext(AsyncCompletionCallback callback, AsyncCallFuture future, Map volumeToPool) { super(callback); - this.volumeToPool = volumeToPool; - this.future = future; } } protected Void mockCallBack(AsyncCallbackDispatcher callback, MockContext context) { - this.result = callback.getResult(); + result = callback.getResult(); return null; } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java index 4f21a021b75..529e26125f3 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java @@ -108,7 +108,11 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru if (volume.getVolumeType() == Volume.Type.DATADISK) { StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); - if (storagePool.isManaged()) { + // storagePool should be null if we are expunging a volume that was never + // attached to a VM that was started (the "trick" for storagePool to be null + // is that none of the VMs this volume may have been attached to were ever started, + // so the volume was never assigned to a storage pool) + if (storagePool != null && storagePool.isManaged()) { DataTO volTO = _volFactory.getVolume(volume.getId()).getTO(); DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType()); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index cd1b30b9f71..58fe0159815 100755 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -195,8 +195,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L String hostIp = ia.getHostAddress(); Queue pass = new LinkedList(); pass.add(password); - String masterIp = _connPool.getMasterIp(hostIp, username, pass); - conn = _connPool.masterConnect(masterIp, username, pass); + conn = _connPool.getConnect(hostIp, username, pass); if (conn == null) { String msg = "Unable to get a connection to " + url; s_logger.debug(msg); @@ -398,7 +397,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L password = host.getDetail("password"); pass.add(password); String address = host.getPrivateIpAddress(); - Connection hostConn = _connPool.slaveConnect(address, username, pass); + Connection hostConn = _connPool.getConnect(address, username, pass); if (hostConn == null) { continue; } @@ -411,9 +410,9 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L } catch (Exception e) { s_logger.warn("Can not get master ip address from host " + address); } finally { - try { - Session.localLogout(hostConn); - } catch (Exception e) { + try{ + Session.logout(hostConn); + } catch (Exception e ) { } hostConn.dispose(); hostConn = null; diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index accaa85230f..ed9eec1dda3 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -16,46 +16,6 @@ // under the License. package com.cloud.hypervisor.xen.resource; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Queue; -import java.util.Random; -import java.util.Set; -import java.util.UUID; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.apache.cloudstack.storage.command.StorageSubSystemCommand; -import org.apache.cloudstack.storage.to.TemplateObjectTO; -import org.apache.cloudstack.storage.to.VolumeObjectTO; -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; -import org.apache.xmlrpc.XmlRpcException; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - import com.cloud.agent.IAgentControl; import com.cloud.agent.api.Answer; import com.cloud.agent.api.AttachIsoCommand; @@ -274,6 +234,44 @@ import com.xensource.xenapi.VLAN; import com.xensource.xenapi.VM; import com.xensource.xenapi.VMGuestMetrics; import com.xensource.xenapi.XenAPIObject; +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; +import org.apache.cloudstack.storage.to.TemplateObjectTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; +import org.apache.xmlrpc.XmlRpcException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Queue; +import java.util.Random; +import java.util.Set; +import java.util.UUID; /** @@ -426,23 +424,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected boolean pingXenServer() { - Session slaveSession = null; - Connection slaveConn = null; + Connection conn = getConnection(); try { - URL slaveUrl = null; - slaveUrl = ConnPool.getURL(_host.ip); - slaveConn = new Connection(slaveUrl, 10); - slaveSession = ConnPool.slaveLocalLoginWithPassword(slaveConn, _username, _password); + callHostPlugin(conn, "echo", "main"); return true; } catch (Exception e) { - } finally { - if (slaveSession != null) { - try { - Session.localLogout(slaveConn); - } catch (Exception e) { - } - slaveConn.dispose(); - } + s_logger.debug("cannot ping host " + _host.ip + " due to " + e.toString(), e); } return false; } @@ -623,6 +610,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } + public String routerProxy(String script, String routerIP, String args) { + Connection conn = getConnection(); + String proxyArgs = script + " " + routerIP + " " + args; + return callHostPlugin(conn, "vmops", "routerProxy", "args", proxyArgs); + } + private Answer execute(PerformanceMonitorCommand cmd) { Connection conn = getConnection(); String perfMon = getPerfMon(conn, cmd.getParams(), cmd.getWait()); @@ -1262,10 +1255,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - protected VBD createVbd(Connection conn, DiskTO volume, String vmName, VM vm, BootloaderType bootLoaderType) throws XmlRpcException, XenAPIException { + protected VBD createVbd(Connection conn, DiskTO volume, String vmName, VM vm, BootloaderType bootLoaderType, VDI vdi) throws XmlRpcException, XenAPIException { Volume.Type type = volume.getType(); - VDI vdi = mount(conn, vmName, volume); + if (vdi == null) { + vdi = mount(conn, vmName, volume); + } if (vdi != null) { if ("detached".equals(vdi.getNameLabel(conn))) { @@ -1754,7 +1749,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe vm = createVmFromTemplate(conn, vmSpec, host); for (DiskTO disk : vmSpec.getDisks()) { - createVbd(conn, disk, vmName, vm, vmSpec.getBootloader()); + VDI newVdi = prepareManagedDisk(conn, disk, vmName); + + if (newVdi != null) { + String path = newVdi.getUuid(conn); + + iqnToPath.put(disk.getDetails().get(DiskTO.IQN), path); + } + + createVbd(conn, disk, vmName, vm, vmSpec.getBootloader(), newVdi); } if (vmSpec.getType() != VirtualMachine.Type.User) { @@ -1866,6 +1869,53 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } + // the idea here is to see if the DiskTO in question is from managed storage and + // does not yet have an SR + // if no SR, create it and create a VDI in it + private VDI prepareManagedDisk(Connection conn, DiskTO disk, String vmName) throws Exception { + Map details = disk.getDetails(); + + if (details == null) { + return null; + } + + boolean isManaged = new Boolean(details.get(DiskTO.MANAGED)).booleanValue(); + + if (!isManaged) { + return null; + } + + String iqn = details.get(DiskTO.IQN); + + Set srNameLabels = SR.getByNameLabel(conn, iqn); + + if (srNameLabels.size() != 0) { + return null; + } + + String vdiNameLabel = vmName + "-DATA"; + + return prepareManagedStorage(conn, details, null, vdiNameLabel); + } + + protected VDI prepareManagedStorage(Connection conn, Map details, String path, String vdiNameLabel) throws Exception { + String iScsiName = details.get(DiskTO.IQN); + String storageHost = details.get(DiskTO.STORAGE_HOST); + String chapInitiatorUsername = details.get(DiskTO.CHAP_INITIATOR_USERNAME); + String chapInitiatorSecret = details.get(DiskTO.CHAP_INITIATOR_SECRET); + Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE)); + + SR sr = getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, true); + + VDI vdi = getVDIbyUuid(conn, path, false); + + if (vdi == null) { + vdi = createVdi(sr, vdiNameLabel, volumeSize); + } + + return vdi; + } + protected Answer execute(ModifySshKeysCommand cmd) { return new Answer(cmd); } @@ -1910,12 +1960,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) { - Connection conn = getConnection(); - String args = "checkbatchs2svpn.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String args = ""; for (String ip : cmd.getVpnIps()) { - args += " " + ip; + args += ip + " "; } - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("checkbatchs2svpn.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new CheckS2SVpnConnectionsAnswer(cmd, false, "CheckS2SVpnConneciontsCommand failed"); } @@ -1923,9 +1972,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } private CheckRouterAnswer execute(CheckRouterCommand cmd) { - Connection conn = getConnection(); - String args = "checkrouter.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("checkrouter.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null); if (result == null || result.isEmpty()) { return new CheckRouterAnswer(cmd, "CheckRouterCommand failed"); } @@ -1933,9 +1980,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } private GetDomRVersionAnswer execute(GetDomRVersionCmd cmd) { - Connection conn = getConnection(); - String args = "get_template_version.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("get_template_version.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null); if (result == null || result.isEmpty()) { return new GetDomRVersionAnswer(cmd, "getDomRVersionCmd failed"); } @@ -1948,8 +1993,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe private Answer execute(BumpUpPriorityCommand cmd) { Connection conn = getConnection(); - String args = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String result = callHostPlugin(conn, "vmops", "bumpUpPriority", "args", args); + String args = "bumpup_priority.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "BumpUpPriorityCommand failed"); } @@ -1991,7 +2036,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe boolean endResult = true; for (PortForwardingRuleTO rule : cmd.getRules()) { StringBuilder args = new StringBuilder(); - args.append(routerIp); args.append(rule.revoked() ? " -D " : " -A "); args.append(" -P ").append(rule.getProtocol().toLowerCase()); args.append(" -l ").append(rule.getSrcIp()); @@ -1999,7 +2043,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args.append(" -r ").append(rule.getDstIp()); args.append(" -d ").append(rule.getStringDstPortRange()); - String result = callHostPlugin(conn, "vmops", "setFirewallRule", "args", args.toString()); + String result = routerProxy("firewall_nat.sh", routerIp, args.toString()); if (result == null || result.isEmpty()) { results[i++] = "Failed"; @@ -2013,18 +2057,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected SetStaticNatRulesAnswer SetVPCStaticNatRules(SetStaticNatRulesCommand cmd) { - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); //String args = routerIp; String[] results = new String[cmd.getRules().length]; int i = 0; boolean endResult = true; for (StaticNatRuleTO rule : cmd.getRules()) { - String args = "vpc_staticnat.sh " + routerIp; - args += rule.revoked() ? " -D" : " -A"; + String args = rule.revoked() ? "-D" : "-A"; args += " -l " + rule.getSrcIp(); args += " -r " + rule.getDstIp(); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args.toString()); + String result = routerProxy("vpc_staticnat.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { results[i++] = "Failed"; @@ -2043,14 +2084,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Connection conn = getConnection(); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - //String args = routerIp; String[] results = new String[cmd.getRules().length]; int i = 0; boolean endResult = true; for (StaticNatRuleTO rule : cmd.getRules()) { //1:1 NAT needs instanceip;publicip;domrip;op StringBuilder args = new StringBuilder(); - args.append(routerIp); args.append(rule.revoked() ? " -D " : " -A "); args.append(" -l ").append(rule.getSrcIp()); args.append(" -r ").append(rule.getDstIp()); @@ -2062,7 +2101,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args.append(" -d ").append(rule.getStringSrcPortRange()); args.append(" -G "); - String result = callHostPlugin(conn, "vmops", "setFirewallRule", "args", args.toString()); + String result = routerProxy("firewall_nat.sh", routerIp, args.toString()); if (result == null || result.isEmpty()) { results[i++] = "Failed"; @@ -2075,8 +2114,66 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new SetStaticNatRulesAnswer(cmd, results, endResult); } - protected Answer VPCLoadBalancerConfig(final LoadBalancerConfigCommand cmd) { + protected Answer execute(final CreateIpAliasCommand cmd) { + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + List ipAliasTOs = cmd.getIpAliasList(); + String args = ""; + for (IpAliasTO ipaliasto : ipAliasTOs) { + args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; + } + String result = routerProxy("createipAlias.sh", routerIp, args); + if (result == null || result.isEmpty()) { + return new Answer(cmd, false, "CreateIPAliasCommand failed\n"); + } + + return new Answer(cmd); + } + + protected Answer execute(final DeleteIpAliasCommand cmd) { + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + List revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); + String args = ""; + for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { + args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; + } + //this is to ensure that thre is some argument passed to the deleteipAlias script when there are no revoked rules. + args = args + "- "; + List activeIpAliasTOs = cmd.getCreateIpAliasTos(); + for (IpAliasTO ipAliasTO : activeIpAliasTOs) { + args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; + } + String result = routerProxy("deleteipAlias", routerIp, args); + if (result == null || result.isEmpty()) { + return new Answer(cmd, false, "DeleteipAliasCommand failed\n"); + } + + return new Answer(cmd); + } + + protected Answer execute(final DnsMasqConfigCommand cmd) { + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + List dhcpTos = cmd.getIps(); + String args = ""; + for (DhcpTO dhcpTo : dhcpTos) { + args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; + } + + String result = routerProxy("dnsmasq.sh", routerIp, args); + + if (result == null || result.isEmpty()) { + return new Answer(cmd, false, "DnsMasqconfigCommand failed"); + } + + return new Answer(cmd); + + } + + protected String createFileInVR(String routerIp, String path, String content) { Connection conn = getConnection(); + return callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "filepath", path, "filecontents", content); + } + + protected Answer execute(final LoadBalancerConfigCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); if (routerIp == null) { @@ -2091,7 +2188,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe tmpCfgFileContents += "\n"; } String tmpCfgFilePath = "/etc/haproxy/haproxy.cfg.new"; - String result = callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "filepath", tmpCfgFilePath, "filecontents", tmpCfgFileContents); + String result = createFileInVR(routerIp, tmpCfgFilePath, tmpCfgFileContents); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "LoadBalancerConfigCommand failed to create HA proxy cfg file."); @@ -2103,9 +2200,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; String[] statRules = rules[LoadBalancerConfigurator.STATS]; - String args = "vpc_loadbalancer.sh " + routerIp; String ip = cmd.getNic().getIp(); - args += " -i " + ip; + String args = " -i " + ip; StringBuilder sb = new StringBuilder(); if (addRules.length > 0) { for (int i = 0; i < addRules.length; i++) { @@ -2133,7 +2229,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -s " + sb.toString(); } - result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + if (cmd.getVpcId() == null) { + args = " -i " + routerIp + args; + result = routerProxy("loadbalancer.sh", routerIp, args); + } else { + args = " -i " + cmd.getNic().getIp() + args; + result = routerProxy("vpc_loadbalancer.sh", routerIp, args); + } if (result == null || result.isEmpty()) { return new Answer(cmd, false, "LoadBalancerConfigCommand failed"); @@ -2141,154 +2243,23 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new Answer(cmd); } - protected Answer execute(final CreateIpAliasCommand cmd) { - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - List ipAliasTOs = cmd.getIpAliasList(); - String args = routerIp + " "; - for (IpAliasTO ipaliasto : ipAliasTOs) { - args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; - } - String result = callHostPlugin(conn, "vmops", "createipAlias", "args", args); - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "CreateIPAliasCommand failed\n"); - } - - return new Answer(cmd); - } - - protected Answer execute(final DeleteIpAliasCommand cmd) { - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - List revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); - String args = routerIp + " "; - for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { - args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; - } - //this is to ensure that thre is some argument passed to the deleteipAlias script when there are no revoked rules. - args = args + "- "; - List activeIpAliasTOs = cmd.getCreateIpAliasTos(); - for (IpAliasTO ipAliasTO : activeIpAliasTOs) { - args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; - } - String result = callHostPlugin(conn, "vmops", "deleteipAlias", "args", args); - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "DeleteipAliasCommand failed\n"); - } - - return new Answer(cmd); - } - - protected Answer execute(final DnsMasqConfigCommand cmd) { - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - List dhcpTos = cmd.getIps(); - String args = ""; - for (DhcpTO dhcpTo : dhcpTos) { - args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; - } - - String result = callHostPlugin(conn, "vmops", "configdnsmasq", "routerip", routerIp, "args", args); - - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "DnsMasqconfigCommand failed"); - } - - return new Answer(cmd); - - } - - protected Answer execute(final LoadBalancerConfigCommand cmd) { - if (cmd.getVpcId() != null) { - return VPCLoadBalancerConfig(cmd); - } - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - - if (routerIp == null) { - return new Answer(cmd); - } - - LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); - String[] config = cfgtr.generateConfiguration(cmd); - - String[][] rules = cfgtr.generateFwRules(cmd); - String tmpCfgFilePath = "/tmp/" + routerIp.replace('.', '_') + ".cfg"; - String tmpCfgFileContents = ""; - for (int i = 0; i < config.length; i++) { - tmpCfgFileContents += config[i]; - tmpCfgFileContents += "\n"; - } - - String result = callHostPlugin(conn, "vmops", "createFile", "filepath", tmpCfgFilePath, "filecontents", tmpCfgFileContents); - - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "LoadBalancerConfigCommand failed to create HA proxy cfg file."); - } - - String[] addRules = rules[LoadBalancerConfigurator.ADD]; - String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; - String[] statRules = rules[LoadBalancerConfigurator.STATS]; - - String args = ""; - args += "-i " + routerIp; - args += " -f " + tmpCfgFilePath; - - StringBuilder sb = new StringBuilder(); - if (addRules.length > 0) { - for (int i = 0; i < addRules.length; i++) { - sb.append(addRules[i]).append(','); - } - - args += " -a " + sb.toString(); - } - - sb = new StringBuilder(); - if (removeRules.length > 0) { - for (int i = 0; i < removeRules.length; i++) { - sb.append(removeRules[i]).append(','); - } - - args += " -d " + sb.toString(); - } - - sb = new StringBuilder(); - if (statRules.length > 0) { - for (int i = 0; i < statRules.length; i++) { - sb.append(statRules[i]).append(','); - } - - args += " -s " + sb.toString(); - } - - result = callHostPlugin(conn, "vmops", "setLoadBalancerRule", "args", args); - - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "LoadBalancerConfigCommand failed"); - } - - callHostPlugin(conn, "vmops", "deleteFile", "filepath", tmpCfgFilePath); - - return new Answer(cmd); - } - protected synchronized Answer execute(final DhcpEntryCommand cmd) { - Connection conn = getConnection(); - String args = "-r " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String args = " -m " + cmd.getVmMac(); if (cmd.getVmIpAddress() != null) { - args += " -v " + cmd.getVmIpAddress(); + args += " -4 " + cmd.getVmIpAddress(); } - args += " -m " + cmd.getVmMac(); - args += " -n " + cmd.getVmName(); + args += " -h " + cmd.getVmName(); + if (cmd.getDefaultRouter() != null) { args += " -d " + cmd.getDefaultRouter(); } - if (cmd.getStaticRoutes() != null) { - args += " -s " + cmd.getStaticRoutes(); - } if (cmd.getDefaultDns() != null) { - args += " -N " + cmd.getDefaultDns(); + args += " -n " + cmd.getDefaultDns(); + } + + if (cmd.getStaticRoutes() != null) { + args += " -s " + cmd.getStaticRoutes(); } if (cmd.getVmIp6Address() != null) { @@ -2297,10 +2268,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (!cmd.isDefault()) { - args += " -z"; + args += " -N"; } - String result = callHostPlugin(conn, "vmops", "saveDhcpEntry", "args", args); + String result = routerProxy("edithosts.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "DhcpEntry failed"); } @@ -2308,8 +2279,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected synchronized Answer execute(final RemoteAccessVpnCfgCommand cmd) { - Connection conn = getConnection(); - String args = "vpn_l2tp.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String args = ""; if (cmd.isCreate()) { args += " -r " + cmd.getIpRange(); args += " -p " + cmd.getPresharedKey(); @@ -2322,7 +2292,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } args += " -C " + cmd.getLocalCidr(); args += " -i " + cmd.getPublicInterface(); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vpn_l2tp.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "Configure VPN failed"); } @@ -2330,15 +2300,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected synchronized Answer execute(final VpnUsersCfgCommand cmd) { - Connection conn = getConnection(); - for (VpnUsersCfgCommand.UsernamePassword userpwd : cmd.getUserpwds()) { - String args = "vpn_l2tp.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + for (VpnUsersCfgCommand.UsernamePassword userpwd: cmd.getUserpwds()) { + String args = ""; if (!userpwd.isAdd()) { args += " -U " + userpwd.getUsername(); } else { args += " -u " + userpwd.getUsernamePassword(); } - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vpn_l2tp.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "Configure VPN user failed for user " + userpwd.getUsername()); } @@ -2348,16 +2317,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected Answer execute(final VmDataCommand cmd) { - Connection conn = getConnection(); - String routerPrivateIpAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); Map> data = new HashMap>(); data.put(cmd.getVmIpAddress(), cmd.getVmData()); String json = new Gson().toJson(data); json = Base64.encodeBase64String(json.getBytes()); - String args = "vmdata.py " + routerPrivateIpAddress + " -d " + json; + String args = "-d " + json; - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vmdata.py", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "vm_data failed"); @@ -2368,15 +2335,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected Answer execute(final SavePasswordCommand cmd) { - Connection conn = getConnection(); final String password = cmd.getPassword(); - final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); final String vmIpAddress = cmd.getVmIpAddress(); - String args = "savepassword.sh " + routerPrivateIPAddress; - args += " -v " + vmIpAddress; + String args = " -v " + vmIpAddress; args += " -p " + password; - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("savepassword.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "savePassword failed"); @@ -2441,7 +2405,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with."); } - String args = "ipassoc.sh " + privateIpAddress; + String args = ""; if (add) { args += " -A "; @@ -2471,7 +2435,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -n"; } - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("ipassoc.sh", privateIpAddress, args); + if (result == null || result.isEmpty()) { throw new InternalErrorException("Xen plugin \"ipassoc\" failed."); } @@ -2516,8 +2481,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - String args = "vpc_ipassoc.sh " + routerIp; - String snatArgs = "vpc_privateGateway.sh " + routerIp; + String args = ""; + String snatArgs = ""; if (ip.isAdd()) { args += " -A "; @@ -2542,7 +2507,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -n "; args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vpc_ipassoc.sh", routerIp, args); if (result == null || result.isEmpty()) { throw new InternalErrorException("Xen plugin \"vpc_ipassoc\" failed."); } @@ -2551,7 +2516,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe snatArgs += " -l " + ip.getPublicIp(); snatArgs += " -c " + "eth" + correctVif.getDevice(conn); - result = callHostPlugin(conn, "vmops", "routerProxy", "args", snatArgs); + result = routerProxy("vpc_privateGateway.sh", routerIp, snatArgs); if (result == null || result.isEmpty()) { throw new InternalErrorException("Xen plugin \"vpc_privateGateway\" failed."); } @@ -6044,9 +6009,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } private void CheckXenHostInfo() throws ConfigurationException { - Connection conn = ConnPool.slaveConnect(_host.ip, _username, _password); - if (conn == null) { - throw new ConfigurationException("Can not create slave connection to " + _host.ip); + Connection conn = ConnPool.getConnect(_host.ip, _username, _password); + if( conn == null ) { + throw new ConfigurationException("Can not create connection to " + _host.ip); } try { Host.Record hostRec = null; @@ -6066,7 +6031,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } finally { try { - Session.localLogout(conn); + Session.logout(conn); } catch (Exception e) { } } @@ -7335,35 +7300,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Host.Record hostr = poolr.master.getRecord(conn); if (_host.uuid.equals(hostr.uuid)) { - boolean mastermigrated = false; Map hostMap = Host.getAllRecords(conn); - if (hostMap.size() != 1) { - Host newMaster = null; - Host.Record newMasterRecord = null; - for (Map.Entry entry : hostMap.entrySet()) { - if (_host.uuid.equals(entry.getValue().uuid)) { - continue; - } - newMaster = entry.getKey(); - newMasterRecord = entry.getValue(); - s_logger.debug("New master for the XenPool is " + newMasterRecord.uuid + " : " + newMasterRecord.address); - try { - ConnPool.switchMaster(_host.ip, _host.pool, conn, newMaster, _username, _password, _wait); - mastermigrated = true; - break; - } catch (Exception e) { - s_logger.warn("Unable to switch the new master to " + newMasterRecord.uuid + ": " + newMasterRecord.address + " due to " + e.toString()); - } - } - } else { - s_logger.debug("This is last host to eject, so don't need to eject: " + hostuuid); - return new Answer(cmd); - } - if (!mastermigrated) { - String msg = "this host is master, and cannot designate a new master"; + if (hostMap.size() > 1) { + String msg = "This host is XS master, please designate a new XS master throught XenCenter before you delete this host from CS"; s_logger.debug(msg); return new Answer(cmd, false, msg); - } } @@ -7534,17 +7475,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String config = cmd.getConfiguration(); - Connection conn = getConnection(); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - if (routerIp == null) { return new Answer(cmd); } - String args = "monitor_service.sh " + routerIp; - args += " -c " + config; + String args = " -c " + config; - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("monitor_service.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "SetMonitorServiceCommand failed to create cfg file."); } @@ -7566,8 +7504,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } String[][] rules = cmd.generateFwRules(); - String args = ""; - args += routerIp + " -F"; + String args = " -F"; if (trafficType == FirewallRule.TrafficType.Egress) { args += " -E"; if (egressDefault.equals("true")) { @@ -7587,7 +7524,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -a " + sb.toString(); } - callResult = callHostPlugin(conn, "vmops", "setFirewallRule", "args", args); + if (trafficType == FirewallRule.TrafficType.Egress) { + callResult = routerProxy("firewall_egress.sh", routerIp, args); + } else { + callResult = routerProxy("firewall_ingress.sh", routerIp, args); + } if (callResult == null || callResult.isEmpty()) { //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails @@ -7879,7 +7820,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new SetupGuestNetworkAnswer(cmd, false, "Can not find vif with mac " + mac + " for VM " + domrName); } - String args = "vpc_guestnw.sh " + domrIP + (cmd.isAdd() ? " -C" : " -D"); + String args = (cmd.isAdd()?" -C":" -D"); String dev = "eth" + domrVif.getDevice(conn); args += " -d " + dev; args += " -i " + domrGIP; @@ -7892,7 +7833,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (domainName != null && !domainName.isEmpty()) { args += " -e " + domainName; } - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vpc_guestnw.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new SetupGuestNetworkAnswer(cmd, false, "creating guest network failed due to " + ((result == null) ? "null" : result)); } @@ -7926,8 +7867,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected Answer execute(Site2SiteVpnCfgCommand cmd) { - Connection conn = getConnection(); - String args = "ipsectunnel.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String args = ""; if (cmd.isCreate()) { args += " -A"; args += " -l "; @@ -7968,7 +7908,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -N "; args += cmd.getPeerGuestCidrList(); } - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("ipsectunnel.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { return new Answer(cmd, false, "Configure site to site VPN failed! "); } @@ -7978,14 +7918,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected SetSourceNatAnswer execute(SetSourceNatCommand cmd) { Connection conn = getConnection(); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); IpAddressTO pubIp = cmd.getIpAddress(); try { VM router = getVM(conn, routerName); VIF correctVif = getCorrectVif(conn, router, pubIp); - String args = "vpc_snat.sh " + routerIp; + String args = ""; args += " -A "; args += " -l "; @@ -7994,7 +7933,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -c "; args += "eth" + correctVif.getDevice(conn); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String result = routerProxy("vpc_snat.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { throw new InternalErrorException("Xen plugin \"vpc_snat\" failed."); } @@ -8011,7 +7950,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String callResult; Connection conn = getConnection(); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String privateGw = cmd.getAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY); try { @@ -8032,11 +7970,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (privateGw != null) { s_logger.debug("Private gateway configuration is set"); - String args = "vpc_privategw_acl.sh " + routerIp; + String args = ""; args += " -d " + "eth" + vif.getDevice(conn); args += " -a " + sb.toString(); - callResult = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + callResult = routerProxy("vpc_privategw_acl.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (callResult == null || callResult.isEmpty()) { //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails for (int i = 0; i < results.length; i++) { @@ -8045,13 +7983,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new SetNetworkACLAnswer(cmd, false, results); } } else { - String args = "vpc_acl.sh " + routerIp; + String args = ""; args += " -d " + "eth" + vif.getDevice(conn); args += " -i " + nic.getIp(); args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask())); args += " -a " + sb.toString(); - callResult = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + callResult = routerProxy("vpc_acl.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (callResult == null || callResult.isEmpty()) { //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails for (int i = 0; i < results.length; i++) { @@ -8069,15 +8007,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cmd) { - Connection conn = getConnection(); - - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String[] results = new String[cmd.getRules().length]; int i = 0; boolean endResult = true; for (PortForwardingRuleTO rule : cmd.getRules()) { - String args = "vpc_portforwarding.sh " + routerIp; + String args = ""; args += rule.revoked() ? " -D" : " -A"; args += " -P " + rule.getProtocol().toLowerCase(); args += " -l " + rule.getSrcIp(); @@ -8085,7 +8020,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -r " + rule.getDstIp(); args += " -d " + rule.getStringDstPortRange().replace(":", "-"); - String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args.toString()); + String result = routerProxy("vpc_portforwarding.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result == null || result.isEmpty()) { results[i++] = "Failed"; @@ -8099,8 +8034,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) { String callResult; - Connection conn = getConnection(); - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); try { String[] results = new String[cmd.getStaticRoutes().length]; String[][] rules = cmd.generateSRouteRules(); @@ -8109,9 +8042,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe for (int i = 0; i < srRules.length; i++) { sb.append(srRules[i]).append(','); } - String args = "vpc_staticroute.sh " + routerIp; - args += " -a " + sb.toString(); - callResult = callHostPlugin(conn, "vmops", "routerProxy", "args", args); + String args = "-a " + sb.toString(); + callResult = routerProxy("vpc_staticroute.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (callResult == null || callResult.isEmpty()) { //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails for (int i = 0; i < results.length; i++) { diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java index e797449b0cb..b779085f93c 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; import java.util.Queue; -import java.util.Set; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; @@ -43,7 +42,6 @@ import com.xensource.xenapi.Pool; import com.xensource.xenapi.Session; import com.xensource.xenapi.Types; import com.xensource.xenapi.Types.BadServerResponse; -import com.xensource.xenapi.Types.UuidInvalid; import com.xensource.xenapi.Types.XenAPIException; import com.cloud.utils.NumbersUtil; @@ -55,7 +53,6 @@ public class XenServerConnectionPool { protected HashMap _conns = new HashMap(); protected int _retries; protected int _interval; - protected static boolean s_managePool = true; protected static long s_sleepOnError = 10 * 1000; // in ms static { File file = PropertiesUtil.findConfigFile("environment.properties"); @@ -68,15 +65,11 @@ public class XenServerConnectionPool { final Properties props = new Properties(); props.load(finputstream); finputstream.close(); - String search = props.getProperty("manage.xenserver.pool.master"); - if (search != null) { - s_managePool = Boolean.parseBoolean(search); - } - search = props.getProperty("sleep.interval.on.error"); + String search = props.getProperty("sleep.interval.on.error"); if (search != null) { s_sleepOnError = NumbersUtil.parseInterval(search, 10) * 1000; } - s_logger.info("XenServer Connection Pool Configs: manage.xenserver.pool.master=" + s_managePool + "; sleep.interval.on.error=" + s_sleepOnError); + s_logger.info("XenServer Connection Pool Configs: sleep.interval.on.error=" + s_sleepOnError); } catch (FileNotFoundException e) { s_logger.debug("File is not found", e); } catch (IOException e) { @@ -214,288 +207,27 @@ public class XenServerConnectionPool { return false; } - public void switchMaster(String slaveIp, String poolUuid, Connection conn, Host host, String username, Queue password, int wait) throws XmlRpcException, - XenAPIException { - synchronized (poolUuid.intern()) { - String masterIp = host.getAddress(conn); - s_logger.debug("Designating the new master to " + masterIp); - Pool.designateNewMaster(conn, host); - Connection slaveConn = null; - Connection masterConn = null; - int retry = 30; - for (int i = 0; i < retry; i++) { - forceSleep(5); - try { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Logging on as the slave to " + slaveIp); - } - slaveConn = null; - masterConn = null; - Session slaveSession = null; - slaveConn = new Connection(getURL(slaveIp), 10); - slaveSession = slaveLocalLoginWithPassword(slaveConn, username, password); - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Slave logon successful. session= " + slaveSession); - } - - Pool.Record pr = getPoolRecord(slaveConn); - Host master = pr.master; - String ma = master.getAddress(slaveConn); - if (!ma.trim().equals(masterIp.trim())) { - continue; - } - s_logger.debug("Logging on as the master to " + masterIp); - masterConn = new Connection(getURL(masterIp), 10); - loginWithPassword(masterConn, username, password, APIVersion.latest().toString()); - removeConnect(poolUuid); - ensurePoolIntegrity(masterConn, masterIp, username, password, wait); - return; - } catch (Types.HostIsSlave e) { - s_logger.debug("HostIsSlaveException: Still waiting for the conversion to the master"); - } catch (XmlRpcException e) { - s_logger.debug("XmlRpcException: Still waiting for the conversion to the master " + e.getMessage()); - } catch (Exception e) { - s_logger.debug("Exception: Still waiting for the conversion to the master" + e.getMessage()); - } finally { - if (masterConn != null) { - try { - Session.logout(masterConn); - } catch (Exception e) { - s_logger.debug("Unable to log out of session: " + e.getMessage()); - } - masterConn.dispose(); - masterConn = null; - } - localLogout(slaveConn); - slaveConn = null; - } - } - throw new CloudRuntimeException("Unable to logon to the new master after " + retry + " retries"); - } - } - - private void localLogout(Connection conn) { - if (conn == null) - return; + public Connection getConnect(String ip, String username, Queue password) { + Connection conn = new Connection(getURL(ip), 10); try { - if (s_logger.isTraceEnabled()) { - s_logger.trace("Logging out of the session " + conn.getSessionReference()); - } - Session.localLogout(conn); - } catch (Exception e) { - s_logger.debug("localLogout has problem " + e.getMessage()); - } finally { - conn.dispose(); - conn = null; - } - } - - public Connection slaveConnect(String ip, String username, Queue password) { - Connection conn = null; - try { - conn = new Connection(getURL(ip), 10); - slaveLocalLoginWithPassword(conn, username, password); - return conn; - } catch (Exception e) { - s_logger.debug("Failed to slave local login to " + ip); - } - return null; - } - - public Connection masterConnect(String ip, String username, Queue password) { - Connection conn = null; - try { - conn = new Connection(getURL(ip), 10); - s_logger.debug("Logging on as the master to " + ip); loginWithPassword(conn, username, password, APIVersion.latest().toString()); - return conn; - } catch (Exception e) { - s_logger.debug("Failed to slave local login to " + ip); - } - throw new RuntimeException("can not log in to master " + ip); - } - - public String getMasterIp(String ip, String username, Queue password) throws XenAPIException { - Connection slaveConn = null; - try { - slaveConn = new Connection(getURL(ip), 10); - slaveLocalLoginWithPassword(slaveConn, username, password); - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Slave logon to " + ip); - } - String masterIp = null; - Pool.Record pr = getPoolRecord(slaveConn); - Host master = pr.master; - masterIp = master.getAddress(slaveConn); - return masterIp; - } catch (Types.SessionAuthenticationFailed e) { - s_logger.debug("Failed to slave local login to " + ip + " due to " + e.toString()); - throw e; - } catch (Exception e) { - s_logger.debug("Failed to slave local login to " + ip + " due to " + e.toString()); - } finally { - localLogout(slaveConn); - slaveConn = null; - } - throw new RuntimeException("can not get master ip"); - } - - void PoolEmergencyTransitionToMaster(String slaveIp, String username, Queue password) { - if (!s_managePool) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Don't manage pool on error so sleeping for " + s_sleepOnError); - try { - Thread.sleep(s_sleepOnError); - } catch (InterruptedException ie) { - } - } - return; - } - - Connection slaveConn = null; - Connection c = null; - try { - s_logger.debug("Trying to transition master to " + slaveIp); - slaveConn = new Connection(getURL(slaveIp), 10); - slaveLocalLoginWithPassword(slaveConn, username, password); - Pool.emergencyTransitionToMaster(slaveConn); - // restart xapi in 10 sec - forceSleep(10); - // check if the master of this host is set correctly. - c = new Connection(getURL(slaveIp), 10); - for (int i = 0; i < 30; i++) { - try { - loginWithPassword(c, username, password, APIVersion.latest().toString()); - s_logger.debug("Succeeded to transition master to " + slaveIp); - return; - } catch (Types.HostIsSlave e) { - s_logger.debug("HostIsSlave: Still waiting for the conversion to the master " + slaveIp); - } catch (Exception e) { - s_logger.debug("Exception: Still waiting for the conversion to the master"); - } - forceSleep(2); - } - throw new RuntimeException("EmergencyTransitionToMaster failed after retry 30 times"); - } catch (Exception e) { - throw new RuntimeException("EmergencyTransitionToMaster failed due to " + e.getMessage()); - } finally { - localLogout(slaveConn); - slaveConn = null; - if (c != null) { - try { - Session.logout(c); - c.dispose(); - } catch (Exception e) { - } - } - } - - } - - private void PoolEmergencyResetMaster(String slaveIp, String masterIp, String username, Queue password) { - if (!s_managePool) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Don't manage pool on error so sleeping for " + s_sleepOnError); - try { - Thread.sleep(s_sleepOnError); - } catch (InterruptedException ie) { - } - } - return; - } - - Connection slaveConn = null; - try { - s_logger.debug("Trying to reset master of slave " + slaveIp + " to " + masterIp); - slaveConn = new Connection(getURL(slaveIp), 10); - slaveLocalLoginWithPassword(slaveConn, username, password); - Pool.emergencyResetMaster(slaveConn, masterIp); - forceSleep(10); - for (int i = 0; i < 30; i++) { - try { - slaveLocalLoginWithPassword(slaveConn, username, password); - Pool.Record pr = getPoolRecord(slaveConn); - String mIp = pr.master.getAddress(slaveConn); - if (mIp.trim().equals(masterIp.trim())) { - s_logger.debug("Succeeded to reset master of slave " + slaveIp + " to " + masterIp); - return; - } - } catch (Exception e) { - } finally { - localLogout(slaveConn); - slaveConn = null; - } - // wait 2 second - forceSleep(2); - } - throw new CloudRuntimeException("Unable to reset master of slave " + slaveIp + " to " + masterIp + "after 30 retry"); - } catch (Exception e) { - throw new CloudRuntimeException("Unable to reset master of slave " + slaveIp + " to " + masterIp + " due to " + e.toString()); - } finally { - localLogout(slaveConn); - slaveConn = null; - } - } - - protected void ensurePoolIntegrity(Connection conn, String masterIp, String username, Queue password, int wait) { - try { - // try recoverSlave first - Set rcSlaves = Pool.recoverSlaves(conn); - // wait 10 second - forceSleep(10); - for (Host slave : rcSlaves) { - for (int i = 0; i < 30; i++) { - Connection slaveConn = null; - try { - - String slaveIp = slave.getAddress(conn); - s_logger.debug("Logging on as the slave to " + slaveIp); - slaveConn = new Connection(getURL(slaveIp), 10); - slaveLocalLoginWithPassword(slaveConn, username, password); - Pool.Record pr = getPoolRecord(slaveConn); - String mIp = pr.master.getAddress(slaveConn); - if (mIp.trim().equals(masterIp.trim())) { - break; - } - } catch (Exception e) { - } finally { - localLogout(slaveConn); - slaveConn = null; - } - // wait 2 second - forceSleep(2); - } - } - // then try emergency reset master - Set slaves = Host.getAll(conn); - for (Host slave : slaves) { - String slaveIp = slave.getAddress(conn); - Connection slaveConn = null; - try { - s_logger.debug("Logging on as the slave to " + slaveIp); - - slaveConn = new Connection(getURL(slaveIp), 10); - slaveLocalLoginWithPassword(slaveConn, username, password); - Pool.Record slavePoolr = getPoolRecord(slaveConn); - String ip = slavePoolr.master.getAddress(slaveConn); - if (!masterIp.trim().equals(ip.trim())) { - PoolEmergencyResetMaster(slaveIp, masterIp, username, password); - } - } catch (Exception e) { - s_logger.debug("Unable to login to slave " + slaveIp + " error " + e.getMessage()); - } finally { - localLogout(slaveConn); - slaveConn = null; - } + } catch (Types.HostIsSlave e) { + String maddress = e.masterIPAddress; + conn = new Connection(getURL(maddress), 10); + try { + loginWithPassword(conn, username, password, APIVersion.latest().toString()); + } catch (Exception e1) { + String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString(); + s_logger.debug(msg); + throw new CloudRuntimeException(msg, e1); } } catch (Exception e) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Catch " + e.getClass().getName() + " due to " + e.toString()); - } + String msg = "Unable to create master connection to host(" + ip +") , due to " + e.toString(); + s_logger.debug(msg); + throw new CloudRuntimeException(msg, e); } + return conn; } public URL getURL(String ip) { @@ -512,39 +244,17 @@ public class XenServerConnectionPool { public Connection connect(String hostUuid, String poolUuid, String ipAddress, String username, Queue password, int wait) { XenServerConnection mConn = null; - Connection sConn = null; - String masterIp = null; if (hostUuid == null || poolUuid == null || ipAddress == null || username == null || password == null) { String msg = "Connect some parameter are null hostUuid:" + hostUuid + " ,poolUuid:" + poolUuid + " ,ipAddress:" + ipAddress; s_logger.debug(msg); throw new CloudRuntimeException(msg); } - Host host = null; synchronized (poolUuid.intern()) { // Let's see if it is an existing connection. mConn = getConnect(poolUuid); - if (mConn != null) { - try { - host = Host.getByUuid(mConn, hostUuid); - } catch (Types.SessionInvalid e) { - s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString()); - try { - loginWithPassword(mConn, mConn.getUsername(), mConn.getPassword(), APIVersion.latest().toString()); - } catch (Exception e1) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString()); - } - removeConnect(poolUuid); - mConn = null; - } - } catch (UuidInvalid e) { - String msg = - "Host(" + hostUuid + ") doesn't belong to pool(" + poolUuid + "), please execute 'xe pool-join master-address=" + mConn.getIp() + - " master-username=" + mConn.getUsername(); - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg, e); + if (mConn != null){ + try{ + Host.getByUuid(mConn, hostUuid); } catch (Exception e) { if (s_logger.isDebugEnabled()) { s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString()); @@ -554,114 +264,30 @@ public class XenServerConnectionPool { } } - if (mConn == null) { + if ( mConn == null ) { + mConn = new XenServerConnection(getURL(ipAddress), ipAddress, username, password, _retries, _interval, wait); try { + loginWithPassword(mConn, username, password, APIVersion.latest().toString()); + } catch (Types.HostIsSlave e) { + String maddress = e.masterIPAddress; + mConn = new XenServerConnection(getURL(maddress), maddress, username, password, _retries, _interval, wait); try { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Logging on as the slave to " + ipAddress); - } - sConn = new Connection(getURL(ipAddress), 5); - slaveLocalLoginWithPassword(sConn, username, password); - } catch (Exception e) { - String msg = "Unable to create slave connection to host(" + hostUuid + ") due to " + e.toString(); - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg, e); - } - Pool.Record pr = null; - try { - pr = getPoolRecord(sConn); - } catch (Exception e) { - PoolEmergencyTransitionToMaster(ipAddress, username, password); - mConn = new XenServerConnection(getURL(ipAddress), ipAddress, username, password, _retries, _interval, wait); - try { - loginWithPassword(mConn, username, password, APIVersion.latest().toString()); - pr = getPoolRecord(mConn); - } catch (Exception e1) { - String msg = "Unable to create master connection to host(" + hostUuid + ") after transition it to master, due to " + e1.toString(); - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg, e1); - } - if (!pr.uuid.equals(poolUuid)) { - String msg = "host(" + hostUuid + ") should be in pool(" + poolUuid + "), but it is actually in pool(" + pr.uuid + ")"; - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg); - } else { - if (s_managePool) { - ensurePoolIntegrity(mConn, ipAddress, username, password, wait); - } - addConnect(poolUuid, mConn); - return mConn; - } - } - if (!pr.uuid.equals(poolUuid)) { - String msg = "host(" + hostUuid + ") should be in pool(" + poolUuid + "), but it is actually in pool(" + pr.uuid + ")"; - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg); - } - try { - masterIp = pr.master.getAddress(sConn); - mConn = new XenServerConnection(getURL(masterIp), masterIp, username, password, _retries, _interval, wait); loginWithPassword(mConn, username, password, APIVersion.latest().toString()); - addConnect(poolUuid, mConn); - return mConn; - } catch (Exception e) { - String msg = "Unable to logon in " + masterIp + " as master in pool(" + poolUuid + ")"; - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new CloudRuntimeException(msg); + } catch (Exception e1) { + String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString(); + s_logger.debug(msg); + throw new CloudRuntimeException(msg, e1); + } - } finally { - localLogout(sConn); - sConn = null; + } catch (Exception e) { + String msg = "Unable to create master connection to host(" + ipAddress +") , due to " + e.toString(); + s_logger.debug(msg); + throw new CloudRuntimeException(msg, e); } + addConnect(poolUuid, mConn); } } - if (mConn != null) { - if (s_managePool) { - try { - Map args = new HashMap(); - host.callPlugin(mConn, "echo", "main", args); - } catch (Types.SessionInvalid e) { - if (s_logger.isDebugEnabled()) { - String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString(); - s_logger.debug(msg); - } - PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword()); - } catch (Types.CannotContactHost e) { - if (s_logger.isDebugEnabled()) { - String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString(); - s_logger.debug(msg); - } - PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword()); - } catch (Types.HostOffline e) { - if (s_logger.isDebugEnabled()) { - String msg = "Catch Exception: " + e.getClass().getName() + " Host is offline " + ipAddress + " due to " + e.toString(); - s_logger.debug(msg); - } - PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword()); - } catch (Types.HostNotLive e) { - String msg = "Catch Exception: " + e.getClass().getName() + " Host Not Live " + ipAddress + " due to " + e.toString(); - if (s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword()); - } catch (Exception e) { - String msg = "Echo test failed on host " + hostUuid + " IP " + ipAddress; - s_logger.warn(msg, e); - throw new CloudRuntimeException(msg, e); - } - } - } return mConn; } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java index 5d2363f3b90..f2abff74f80 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java @@ -185,7 +185,7 @@ public class XenServerStorageProcessor implements StorageProcessor { catch (CloudRuntimeException ex) { } - Map details = cmd.getDisk().getDetails(); + Map details = disk.getDetails(); boolean isManaged = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); // if the VM is not running and we're not dealing with managed storage, just return success (nothing to do here) @@ -197,19 +197,7 @@ public class XenServerStorageProcessor implements StorageProcessor { VDI vdi = null; if (isManaged) { - String iScsiName = details.get(DiskTO.IQN); - String storageHost = details.get(DiskTO.STORAGE_HOST); - String chapInitiatorUsername = disk.getDetails().get(DiskTO.CHAP_INITIATOR_USERNAME); - String chapInitiatorSecret = disk.getDetails().get(DiskTO.CHAP_INITIATOR_SECRET); - Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE)); - - SR sr = hypervisorResource.getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, true); - - vdi = hypervisorResource.getVDIbyUuid(conn, data.getPath(), false); - - if (vdi == null) { - vdi = hypervisorResource.createVdi(sr, vdiNameLabel, volumeSize); - } + vdi = hypervisorResource.prepareManagedStorage(conn, details, data.getPath(), vdiNameLabel); if (vmNotRunning) { DiskTO newDisk = new DiskTO(disk.getData(), disk.getDiskSeq(), vdi.getUuid(conn), disk.getType()); diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index 56900feeaeb..6dd0f8a3f93 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -34,14 +34,14 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd; +import org.apache.cloudstack.config.ApiServiceConfiguration; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.managed.context.ManagedContextRunnable; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -52,7 +52,6 @@ import com.cloud.agent.api.routing.LoadBalancerConfigCommand; import com.cloud.agent.api.routing.NetworkElementCommand; import com.cloud.agent.api.to.LoadBalancerTO; import com.cloud.agent.manager.Commands; -import com.cloud.cluster.ClusterManager; import com.cloud.configuration.Config; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -802,7 +801,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast if (s_logger.isInfoEnabled()) { s_logger.info("Check if we need to add management server explicit route to ELB vm. pod cidr: " + dest.getPod().getCidrAddress() + "/" + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + - ClusterManager.ManagementHostIPAdr.value()); + ApiServiceConfiguration.ManagementHostIPAdr.value()); } if (s_logger.isDebugEnabled()) { diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml index a4b4c494da9..6fc43ec4cfe 100644 --- a/plugins/network-elements/nicira-nvp/pom.xml +++ b/plugins/network-elements/nicira-nvp/pom.xml @@ -1,20 +1,22 @@ 4.0.0 @@ -34,6 +36,21 @@ true + + + com.mycila + license-maven-plugin + + + cloudstack-checklicence + process-classes + + check + + + + + diff --git a/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/module.properties b/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/module.properties index 92f92a4b4b0..5085fcec0c7 100644 --- a/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/module.properties +++ b/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/module.properties @@ -1,3 +1,4 @@ +# # 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 @@ -14,5 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# + name=nvp parent=network \ No newline at end of file diff --git a/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/spring-nvp-context.xml b/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/spring-nvp-context.xml index 8d9813a020e..cd8a2c9846f 100644 --- a/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/spring-nvp-context.xml +++ b/plugins/network-elements/nicira-nvp/resources/META-INF/cloudstack/nvp/spring-nvp-context.xml @@ -1,20 +1,22 @@ - com.mycila.maven-license-plugin - maven-license-plugin - 1.9.0 + com.mycila + license-maven-plugin + cloudstack-checklicence process-classes - format + check - - true - true -
../../../LICENSE.header
- - XML_STYLE -     DOUBLESLASH_STYLE -     SEMICOLON_STYLE - - false - - target/** - .settings/** - .checkstyle - .project - .classpath - -
diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightElement.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightElement.java index 9761e744f6b..05bc8317090 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightElement.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightElement.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java index 0b547e76f18..a6089558775 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResource.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResource.java index c2b7a67244e..5473858531d 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResource.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResource.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManager.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManager.java index 5f6161a481c..db1ea37ebbf 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManager.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManager.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManagerImpl.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManagerImpl.java index abc48bb478f..013c3028071 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManagerImpl.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/OpenDaylightControllerResourceManagerImpl.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/AddHypervisorCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/AddHypervisorCommand.java index 06e94b35390..8094271a9ca 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/AddHypervisorCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/AddHypervisorCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigureNetworkCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigureNetworkCommand.java index bfbcde4ca43..a5a2bf134d1 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigureNetworkCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigureNetworkCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigurePortCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigurePortCommand.java index 3d4d2a2a69a..b36746893f4 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigurePortCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/ConfigurePortCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyNetworkCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyNetworkCommand.java index 6d1bc044315..971a882e98e 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyNetworkCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyNetworkCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyPortCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyPortCommand.java index c0a89371c1a..9cd3dd72b8c 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyPortCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/DestroyPortCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/StartupOpenDaylightControllerCommand.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/StartupOpenDaylightControllerCommand.java index de3a7a3b54b..77206b1012a 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/StartupOpenDaylightControllerCommand.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/commands/StartupOpenDaylightControllerCommand.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/AddHypervisorAnswer.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/AddHypervisorAnswer.java index 79867051e13..4dffaf2ee43 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/AddHypervisorAnswer.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/AddHypervisorAnswer.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigureNetworkAnswer.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigureNetworkAnswer.java index 81c4a6fd45d..7b5af5081e4 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigureNetworkAnswer.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigureNetworkAnswer.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigurePortAnswer.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigurePortAnswer.java index cf9acc1d535..178fdcdcc2a 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigurePortAnswer.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/ConfigurePortAnswer.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyNetworkAnswer.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyNetworkAnswer.java index 10284b4918b..16c3b7ca5e6 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyNetworkAnswer.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyNetworkAnswer.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyPortAnswer.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyPortAnswer.java index 07bb0dbfff3..ca239d6ebd4 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyPortAnswer.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/agent/responses/DestroyPortAnswer.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronInvalidCredentialsException.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronInvalidCredentialsException.java index f46e0b686d9..6c1c00975c5 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronInvalidCredentialsException.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronInvalidCredentialsException.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApi.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApi.java index 2d0c5324341..8c67a98d08e 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApi.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApi.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApiException.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApiException.java index 58bcd0d97b6..77efcee694e 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApiException.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApiException.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestFactory.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestFactory.java index 10ac5e0603b..d99677ee3a2 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestFactory.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestFactory.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java index dca80070286..80130c0e4b8 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/AddOpenDaylightControllerCmd.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java index 7359ce9d015..b5565041444 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/DeleteOpenDaylightControllerCmd.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java index 11f196bc3f0..f3e2e39f4cc 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/commands/ListOpenDaylightControllersCmd.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/enums/NeutronNorthboundEnum.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/enums/NeutronNorthboundEnum.java index 8411e231f7f..3ee5d19d5fe 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/enums/NeutronNorthboundEnum.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/enums/NeutronNorthboundEnum.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetwork.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetwork.java index 7d1ebf0b9cc..b61025f7f44 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetwork.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetwork.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworkWrapper.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworkWrapper.java index be1d85e5cb7..37087f6a5ce 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworkWrapper.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworkWrapper.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworksList.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworksList.java index 1f9ab59ab22..22d6d4e4d84 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworksList.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNetworksList.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNode.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNode.java index d5b14370a2e..1672cfefc81 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNode.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNode.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodeWrapper.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodeWrapper.java index 4dcb4c9b19d..6065d912a49 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodeWrapper.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodeWrapper.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodesList.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodesList.java index a935bef9432..a419b66ea59 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodesList.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronNodesList.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPort.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPort.java index 9824feeadc0..764dcd1e507 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPort.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPort.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortWrapper.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortWrapper.java index be7817f6064..0fe00d598a9 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortWrapper.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortWrapper.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortsList.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortsList.java index 1e6518c91e7..680e9a05f6a 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortsList.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/model/NeutronPortsList.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/Action.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/Action.java index fb764bad4a8..2711fef7449 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/Action.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/Action.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // @@ -31,6 +31,7 @@ import org.apache.cloudstack.network.opendaylight.api.NeutronRestApi; import org.apache.cloudstack.network.opendaylight.api.NeutronRestApiException; import org.apache.cloudstack.network.opendaylight.api.NeutronRestFactory; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.NameValuePair; @@ -270,7 +271,8 @@ public abstract class Action { private String responseToErrorMessage(final HttpMethodBase method) { assert method.isRequestSent() : "no use getting an error message unless the request is sent"; - if (TEXT_HTML_CONTENT_TYPE.equals(method.getResponseHeader(CONTENT_TYPE).getValue())) { + final Header contentTypeHeader = method.getResponseHeader(CONTENT_TYPE); + if (contentTypeHeader != null && TEXT_HTML_CONTENT_TYPE.equals(contentTypeHeader.getValue())) { // The error message is the response content // Safety margin of 1024 characters, anything longer is probably // useless and will clutter the logs diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNetworksNorthboundAction.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNetworksNorthboundAction.java index 3a8c187e11f..ce33da0e9a4 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNetworksNorthboundAction.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNetworksNorthboundAction.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNodesNorthboundAction.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNodesNorthboundAction.java index 891ca162cb1..03bf02ea4ed 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNodesNorthboundAction.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronNodesNorthboundAction.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronPortsNorthboundAction.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronPortsNorthboundAction.java index 6ff16918286..78287d97251 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronPortsNorthboundAction.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/resources/NeutronPortsNorthboundAction.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/responses/OpenDaylightControllerResponse.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/responses/OpenDaylightControllerResponse.java index 10c6f2838ca..c11a6ca12ce 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/responses/OpenDaylightControllerResponse.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/responses/OpenDaylightControllerResponse.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDao.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDao.java index 87999821ef8..f13a3dd8688 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDao.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDao.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDaoImpl.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDaoImpl.java index 1d0becaef56..8cec3c63554 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDaoImpl.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerMappingDaoImpl.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerVO.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerVO.java index b50cfda0e50..6af058fc91f 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerVO.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/dao/OpenDaylightControllerVO.java @@ -1,18 +1,18 @@ // // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // diff --git a/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/module.properties b/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/module.properties index 36d2331db5b..6cc5e4e694d 100644 --- a/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/module.properties +++ b/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/module.properties @@ -1,18 +1,18 @@ # # Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file +# or more contributor license agreements. See the NOTICE file # distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file +# 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 +# with the License. You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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 +# KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # diff --git a/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/spring-opendaylight-context.xml b/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/spring-opendaylight-context.xml index 76b6a920c70..7f1e84f3818 100644 --- a/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/spring-opendaylight-context.xml +++ b/plugins/network-elements/opendaylight/src/main/resources/META-INF/cloudstack/opendaylight/spring-opendaylight-context.xml @@ -1,19 +1,19 @@ - + + + vmx-07 + + + + + scsiController0 + SCSI Controller + scsiController0 + + lsilogic + 6 + + - - vmx-06 - - - - - - scsiController0 - SCSI Controller - - lsilogic - 6 - - - + diff --git a/tools/transifex/.tx/config b/tools/transifex/.tx/config index 102a47e29d4..5e83db3ef0f 100644 --- a/tools/transifex/.tx/config +++ b/tools/transifex/.tx/config @@ -39,9 +39,11 @@ trans.de_DE = work-dir/messages_de_DE.properties trans.es = work-dir/messages_es.properties trans.fr_FR = work-dir/messages_fr_FR.properties trans.it_IT = work-dir/messages_it_IT.properties -trans.ja = work-dir/messages_ja.properties +trans.ja_JP = work-dir/messages_ja_JP.properties trans.ko_KR = work-dir/messages_ko_KR.properties trans.nb_NO = work-dir/messages_nb_NO.properties +trans.nl_NL = work-dir/messages_nl_NL.properties +trans.pl = work-dir/messages_pl.properties trans.pt_BR = work-dir/messages_pt_BR.properties trans.ru_RU = work-dir/messages_ru_RU.properties trans.zh_CN = work-dir/messages_zh_CN.properties diff --git a/tools/transifex/sync-transifex-ui.sh b/tools/transifex/sync-transifex-ui.sh index 9124ed6a633..8f24642413c 100755 --- a/tools/transifex/sync-transifex-ui.sh +++ b/tools/transifex/sync-transifex-ui.sh @@ -17,7 +17,7 @@ # under the License. SRCLANG=en -LIST_LANG="ar ca de_DE es fr_FR it_IT ja ko_KR nb_NO pt_BR ru_RU zh_CN" +LIST_LANG="ar ca de_DE es fr_FR it_IT ja_JP ko_KR nb_NO nl_NL pl pt_BR ru_RU zh_CN" DIRECTORY_RESOURCES="../../client/WEB-INF/classes/resources" WORKDIR="./work-dir" diff --git a/ui/index.jsp b/ui/index.jsp index 7b8d8257b33..096747b10ac 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -71,7 +71,7 @@ diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index c83080cb0d1..646ffbf5b19 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -613,17 +613,17 @@ if (args.$wizard.find('input[name=compute-cpu-cores]').parent().parent().css('display') != 'none') { if (args.$wizard.find('input[name=compute-cpu-cores]').val().length > 0) { $.extend(deployVmData, { - 'customparameters[0].cpuNumber' : args.$wizard.find('input[name=compute-cpu-cores]').val() + 'details[0].cpuNumber' : args.$wizard.find('input[name=compute-cpu-cores]').val() }); } if (args.$wizard.find('input[name=compute-cpu]').val().length > 0) { $.extend(deployVmData, { - 'customparameters[0].cpuSpeed' : args.$wizard.find('input[name=compute-cpu]').val() + 'details[0].cpuSpeed' : args.$wizard.find('input[name=compute-cpu]').val() }); } if (args.$wizard.find('input[name=compute-memory]').val().length > 0) { $.extend(deployVmData, { - 'customparameters[0].memory' : args.$wizard.find('input[name=compute-memory]').val() + 'details[0].memory' : args.$wizard.find('input[name=compute-memory]').val() }); } } diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 05c5f79474b..9430fe4b9bb 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1525,17 +1525,17 @@ if (args.$form.find('.form-item[rel=cpuSpeed]').is(':visible')) { $.extend(data, { - 'customparameters[0].cpuSpeed': args.data.cpuSpeed + 'details[0].cpuSpeed': args.data.cpuSpeed }); } if (args.$form.find('.form-item[rel=cpuNumber]').is(':visible')) { $.extend(data, { - 'customparameters[0].cpuNumber': args.data.cpuNumber + 'details[0].cpuNumber': args.data.cpuNumber }); } if (args.$form.find('.form-item[rel=memory]').is(':visible')) { $.extend(data, { - 'customparameters[0].memory': args.data.memory + 'details[0].memory': args.data.memory }); } @@ -1789,6 +1789,16 @@ serviceofferingname: { label: 'label.compute.offering' }, + cpunumber: { + label: 'label.num.cpu.cores' + }, + cpuspeed: { + label: 'label.cpu.mhz' + }, + memory: { + label: 'label.memory.mb' + }, + haenable: { label: 'label.ha.enabled', converter: cloudStack.converters.toBooleanText diff --git a/ui/scripts/network.js b/ui/scripts/network.js index c404b55b9b7..4e1ce05ff91 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -1615,6 +1615,10 @@ 'add-vm': { label: 'label.add.vms', addButton: true + }, + 'state' : { + edit: 'ignore', + label: 'label.state' } }, @@ -2956,6 +2960,10 @@ 'add-rule': { label: 'label.add.rule', addButton: true + }, + 'state' : { + edit: 'ignore', + label: 'label.state' } }, @@ -3435,6 +3443,11 @@ 'add-vm': { label: 'label.add.vms', addButton: true + }, + + 'state' : { + edit: 'ignore', + label: 'label.state' } }, diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index a6328503301..b9dc2f37767 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -1201,7 +1201,9 @@ var processPropertiesInImagestoreObject = function(jsonObj) { var url = jsonObj.url; //e.g. 'cifs://10.1.1.1/aaa/aaa2/aaa3?user=bbb&password=ccc&domain=ddd' var passwordIndex = url.indexOf('&password='); //38 var domainIndex = url.indexOf('&domain='); //51 - jsonObj.url = url.substring(0, passwordIndex) + url.substring(domainIndex); //remove '&password=ccc' from jsonObj.url + if (passwordIndex >= 0) { + jsonObj.url = url.substring(0, passwordIndex) + url.substring(domainIndex); //remove '&password=ccc' from jsonObj.url + } } } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/ClusterMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/ClusterMO.java index e416cb52f9e..49ee7c4ec51 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/ClusterMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/ClusterMO.java @@ -125,7 +125,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { public ObjectContent[] getVmPropertiesOnHyperHost(String[] propertyPaths) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - retrieveProperties() for VM properties. target MOR: " + _mor.getValue() + ", properties: " + - new Gson().toJson(propertyPaths)); + new Gson().toJson(propertyPaths)); PropertySpec pSpec = new PropertySpec(); pSpec.setType("VirtualMachine"); @@ -164,7 +164,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { public ObjectContent[] getDatastorePropertiesOnHyperHost(String[] propertyPaths) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - retrieveProperties() on Datastore properties. target MOR: " + _mor.getValue() + ", properties: " + - new Gson().toJson(propertyPaths)); + new Gson().toJson(propertyPaths)); PropertySpec pSpec = new PropertySpec(); pSpec.setType("Datastore"); @@ -196,7 +196,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { private ObjectContent[] getHostPropertiesOnCluster(String[] propertyPaths) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - retrieveProperties() on Host properties. target MOR: " + _mor.getValue() + ", properties: " + - new Gson().toJson(propertyPaths)); + new Gson().toJson(propertyPaths)); PropertySpec pSpec = new PropertySpec(); pSpec.setType("HostSystem"); @@ -257,7 +257,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { public void importVmFromOVF(String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - importVmFromOVF(). target MOR: " + _mor.getValue() + ", ovfFilePath: " + ovfFilePath + ", vmName: " + vmName + - ", datastore: " + dsMo.getMor().getValue() + ", diskOption: " + diskOption); + ", datastore: " + dsMo.getMor().getValue() + ", diskOption: " + diskOption); ManagedObjectReference morRp = getHyperHostOwnerResourcePool(); assert (morRp != null); @@ -273,16 +273,16 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { @Override public boolean createBlankVm(String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, boolean limitCpuUse, int memoryMB, - int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { + int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getValue() + ", vmName: " + vmName + ", cpuCount: " + cpuCount + ", cpuSpeedMhz: " + - cpuSpeedMHz + ", cpuReservedMHz: " + cpuReservedMHz + ", limitCpu: " + limitCpuUse + ", memoryMB: " + memoryMB + ", guestOS: " + guestOsIdentifier + - ", datastore: " + morDs.getValue() + ", snapshotDirToParent: " + snapshotDirToParent); + cpuSpeedMHz + ", cpuReservedMHz: " + cpuReservedMHz + ", limitCpu: " + limitCpuUse + ", memoryMB: " + memoryMB + ", guestOS: " + guestOsIdentifier + + ", datastore: " + morDs.getValue() + ", snapshotDirToParent: " + snapshotDirToParent); boolean result = - HypervisorHostHelper.createBlankVm(this, vmName, vmInternalCSName, cpuCount, cpuSpeedMHz, cpuReservedMHz, limitCpuUse, memoryMB, memoryReserveMB, - guestOsIdentifier, morDs, snapshotDirToParent); + HypervisorHostHelper.createBlankVm(this, vmName, vmInternalCSName, cpuCount, cpuSpeedMHz, cpuReservedMHz, limitCpuUse, memoryMB, memoryReserveMB, + guestOsIdentifier, morDs, snapshotDirToParent); if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - createBlankVm() done"); @@ -295,11 +295,11 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + - ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); + ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); ManagedObjectReference morDs = null; ManagedObjectReference morDsFirst = null; - List hosts = (List)_context.getVimClient().getDynamicProperty(_mor, "host"); + List hosts = _context.getVimClient().getDynamicProperty(_mor, "host"); if (hosts != null && hosts.size() > 0) { for (ManagedObjectReference morHost : hosts) { HostMO hostMo = new HostMO(_context, morHost); @@ -332,7 +332,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - unmountDatastore(). target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid); - List hosts = (List)_context.getVimClient().getDynamicProperty(_mor, "host"); + List hosts = _context.getVimClient().getDynamicProperty(_mor, "host"); if (hosts != null && hosts.size() > 0) { for (ManagedObjectReference morHost : hosts) { HostMO hostMo = new HostMO(_context, morHost); @@ -480,7 +480,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { // TODO, need to use traversal to optimize retrieve of int cpuNumInCpuThreads = 1; - List hosts = (List)_context.getVimClient().getDynamicProperty(_mor, "host"); + List hosts = _context.getVimClient().getDynamicProperty(_mor, "host"); if (hosts != null && hosts.size() > 0) { for (ManagedObjectReference morHost : hosts) { HostMO hostMo = new HostMO(_context, morHost); @@ -505,7 +505,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - getHyperHostNetworkSummary(). target MOR: " + _mor.getValue() + ", mgmtPortgroup: " + esxServiceConsolePort); - List hosts = (List)_context.getVimClient().getDynamicProperty(_mor, "host"); + List hosts = _context.getVimClient().getDynamicProperty(_mor, "host"); if (hosts != null && hosts.size() > 0) { VmwareHypervisorHostNetworkSummary summary = new HostMO(_context, hosts.get(0)).getHyperHostNetworkSummary(esxServiceConsolePort); diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldsManagerMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldsManagerMO.java index dbc742911e4..78ce9a83c68 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldsManagerMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldsManagerMO.java @@ -51,7 +51,7 @@ public class CustomFieldsManagerMO extends BaseMO { } public List getFields() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(getMor(), "field"); + return _context.getVimClient().getDynamicProperty(getMor(), "field"); } @Override diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DistributedVirtualSwitchMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DistributedVirtualSwitchMO.java index 220c5a132aa..9e19d655e7a 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DistributedVirtualSwitchMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DistributedVirtualSwitchMO.java @@ -34,6 +34,7 @@ import com.vmware.vim25.VMwareDVSPvlanMapEntry; import com.cloud.hypervisor.vmware.util.VmwareContext; public class DistributedVirtualSwitchMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(DistributedVirtualSwitchMO.class); public DistributedVirtualSwitchMO(VmwareContext context, ManagedObjectReference morDvs) { @@ -62,7 +63,7 @@ public class DistributedVirtualSwitchMO extends BaseMO { public TaskInfo updateVMWareDVSwitchGetTask(ManagedObjectReference dvSwitchMor, VMwareDVSConfigSpec dvsSpec) throws Exception { ManagedObjectReference task = _context.getService().reconfigureDvsTask(dvSwitchMor, dvsSpec); TaskInfo info = (TaskInfo)(_context.getVimClient().getDynamicProperty(task, "info")); - boolean waitvalue = _context.getVimClient().waitForTask(task); + _context.getVimClient().waitForTask(task); return info; } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java index 2392347f8f8..9af845b143f 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java @@ -181,7 +181,7 @@ public class HostDatastoreSystemMO extends BaseMO { } public List getDatastores() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "datastore"); + return _context.getVimClient().getDynamicProperty(_mor, "datastore"); } public DatastoreInfo getDatastoreInfo(ManagedObjectReference morDatastore) throws Exception { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostFirewallSystemMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostFirewallSystemMO.java index 4c0a9957aa8..78e98db3c4a 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostFirewallSystemMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostFirewallSystemMO.java @@ -25,6 +25,7 @@ import com.vmware.vim25.ManagedObjectReference; import com.cloud.hypervisor.vmware.util.VmwareContext; public class HostFirewallSystemMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(HostFirewallSystemMO.class); public HostFirewallSystemMO(VmwareContext context, ManagedObjectReference morFirewallSystem) { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java index f511ce285a9..a32992aeb33 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java @@ -91,11 +91,11 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public List getHostVirtualNicManagerNetConfig() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); + return _context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); } public List getHostIpRouteEntries() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "config.network.routeTableInfo.ipRoute"); + return _context.getVimClient().getDynamicProperty(_mor, "config.network.routeTableInfo.ipRoute"); } public HostListSummaryQuickStats getHostQuickStats() throws Exception { @@ -222,7 +222,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public ManagedObjectReference[] getHostLocalDatastore() throws Exception { - List datastores = (List)_context.getVimClient().getDynamicProperty(_mor, "datastore"); + List datastores = _context.getVimClient().getDynamicProperty(_mor, "datastore"); List l = new ArrayList(); if (datastores != null) { for (ManagedObjectReference mor : datastores) { @@ -235,7 +235,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public HostVirtualSwitch getHostVirtualSwitchByName(String name) throws Exception { - List switches = (List)_context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch"); + List switches = _context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch"); if (switches != null) { for (HostVirtualSwitch vswitch : switches) { @@ -247,7 +247,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public List getHostVirtualSwitch() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch"); + return _context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch"); } public AboutInfo getHostAboutInfo() throws Exception { @@ -326,7 +326,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { assert (nicType != null); List netConfigs = - (List)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); + _context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); if (netConfigs != null) { for (VirtualNicManagerNetConfig netConfig : netConfigs) { @@ -364,7 +364,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public void createPortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId, HostNetworkSecurityPolicy secPolicy, - HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception { + HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception { assert (portGroupName != null); HostNetworkSystemMO hostNetMo = getHostNetworkSystemMO(); assert (hostNetMo != null); @@ -384,7 +384,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public void updatePortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId, HostNetworkSecurityPolicy secPolicy, - HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception { + HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception { assert (portGroupName != null); HostNetworkSystemMO hostNetMo = getHostNetworkSystemMO(); assert (hostNetMo != null); @@ -450,7 +450,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { public List getVmMorsOnNetwork(String portGroupName) throws Exception { ManagedObjectReference morNetwork = getNetworkMor(portGroupName); if (morNetwork != null) - return (List)_context.getVimClient().getDynamicProperty(morNetwork, "vm"); + return _context.getVimClient().getDynamicProperty(morNetwork, "vm"); return null; } @@ -612,7 +612,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { public ObjectContent[] getVmPropertiesOnHyperHost(String[] propertyPaths) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - retrieveProperties() for VM properties. target MOR: " + _mor.getValue() + ", properties: " + - new Gson().toJson(propertyPaths)); + new Gson().toJson(propertyPaths)); PropertySpec pSpec = new PropertySpec(); pSpec.setType("VirtualMachine"); @@ -645,7 +645,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { public ObjectContent[] getDatastorePropertiesOnHyperHost(String[] propertyPaths) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - retrieveProperties() on Datastore properties. target MOR: " + _mor.getValue() + ", properties: " + - new Gson().toJson(propertyPaths)); + new Gson().toJson(propertyPaths)); PropertySpec pSpec = new PropertySpec(); pSpec.setType("Datastore"); @@ -710,7 +710,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { public void importVmFromOVF(String ovfFilePath, String vmName, String datastoreName, String diskOption) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - importVmFromOVF(). target MOR: " + _mor.getValue() + ", ovfFilePath: " + ovfFilePath + ", vmName: " + vmName + - ",datastoreName: " + datastoreName + ", diskOption: " + diskOption); + ",datastoreName: " + datastoreName + ", diskOption: " + diskOption); DatastoreMO dsMo = getHostDatastoreMO(datastoreName); if (dsMo == null) @@ -733,16 +733,16 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { @Override public boolean createBlankVm(String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, boolean limitCpuUse, int memoryMB, - int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { + int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - createBlankVm(). target MOR: " + _mor.getValue() + ", vmName: " + vmName + ", cpuCount: " + cpuCount + ", cpuSpeedMhz: " + - cpuSpeedMHz + ", cpuReservedMHz: " + cpuReservedMHz + ", limitCpu: " + limitCpuUse + ", memoryMB: " + memoryMB + ", guestOS: " + guestOsIdentifier + - ", datastore: " + morDs.getValue() + ", snapshotDirToParent: " + snapshotDirToParent); + cpuSpeedMHz + ", cpuReservedMHz: " + cpuReservedMHz + ", limitCpu: " + limitCpuUse + ", memoryMB: " + memoryMB + ", guestOS: " + guestOsIdentifier + + ", datastore: " + morDs.getValue() + ", snapshotDirToParent: " + snapshotDirToParent); boolean result = - HypervisorHostHelper.createBlankVm(this, vmName, vmInternalCSName, cpuCount, cpuSpeedMHz, cpuReservedMHz, limitCpuUse, memoryMB, memoryReserveMB, - guestOsIdentifier, morDs, snapshotDirToParent); + HypervisorHostHelper.createBlankVm(this, vmName, vmInternalCSName, cpuCount, cpuSpeedMHz, cpuReservedMHz, limitCpuUse, memoryMB, memoryReserveMB, + guestOsIdentifier, morDs, snapshotDirToParent); if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - createBlankVm() done"); @@ -750,7 +750,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } public ManagedObjectReference getExistingDataStoreOnHost(boolean vmfsDatastore, String hostAddress, int hostPort, String path, String uuid, - HostDatastoreSystemMO hostDatastoreSystemMo) { + HostDatastoreSystemMO hostDatastoreSystemMo) { // First retrieve the list of Datastores on the host. List morArray; try { @@ -786,7 +786,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + - ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); + ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); HostDatastoreSystemMO hostDatastoreSystemMo = getHostDatastoreSystemMO(); ManagedObjectReference morDatastore = hostDatastoreSystemMo.findDatastore(poolUuid); @@ -796,14 +796,14 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { morDatastore = hostDatastoreSystemMo.createNfsDatastore(poolHostAddress, poolHostPort, poolPath, poolUuid); } catch (AlreadyExistsFaultMsg e) { s_logger.info("Creation of NFS datastore on vCenter failed since datastore already exists." + - " Details: vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + - ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); + " Details: vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + + ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + poolUuid); // Retrieve the morDatastore and return it. return (getExistingDataStoreOnHost(vmfsDatastore, poolHostAddress, poolHostPort, poolPath, poolUuid, hostDatastoreSystemMo)); } catch (Exception e) { s_logger.info("Creation of NFS datastore on vCenter failed. " + " Details: vCenter API trace - mountDatastore(). target MOR: " + _mor.getValue() + - ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + - poolUuid + ". Exception mesg: " + e.getMessage()); + ", vmfs: " + vmfsDatastore + ", poolHost: " + poolHostAddress + ", poolHostPort: " + poolHostPort + ", poolPath: " + poolPath + ", poolUuid: " + + poolUuid + ". Exception mesg: " + e.getMessage()); throw new Exception("Creation of NFS datastore on vCenter failed."); } if (morDatastore == null) { @@ -905,9 +905,9 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { VmwareHypervisorHostNetworkSummary summary = new VmwareHypervisorHostNetworkSummary(); - if (this.getHostType() == VmwareHostType.ESXi) { + if (getHostType() == VmwareHostType.ESXi) { List netConfigs = - (List)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); + _context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig"); assert (netConfigs != null); for (VirtualNicManagerNetConfig netConfig : netConfigs) { @@ -927,7 +927,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { } } else { // try with ESX path - List hostVNics = (List)_context.getVimClient().getDynamicProperty(_mor, "config.network.consoleVnic"); + List hostVNics = _context.getVimClient().getDynamicProperty(_mor, "config.network.consoleVnic"); if (hostVNics != null) { for (HostVirtualNic vnic : hostVNics) { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostNetworkSystemMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostNetworkSystemMO.java index 806b0e2c296..acac689b350 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostNetworkSystemMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostNetworkSystemMO.java @@ -25,6 +25,7 @@ import com.vmware.vim25.ManagedObjectReference; import com.cloud.hypervisor.vmware.util.VmwareContext; public class HostNetworkSystemMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(HostNetworkSystemMO.class); public HostNetworkSystemMO(VmwareContext context, ManagedObjectReference morNetworkSystem) { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java index 2ddc144b3be..38b68b3c847 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java @@ -195,7 +195,7 @@ public class HypervisorHostHelper { } public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName, Integer vlanId, Integer networkRateMbps, - long peakBandwidth, long burstSize, String gateway, boolean configureVServiceInNexus) throws Exception { + long peakBandwidth, long burstSize, String gateway, boolean configureVServiceInNexus) throws Exception { Map vsmCredentials = getValidatedVsmCredentials(context); String vsmIp = vsmCredentials.get("vsmip"); String vsmUserName = vsmCredentials.get("vsmusername"); @@ -229,7 +229,7 @@ public class HypervisorHostHelper { } } catch (CloudRuntimeException e) { msg = - "Failed to add policy map of " + policyName + " with parameters " + "committed rate = " + averageBandwidth + "peak bandwidth = " + peakBandwidth + + "Failed to add policy map of " + policyName + " with parameters " + "committed rate = " + averageBandwidth + "peak bandwidth = " + peakBandwidth + "burst size = " + burstSize + ". Exception: " + e.toString(); s_logger.error(msg); if (netconfClient != null) { @@ -274,7 +274,7 @@ public class HypervisorHostHelper { netconfClient.addVServiceNode(vlanId.toString(), gateway); s_logger.info("Adding port profile with vservice details configured over VLAN : " + vlanId.toString()); netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vlanId.intValue(), vdc, - esp); + esp); } } } catch (CloudRuntimeException e) { @@ -305,7 +305,7 @@ public class HypervisorHostHelper { } public static void updatePortProfile(VmwareContext context, String ethPortProfileName, String vethPortProfileName, Integer vlanId, Integer networkRateMbps, - long peakBandwidth, long burstRate) throws Exception { + long peakBandwidth, long burstRate) throws Exception { NetconfHelper netconfClient = null; Map vsmCredentials = getValidatedVsmCredentials(context); String vsmIp = vsmCredentials.get("vsmip"); @@ -346,7 +346,7 @@ public class HypervisorHostHelper { netconfClient.addPolicyMap(policyName, averageBandwidth, (int)peakBandwidth, (int)burstRate); } catch (CloudRuntimeException e) { msg = - "Failed to add policy map of " + policyName + " with parameters " + "committed rate = " + averageBandwidth + "peak bandwidth = " + peakBandwidth + + "Failed to add policy map of " + policyName + " with parameters " + "committed rate = " + averageBandwidth + "peak bandwidth = " + peakBandwidth + "burst size = " + burstRate + ". Exception: " + e.toString(); s_logger.error(msg); if (netconfClient != null) { @@ -433,8 +433,8 @@ public class HypervisorHostHelper { */ public static Pair prepareNetwork(String physicalNetwork, String namePrefix, HostMO hostMo, String vlanId, String secondaryvlanId, - Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs, VirtualSwitchType vSwitchType, int numPorts, String gateway, - boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType) throws Exception { + Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs, VirtualSwitchType vSwitchType, int numPorts, String gateway, + boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType) throws Exception { ManagedObjectReference morNetwork = null; VmwareContext context = hostMo.getContext(); ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter(); @@ -457,7 +457,7 @@ public class HypervisorHostHelper { * prepare networks for in this function. */ BroadcastDomainType[] supportedBroadcastTypes = - new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan, + new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan, BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan}; if (!Arrays.asList(supportedBroadcastTypes).contains(broadcastDomainType)) { @@ -504,11 +504,11 @@ public class HypervisorHostHelper { } morDvSwitch = dataCenterMo.getDvSwitchMor(dvSwitchName); if (morDvSwitch == null) { - String msg = "Unable to find distributed vSwitch " + morDvSwitch; + String msg = "Unable to find distributed vSwitch " + dvSwitchName; s_logger.error(msg); throw new Exception(msg); } else { - s_logger.info("Found distributed vSwitch " + morDvSwitch); + s_logger.debug("Found distributed vSwitch " + dvSwitchName); } if (broadcastDomainType == BroadcastDomainType.Lswitch) { @@ -664,8 +664,8 @@ public class HypervisorHostHelper { } private static void createPortGroup(String physicalNetwork, String networkName, Integer vid, Integer spvlanid, DatacenterMO dataCenterMo, - DVSTrafficShapingPolicy shapingPolicy, DVSSecurityPolicy secPolicy, DistributedVirtualSwitchMO dvSwitchMo, int numPorts, boolean autoExpandSupported) - throws Exception { + DVSTrafficShapingPolicy shapingPolicy, DVSSecurityPolicy secPolicy, DistributedVirtualSwitchMO dvSwitchMo, int numPorts, boolean autoExpandSupported) + throws Exception { VmwareDistributedVirtualSwitchVlanSpec vlanSpec = null; VmwareDistributedVirtualSwitchPvlanSpec pvlanSpec = null; VMwareDVSPortSetting dvsPortSetting = null; @@ -784,7 +784,7 @@ public class HypervisorHostHelper { } public static VMwareDVSPortSetting createVmwareDVPortSettingSpec(DVSTrafficShapingPolicy shapingPolicy, DVSSecurityPolicy secPolicy, - VmwareDistributedVirtualSwitchVlanSpec vlanSpec) { + VmwareDistributedVirtualSwitchVlanSpec vlanSpec) { VMwareDVSPortSetting dvsPortSetting = new VMwareDVSPortSetting(); dvsPortSetting.setVlan(vlanSpec); dvsPortSetting.setSecurityPolicy(secPolicy); @@ -864,7 +864,7 @@ public class HypervisorHostHelper { } public static Pair prepareNetwork(String vSwitchName, String namePrefix, HostMO hostMo, String vlanId, Integer networkRateMbps, - Integer networkRateMulticastMbps, long timeOutMs, boolean syncPeerHosts, BroadcastDomainType broadcastDomainType, String nicUuid) throws Exception { + Integer networkRateMulticastMbps, long timeOutMs, boolean syncPeerHosts, BroadcastDomainType broadcastDomainType, String nicUuid) throws Exception { HostVirtualSwitch vSwitch; if (vSwitchName == null) { @@ -887,7 +887,7 @@ public class HypervisorHostHelper { * prepare networks for in this function. */ BroadcastDomainType[] supportedBroadcastTypes = - new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan, + new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan, BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan}; if (!Arrays.asList(supportedBroadcastTypes).contains(broadcastDomainType)) { @@ -981,7 +981,7 @@ public class HypervisorHostHelper { try { if (lock.lock(DEFAULT_LOCK_TIMEOUT_SECONDS)) { try { - List hosts = (List)hostMo.getContext().getVimClient().getDynamicProperty(morParent, "host"); + List hosts = hostMo.getContext().getVimClient().getDynamicProperty(morParent, "host"); if (hosts != null) { for (ManagedObjectReference otherHost : hosts) { if (!otherHost.getValue().equals(hostMo.getMor().getValue())) { @@ -990,7 +990,7 @@ public class HypervisorHostHelper { if (s_logger.isDebugEnabled()) s_logger.debug("Prepare network on other host, vlan: " + vlanId + ", host: " + otherHostMo.getHostName()); prepareNetwork(vSwitchName, namePrefix, otherHostMo, vlanId, networkRateMbps, networkRateMulticastMbps, timeOutMs, false, - broadcastDomainType, nicUuid); + broadcastDomainType, nicUuid); } catch (Exception e) { s_logger.warn("Unable to prepare network on other host, vlan: " + vlanId + ", host: " + otherHostMo.getHostName()); } @@ -1109,7 +1109,7 @@ public class HypervisorHostHelper { } public static boolean createBlankVm(VmwareHypervisorHost host, String vmName, String vmInternalCSName, int cpuCount, int cpuSpeedMHz, int cpuReservedMHz, - boolean limitCpuUse, int memoryMB, int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { + boolean limitCpuUse, int memoryMB, int memoryReserveMB, String guestOsIdentifier, ManagedObjectReference morDs, boolean snapshotDirToParent) throws Exception { if (s_logger.isInfoEnabled()) s_logger.info("Create blank VM. cpuCount: " + cpuCount + ", cpuSpeed(MHz): " + cpuSpeedMHz + ", mem(Mb): " + memoryMB); @@ -1274,7 +1274,7 @@ public class HypervisorHostHelper { } public static void importVmFromOVF(VmwareHypervisorHost host, String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption, ManagedObjectReference morRp, - ManagedObjectReference morHost) throws Exception { + ManagedObjectReference morHost) throws Exception { assert (morRp != null); @@ -1289,7 +1289,7 @@ public class HypervisorHostHelper { String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath); VmwareContext context = host.getContext(); OvfCreateImportSpecResult ovfImportResult = - context.getService().createImportSpec(context.getServiceContent().getOvfManager(), ovfDescriptor, morRp, dsMo.getMor(), importSpecParams); + context.getService().createImportSpec(context.getServiceContent().getOvfManager(), ovfDescriptor, morRp, dsMo.getMor(), importSpecParams); if (ovfImportResult == null) { String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: " + vmName + ", diskOption: " + diskOption; diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseAssignmentManagerMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseAssignmentManagerMO.java index 0a86b978305..b5e11663b70 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseAssignmentManagerMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseAssignmentManagerMO.java @@ -30,10 +30,8 @@ import com.cloud.hypervisor.vmware.util.VmwareContext; public class LicenseAssignmentManagerMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(LicenseAssignmentManagerMO.class); - private static final String LICENSE_INFO_PRODUCT_VERSION = "ProductVersion"; - private static final String LICENSE_INFO_PRODUCT_NAME = "ProductName"; - private static final String LICENSE_INFO_NAME = "Name"; private static final String LICENSE_INFO_FEATURE = "feature"; public LicenseAssignmentManagerMO(VmwareContext context, ManagedObjectReference mor) { diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseManagerMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseManagerMO.java index 7ba046dd98e..1096fabc8ec 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseManagerMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/LicenseManagerMO.java @@ -24,6 +24,7 @@ import com.cloud.hypervisor.vmware.util.VmwareContext; public class LicenseManagerMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(LicenseManagerMO.class); private ManagedObjectReference _licenseAssignmentManager = null; diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/NetworkMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/NetworkMO.java index 43ffa25ceae..e2797d39c1e 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/NetworkMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/NetworkMO.java @@ -36,6 +36,6 @@ public class NetworkMO extends BaseMO { } public List getVMsOnNetwork() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "vm"); + return _context.getVimClient().getDynamicProperty(_mor, "vm"); } } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/PerfManagerMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/PerfManagerMO.java index 205f23a6e0c..9ce028d7915 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/PerfManagerMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/PerfManagerMO.java @@ -76,7 +76,7 @@ public class PerfManagerMO extends BaseMO { public List queryAvailablePerfMetric(ManagedObjectReference morEntity, Calendar beginTime, Calendar endTime, Integer intervalId) throws Exception { return _context.getService().queryAvailablePerfMetric(_mor, morEntity, calendarToXMLGregorianCalendar(beginTime), calendarToXMLGregorianCalendar(endTime), - intervalId); + intervalId); } public PerfCompositeMetric queryPerfComposite(PerfQuerySpec spec) throws Exception { @@ -114,10 +114,10 @@ public class PerfManagerMO extends BaseMO { } public List getCounterInfo() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "perfCounter"); + return _context.getVimClient().getDynamicProperty(_mor, "perfCounter"); } public List getIntervalInfo() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "historicalInterval"); + return _context.getVimClient().getDynamicProperty(_mor, "historicalInterval"); } } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualDiskManagerMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualDiskManagerMO.java index 34d593fb6e5..32f5c00a8dd 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualDiskManagerMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualDiskManagerMO.java @@ -25,6 +25,7 @@ import com.vmware.vim25.VirtualDiskSpec; import com.cloud.hypervisor.vmware.util.VmwareContext; public class VirtualDiskManagerMO extends BaseMO { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(VirtualDiskManagerMO.class); public VirtualDiskManagerMO(VmwareContext context) { @@ -40,7 +41,7 @@ public class VirtualDiskManagerMO extends BaseMO { } public void copyVirtualDisk(String srcName, ManagedObjectReference morSrcDc, String destName, ManagedObjectReference morDestDc, VirtualDiskSpec diskSpec, - boolean force) throws Exception { + boolean force) throws Exception { ManagedObjectReference morTask = _context.getService().copyVirtualDiskTask(_mor, srcName, morSrcDc, destName, morDestDc, diskSpec, force); diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index 8c5f0a6d255..99a7425a1c2 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -489,7 +489,7 @@ public class VirtualMachineMO extends BaseMO { } public String - getSnapshotDiskFileDatastorePath(VirtualMachineFileInfo vmFileInfo, List> datastoreMounts, String snapshotDiskFile) + getSnapshotDiskFileDatastorePath(VirtualMachineFileInfo vmFileInfo, List> datastoreMounts, String snapshotDiskFile) throws Exception { // if file path start with "/", need to search all datastore mounts on the host in order @@ -597,7 +597,7 @@ public class VirtualMachineMO extends BaseMO { } public boolean createFullClone(String cloneName, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool, ManagedObjectReference morDs) - throws Exception { + throws Exception { VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec(); VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec(); @@ -621,7 +621,7 @@ public class VirtualMachineMO extends BaseMO { } public boolean createLinkedClone(String cloneName, ManagedObjectReference morBaseSnapshot, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool, - ManagedObjectReference morDs) throws Exception { + ManagedObjectReference morDs) throws Exception { assert (morBaseSnapshot != null); assert (morFolder != null); @@ -772,8 +772,8 @@ public class VirtualMachineMO extends BaseMO { } NetworkDetails details = - new NetworkDetails(name, oc.getObj(), (morVms != null ? morVms.getManagedObjectReference().toArray( - new ManagedObjectReference[morVms.getManagedObjectReference().size()]) : null), gcTagValue); + new NetworkDetails(name, oc.getObj(), (morVms != null ? morVms.getManagedObjectReference().toArray( + new ManagedObjectReference[morVms.getManagedObjectReference().size()]) : null), gcTagValue); networks.add(details); } @@ -811,13 +811,13 @@ public class VirtualMachineMO extends BaseMO { String vmxPathTokens[] = vmxFilePath.split("\\[|\\]|/"); StringBuffer sb = new StringBuffer("https://" + _context.getServerAddress() + "/folder/"); - sb.append(URLEncoder.encode(vmxPathTokens[2].trim())); + sb.append(URLEncoder.encode(vmxPathTokens[2].trim(), "UTF-8")); sb.append("/"); - sb.append(URLEncoder.encode(vmxPathTokens[3].trim())); + sb.append(URLEncoder.encode(vmxPathTokens[3].trim(), "UTF-8")); sb.append("?dcPath="); - sb.append(URLEncoder.encode(dcInfo.second())); + sb.append(URLEncoder.encode(dcInfo.second(), "UTF-8")); sb.append("&dsName="); - sb.append(URLEncoder.encode(vmxPathTokens[1].trim())); + sb.append(URLEncoder.encode(vmxPathTokens[1].trim(), "UTF-8")); return sb.toString(); } @@ -906,12 +906,12 @@ public class VirtualMachineMO extends BaseMO { // vmdkDatastorePath: [datastore name] vmdkFilePath public void createDisk(String vmdkDatastorePath, VirtualDiskType diskType, VirtualDiskMode diskMode, String rdmDeviceName, int sizeInMb, - ManagedObjectReference morDs, int controllerKey) throws Exception { + ManagedObjectReference morDs, int controllerKey) throws Exception { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - createDisk(). target MOR: " + _mor.getValue() + ", vmdkDatastorePath: " + vmdkDatastorePath + ", sizeInMb: " + sizeInMb + - ", diskType: " + diskType + ", diskMode: " + diskMode + ", rdmDeviceName: " + rdmDeviceName + ", datastore: " + morDs.getValue() + ", controllerKey: " + - controllerKey); + ", diskType: " + diskType + ", diskMode: " + diskMode + ", rdmDeviceName: " + rdmDeviceName + ", datastore: " + morDs.getValue() + ", controllerKey: " + + controllerKey); assert (vmdkDatastorePath != null); assert (morDs != null); @@ -995,7 +995,7 @@ public class VirtualMachineMO extends BaseMO { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - attachDisk(). target MOR: " + _mor.getValue() + ", vmdkDatastorePath: " + new Gson().toJson(vmdkDatastorePathChain) + - ", datastore: " + morDs.getValue()); + ", datastore: " + morDs.getValue()); VirtualDevice newDisk = VmwareHelper.prepareDiskDevice(this, null, getScsiDeviceControllerKey(), vmdkDatastorePathChain, morDs, -1, 1); VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec(); @@ -1055,7 +1055,7 @@ public class VirtualMachineMO extends BaseMO { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - detachDisk(). target MOR: " + _mor.getValue() + ", vmdkDatastorePath: " + vmdkDatastorePath + ", deleteBacking: " + - deleteBackingFile); + deleteBackingFile); // Note: if VM has been taken snapshot, original backing file will be renamed, therefore, when we try to find the matching // VirtualDisk, we only perform prefix matching @@ -1152,7 +1152,7 @@ public class VirtualMachineMO extends BaseMO { if (s_logger.isTraceEnabled()) s_logger.trace("vCenter API trace - attachIso(). target MOR: " + _mor.getValue() + ", isoDatastorePath: " + isoDatastorePath + ", datastore: " + - morDs.getValue() + ", connect: " + connect + ", connectAtBoot: " + connectAtBoot); + morDs.getValue() + ", connect: " + connect + ", connectAtBoot: " + connectAtBoot); assert (isoDatastorePath != null); assert (morDs != null); @@ -1260,7 +1260,7 @@ public class VirtualMachineMO extends BaseMO { } if ("msg.cdromdisconnect.locked".equalsIgnoreCase(msg.getId())) { s_logger.info("Found that VM has a pending question that we need to answer programmatically, question id: " + msg.getId() + - ", for safe operation we will automatically decline it"); + ", for safe operation we will automatically decline it"); vmMo.answerVM(question.getId(), "1"); break; } @@ -1277,7 +1277,7 @@ public class VirtualMachineMO extends BaseMO { msgText = tokens[1]; if ("msg.cdromdisconnect.locked".equalsIgnoreCase(msgId)) { s_logger.info("Found that VM has a pending question that we need to answer programmatically, question id: " + question.getId() + - ". Message id : " + msgId + ". Message text : " + msgText + ", for safe operation we will automatically decline it."); + ". Message id : " + msgId + ". Message text : " + msgText + ", for safe operation we will automatically decline it."); vmMo.answerVM(question.getId(), "1"); } } @@ -1609,7 +1609,7 @@ public class VirtualMachineMO extends BaseMO { // return the disk chain (VMDK datastore paths) for cloned snapshot public Pair cloneFromCurrentSnapshot(String clonedVmName, int cpuSpeedMHz, int memoryMb, String diskDevice, ManagedObjectReference morDs) - throws Exception { + throws Exception { assert (morDs != null); String[] disks = getCurrentSnapshotDiskChainDatastorePaths(diskDevice); VirtualMachineMO clonedVm = cloneFromDiskChain(clonedVmName, cpuSpeedMHz, memoryMb, disks, morDs); @@ -1796,7 +1796,7 @@ public class VirtualMachineMO extends BaseMO { } public int getScsiDeviceControllerKey() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -1811,7 +1811,7 @@ public class VirtualMachineMO extends BaseMO { } public int getScsiDeviceControllerKeyNoException() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -1847,7 +1847,7 @@ public class VirtualMachineMO extends BaseMO { // return pair of VirtualDisk and disk device bus name(ide0:0, etc) public Pair getDiskDevice(String vmdkDatastorePath, boolean matchExactly) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath); DatastoreFile dsSrcFile = new DatastoreFile(vmdkDatastorePath); @@ -1893,7 +1893,7 @@ public class VirtualMachineMO extends BaseMO { } public String getDiskCurrentTopBackingFileInChain(String deviceBusName) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if (device instanceof VirtualDisk) { @@ -1915,7 +1915,7 @@ public class VirtualMachineMO extends BaseMO { } public VirtualDisk getDiskDeviceByDeviceBusName(String deviceBusName) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -1933,7 +1933,7 @@ public class VirtualMachineMO extends BaseMO { public VirtualMachineDiskInfoBuilder getDiskInfoBuilder() throws Exception { VirtualMachineDiskInfoBuilder builder = new VirtualMachineDiskInfoBuilder(); - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -2049,7 +2049,7 @@ public class VirtualMachineMO extends BaseMO { public List getVirtualDisks() throws Exception { List virtualDisks = new ArrayList(); - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); for (VirtualDevice device : devices) { if (device instanceof VirtualDisk) { @@ -2061,7 +2061,7 @@ public class VirtualMachineMO extends BaseMO { } public List detachAllDisksExcept(String vmdkBaseName, String deviceBusName) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec(); List detachedDiskFiles = new ArrayList(); @@ -2105,12 +2105,12 @@ public class VirtualMachineMO extends BaseMO { } public List getAllDeviceList() throws Exception { - return (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + return _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); } public VirtualDisk[] getAllDiskDevice() throws Exception { List deviceList = new ArrayList(); - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if (device instanceof VirtualDisk) { @@ -2163,7 +2163,7 @@ public class VirtualMachineMO extends BaseMO { } public int tryGetIDEDeviceControllerKey() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -2177,7 +2177,7 @@ public class VirtualMachineMO extends BaseMO { } public int getIDEDeviceControllerKey() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -2197,7 +2197,7 @@ public class VirtualMachineMO extends BaseMO { } public VirtualDevice getIsoDevice() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if (device instanceof VirtualCdrom) { @@ -2209,7 +2209,7 @@ public class VirtualMachineMO extends BaseMO { } public int getPCIDeviceControllerKey() throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { @@ -2229,7 +2229,7 @@ public class VirtualMachineMO extends BaseMO { } public int getNextDeviceNumber(int controllerKey) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); int deviceNumber = -1; if (devices != null && devices.size() > 0) { @@ -2245,7 +2245,7 @@ public class VirtualMachineMO extends BaseMO { } private List getNicDevices(boolean sorted) throws Exception { - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); List nics = new ArrayList(); if (devices != null) { @@ -2325,7 +2325,7 @@ public class VirtualMachineMO extends BaseMO { List returnList = new ArrayList(); - List devices = (List)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); if (devices != null) { for (VirtualDevice device : devices) { @@ -2346,7 +2346,6 @@ public class VirtualMachineMO extends BaseMO { } public boolean unmountToolsInstaller() throws Exception { - int i = 1; // Monitor VM questions final Boolean[] flags = {false}; final VirtualMachineMO vmMo = this; @@ -2376,7 +2375,7 @@ public class VirtualMachineMO extends BaseMO { } if ("msg.cdromdisconnect.locked".equalsIgnoreCase(msg.getId())) { s_logger.info("Found that VM has a pending question that we need to answer programmatically, question id: " + msg.getId() + - ", for safe operation we will automatically decline it"); + ", for safe operation we will automatically decline it"); vmMo.answerVM(question.getId(), "1"); break; } @@ -2393,7 +2392,7 @@ public class VirtualMachineMO extends BaseMO { msgText = tokens[1]; if ("msg.cdromdisconnect.locked".equalsIgnoreCase(msgId)) { s_logger.info("Found that VM has a pending question that we need to answer programmatically, question id: " + question.getId() + - ". Message id : " + msgId + ". Message text : " + msgText + ", for safe operation we will automatically decline it."); + ". Message id : " + msgId + ". Message text : " + msgText + ", for safe operation we will automatically decline it."); vmMo.answerVM(question.getId(), "1"); } } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java index 3c2c81d8a5e..e81665f71b7 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java @@ -27,8 +27,8 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession; import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; import javax.xml.ws.WebServiceException; +import javax.xml.ws.handler.MessageContext; import org.apache.log4j.Logger; @@ -144,6 +144,7 @@ public class VmwareClient { ServiceContent serviceContent = vimPort.retrieveServiceContent(svcInstRef); // Extract a cookie. See vmware sample program com.vmware.httpfileaccess.GetVMFiles + @SuppressWarnings("unchecked") Map> headers = (Map>)((BindingProvider)vimPort).getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS); List cookies = headers.get("Set-cookie"); String cookieValue = cookies.get(0); @@ -256,17 +257,18 @@ public class VmwareClient { * @throws Exception * in case of error. */ - public Object getDynamicProperty(ManagedObjectReference mor, String propertyName) throws Exception { + @SuppressWarnings("unchecked") + public T getDynamicProperty(ManagedObjectReference mor, String propertyName) throws Exception { List props = new ArrayList(); props.add(propertyName); List objContent = retrieveMoRefProperties(mor, props); - Object propertyValue = null; + T propertyValue = null; if (objContent != null && objContent.size() > 0) { List dynamicProperty = objContent.get(0).getPropSet(); if (dynamicProperty != null && dynamicProperty.size() > 0) { DynamicProperty dp = dynamicProperty.get(0); - propertyValue = dp.getVal(); + propertyValue = (T)dp.getVal(); /* * If object is ArrayOfXXX object, then get the XXX[] by * invoking getXXX() on the object. @@ -274,13 +276,13 @@ public class VmwareClient { * ArrayOfManagedObjectReference.getManagedObjectReference() * returns ManagedObjectReference[] array. */ - Class dpCls = propertyValue.getClass(); + Class dpCls = propertyValue.getClass(); String dynamicPropertyName = dpCls.getName(); if (dynamicPropertyName.indexOf("ArrayOf") != -1) { String methodName = "get" + dynamicPropertyName.substring(dynamicPropertyName.indexOf("ArrayOf") + "ArrayOf".length(), dynamicPropertyName.length()); - Method getMorMethod = dpCls.getDeclaredMethod(methodName, null); - propertyValue = getMorMethod.invoke(propertyValue, (Object[])null); + Method getMorMethod = dpCls.getDeclaredMethod(methodName, (Class)null); + propertyValue = (T)getMorMethod.invoke(propertyValue, (Object[])null); } } } @@ -359,7 +361,7 @@ public class VmwareClient { * @throws InvalidCollectorVersionFaultMsg */ private Object[] waitForValues(ManagedObjectReference objmor, String[] filterProps, String[] endWaitProps, Object[][] expectedVals) throws InvalidPropertyFaultMsg, - RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg { + RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg { // version string is initially null String version = ""; Object[] endVals = new Object[endWaitProps.length]; diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java index eaa205ebba3..08456c4b782 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java @@ -26,6 +26,7 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; @@ -375,7 +376,7 @@ public class VmwareContext { } } - public void uploadVmdkFile(String httpMethod, String urlString, String localFileName, long totalBytesUpdated, ActionDelegate progressUpdater) throws Exception { + public void uploadVmdkFile(String httpMethod, String urlString, String localFileName, long totalBytesUpdated, ActionDelegate progressUpdater) throws Exception { HttpURLConnection conn = getRawHTTPConnection(urlString); @@ -418,7 +419,7 @@ public class VmwareContext { } } - public long downloadVmdkFile(String urlString, String localFileName, long totalBytesDownloaded, ActionDelegate progressUpdater) throws Exception { + public long downloadVmdkFile(String urlString, String localFileName, long totalBytesDownloaded, ActionDelegate progressUpdater) throws Exception { HttpURLConnection conn = getRawHTTPConnection(urlString); String cookie = _vimClient.getServiceCookie(); @@ -547,7 +548,7 @@ public class VmwareContext { - */ + */ public String[] listDatastoreDirContent(String urlString) throws Exception { List fileList = new ArrayList(); String content = new String(getResourceContent(urlString)); @@ -583,8 +584,12 @@ public class VmwareContext { sb.append(_serverAddress); sb.append("/folder/"); sb.append(relativePath); - sb.append("?dcPath=").append(URLEncoder.encode(dcName)).append("&dsName="); - sb.append(URLEncoder.encode(datastoreName)); + try { + sb.append("?dcPath=").append(URLEncoder.encode(dcName, "UTF-8")); + sb.append("&dsName=").append(URLEncoder.encode(datastoreName, "UTF-8")); + } catch (UnsupportedEncodingException e) { + s_logger.error("Unable to encode URL. dcPath : " + dcName + ", dsName :" + datastoreName, e); + } return sb.toString(); } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContextPool.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContextPool.java index e744cbfd4b0..c97c01f32c3 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContextPool.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContextPool.java @@ -134,41 +134,6 @@ public class VmwareContextPool { }; } - private void getIdleCheckContexts(List l, int batchSize) { - synchronized (this) { - for (Map.Entry> entry : _pool.entrySet()) { - if (entry.getValue() != null) { - int count = 0; - while (entry.getValue().size() > 0 && count < batchSize) { - VmwareContext context = entry.getValue().remove(0); - context.setPoolInfo(this, entry.getKey()); - l.add(context); - count++; - } - } - } - } - } - - private void doIdleCheck() { - List l = new ArrayList(); - int batchSize = (int)(_idleCheckIntervalMs / 1000); // calculate batch size at 1 request/sec rate - getIdleCheckContexts(l, batchSize); - - for (VmwareContext context : l) { - try { - context.idleCheck(); - - if (s_logger.isTraceEnabled()) - s_logger.trace("Recyle context after idle check"); - returnContext(context); - } catch (Throwable e) { - s_logger.warn("Exception caught during VmwareContext idle check, close and discard the context", e); - context.close(); - } - } - } - private void getKeepAliveCheckContexts(List l, int batchSize) { synchronized (this) { int size = Math.min(_outstandingRegistry.size(), batchSize); diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java index 1f3d28b7ca1..dd68737c3f6 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java @@ -148,6 +148,7 @@ public class VmwareGuestOsMapper { s_mapper.put("Red Hat Enterprise Linux 5.3 (64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST); s_mapper.put("Red Hat Enterprise Linux 5.4 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST); s_mapper.put("Red Hat Enterprise Linux 5.4 (64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST); + s_mapper.put("Red Hat Enterprise Linux 6.0 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_GUEST); s_mapper.put("Red Hat Enterprise Linux 6.0 (64-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_64_GUEST); s_mapper.put("Red Hat Enterprise Linux 6.1 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_GUEST); s_mapper.put("Red Hat Enterprise Linux 6.1 (64-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_64_GUEST); @@ -170,6 +171,8 @@ public class VmwareGuestOsMapper { s_mapper.put("Ubuntu 10.04 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST); s_mapper.put("Ubuntu 10.10 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST); s_mapper.put("Ubuntu 10.10 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST); + s_mapper.put("Ubuntu 12.04 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST); + s_mapper.put("Ubuntu 12.04 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST); s_mapper.put("Other Ubuntu (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST); s_mapper.put("Other Ubuntu (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST); @@ -185,4 +188,5 @@ public class VmwareGuestOsMapper { public static VirtualMachineGuestOsIdentifier getGuestOsIdentifier(String guestOsName) { return s_mapper.get(guestOsName); } + } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java index c1658b04c87..d29e0f27237 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java @@ -71,6 +71,7 @@ import com.cloud.utils.Ternary; import com.cloud.utils.exception.ExceptionUtil; public class VmwareHelper { + @SuppressWarnings("unused") private static final Logger s_logger = Logger.getLogger(VmwareHelper.class); public static boolean isReservedScsiDeviceNumber(int deviceNumber) { @@ -78,29 +79,29 @@ public class VmwareHelper { } public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String portGroupName, - String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { + String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { VirtualEthernetCard nic; switch (deviceType) { - case E1000: - nic = new VirtualE1000(); - break; + case E1000: + nic = new VirtualE1000(); + break; - case PCNet32: - nic = new VirtualPCNet32(); - break; + case PCNet32: + nic = new VirtualPCNet32(); + break; - case Vmxnet2: - nic = new VirtualVmxnet2(); - break; + case Vmxnet2: + nic = new VirtualVmxnet2(); + break; - case Vmxnet3: - nic = new VirtualVmxnet3(); - break; + case Vmxnet3: + nic = new VirtualVmxnet3(); + break; - default: - assert (false); - nic = new VirtualE1000(); + default: + assert (false); + nic = new VirtualE1000(); } VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo(); @@ -121,29 +122,29 @@ public class VmwareHelper { } public static VirtualDevice prepareDvNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String dvPortGroupName, - String dvSwitchUuid, String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { + String dvSwitchUuid, String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { VirtualEthernetCard nic; switch (deviceType) { - case E1000: - nic = new VirtualE1000(); - break; + case E1000: + nic = new VirtualE1000(); + break; - case PCNet32: - nic = new VirtualPCNet32(); - break; + case PCNet32: + nic = new VirtualPCNet32(); + break; - case Vmxnet2: - nic = new VirtualVmxnet2(); - break; + case Vmxnet2: + nic = new VirtualVmxnet2(); + break; - case Vmxnet3: - nic = new VirtualVmxnet3(); - break; + case Vmxnet3: + nic = new VirtualVmxnet3(); + break; - default: - assert (false); - nic = new VirtualE1000(); + default: + assert (false); + nic = new VirtualE1000(); } final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo(); @@ -170,7 +171,7 @@ public class VmwareHelper { // vmdkDatastorePath: [datastore name] vmdkFilePath public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, String vmdkDatastorePath, int sizeInMb, ManagedObjectReference morDs, - int deviceNumber, int contextNumber) throws Exception { + int deviceNumber, int contextNumber) throws Exception { VirtualDisk disk = new VirtualDisk(); @@ -206,7 +207,7 @@ public class VmwareHelper { // vmdkDatastorePath: [datastore name] vmdkFilePath, create delta disk based on disk from template public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, String vmdkDatastorePath, int sizeInMb, ManagedObjectReference morDs, - VirtualDisk templateDisk, int deviceNumber, int contextNumber) throws Exception { + VirtualDisk templateDisk, int deviceNumber, int contextNumber) throws Exception { assert (templateDisk != null); VirtualDeviceBackingInfo parentBacking = templateDisk.getBacking(); @@ -277,7 +278,7 @@ public class VmwareHelper { // vmdkDatastorePath: [datastore name] vmdkFilePath public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, VirtualDisk device, int controllerKey, String vmdkDatastorePathChain[], - ManagedObjectReference morDs, int deviceNumber, int contextNumber) throws Exception { + ManagedObjectReference morDs, int deviceNumber, int contextNumber) throws Exception { assert (vmdkDatastorePathChain != null); assert (vmdkDatastorePathChain.length >= 1); @@ -325,8 +326,9 @@ public class VmwareHelper { return disk; } + @SuppressWarnings("unchecked") public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, Pair[] vmdkDatastorePathChain, - int deviceNumber, int contextNumber) throws Exception { + int deviceNumber, int contextNumber) throws Exception { assert (vmdkDatastorePathChain != null); assert (vmdkDatastorePathChain.length >= 1); @@ -385,6 +387,7 @@ public class VmwareHelper { backingInfo.setParent(parentBacking); } + @SuppressWarnings("unchecked") private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, Pair[] parentDatastorePathList) { VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo(); @@ -403,7 +406,7 @@ public class VmwareHelper { } public static Pair prepareIsoDevice(VirtualMachineMO vmMo, String isoDatastorePath, ManagedObjectReference morDs, boolean connect, - boolean connectAtBoot, int deviceNumber, int contextNumber) throws Exception { + boolean connectAtBoot, int deviceNumber, int contextNumber) throws Exception { boolean newCdRom = false; VirtualCdrom cdRom = (VirtualCdrom)vmMo.getIsoDevice(); @@ -549,7 +552,7 @@ public class VmwareHelper { } public static void setVmScaleUpConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int cpuSpeedMHz, int cpuReservedMhz, int memoryMB, int memoryReserveMB, - boolean limitCpuUse) { + boolean limitCpuUse) { // VM config for scaling up vmConfig.setMemoryMB((long)memoryMB); @@ -573,7 +576,7 @@ public class VmwareHelper { } public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int cpuSpeedMHz, int cpuReservedMhz, int memoryMB, int memoryReserveMB, - String guestOsIdentifier, boolean limitCpuUse) { + String guestOsIdentifier, boolean limitCpuUse) { // VM config basics vmConfig.setMemoryMB((long)memoryMB); @@ -640,10 +643,10 @@ public class VmwareHelper { //TODO: in vim 5.1, exceptions do not have a base exception class, MethodFault becomes a FaultInfo that we can only get // from individual exception through getFaultInfo, so we have to use reflection here to get MethodFault information. try { - Class cls = e.getClass(); - Method mth = cls.getDeclaredMethod("getFaultInfo", null); + Class cls = e.getClass(); + Method mth = cls.getDeclaredMethod("getFaultInfo", (Class)null); if (mth != null) { - Object fault = mth.invoke(e, null); + Object fault = mth.invoke(e, (Object[])null); if (fault instanceof MethodFault) { final StringWriter writer = new StringWriter(); writer.append("Exception: " + fault.getClass().getName() + "\n");