Merge branch 'master' into rbac

This commit is contained in:
Min Chen 2014-01-22 11:23:51 -08:00
commit 33cd1ab921
270 changed files with 5060 additions and 3515 deletions

View File

@ -1,16 +1,16 @@
Licensed to the Apache Software Foundation (ASF) under one 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 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 to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance "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, Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY "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 specific language governing permissions and limitations
under the License. under the License.

View File

@ -1,4 +1,3 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one # 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 # distributed with this work for additional information
@ -15,15 +14,5 @@
# 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 # specific language governing permissions and limitations
# under the License. # under the License.
name=api-config
parent=core
# @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 $?

View File

@ -0,0 +1,32 @@
<!--
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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<bean id="apiServiceConfiguration" class="org.apache.cloudstack.config.ApiServiceConfiguration" />
</beans>

View File

@ -69,5 +69,5 @@ public interface VirtualNetworkApplianceService {
List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd); List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd);
public static final String MinVRVersion = "4.2.0"; public static final String MinVRVersion = "4.3.0";
} }

View File

@ -461,4 +461,12 @@ public interface UserVmService {
UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException; 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);
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced", String.class, "host", "localhost", "The ip address of management server", true);
public static final ConfigKey<String> ApiServletPath = new ConfigKey<String>("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};
}
}

View File

@ -66,6 +66,7 @@ import com.cloud.stack.models.CloudStackPasswordData;
import com.cloud.stack.models.CloudStackResourceLimit; import com.cloud.stack.models.CloudStackResourceLimit;
import com.cloud.stack.models.CloudStackResourceTag; import com.cloud.stack.models.CloudStackResourceTag;
import com.cloud.stack.models.CloudStackSecurityGroup; import com.cloud.stack.models.CloudStackSecurityGroup;
import com.cloud.stack.models.CloudStackServiceOffering;
import com.cloud.stack.models.CloudStackSnapshot; import com.cloud.stack.models.CloudStackSnapshot;
import com.cloud.stack.models.CloudStackTemplate; import com.cloud.stack.models.CloudStackTemplate;
import com.cloud.stack.models.CloudStackTemplatePermission; import com.cloud.stack.models.CloudStackTemplatePermission;
@ -1414,7 +1415,7 @@ public class EC2Engine extends ManagerBase {
if (request.getInstanceType() != null) { if (request.getInstanceType() != null) {
instanceType = request.getInstanceType(); instanceType = request.getInstanceType();
} }
CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType); CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
if (svcOffering == null) { if (svcOffering == null) {
logger.info("No ServiceOffering found to be defined by name, please contact the administrator " + instanceType); logger.info("No ServiceOffering found to be defined by name, please contact the administrator " + instanceType);
throw new Exception("instanceType not found"); throw new Exception("instanceType not found");
@ -1609,7 +1610,7 @@ public class EC2Engine extends ManagerBase {
if (request.getInstanceType() != null) { if (request.getInstanceType() != null) {
String instanceType = request.getInstanceType(); String instanceType = request.getInstanceType();
CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType); CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
if (svcOffering == null) if (svcOffering == null)
throw new Exception("instanceType not found"); throw new Exception("instanceType not found");
CloudStackUserVm userVm = getApi().changeServiceForVirtualMachine(instanceId, svcOffering.getId()); 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 { try {
if (instanceType == null) if (instanceType == null)
instanceType = "m1.small"; // default value instanceType = "m1.small"; // default value
return scvoDao.getSvcOfferingByName(instanceType); List<CloudStackServiceOffering> serviceOfferings = getApi().listServiceOfferings(null, null, false, null, instanceType, null, null);
return serviceOfferings.get(0);
} catch (Exception e) { } catch (Exception e) {
logger.error("Error while retrieving ServiceOffering information by name - ", e); logger.error("Error while retrieving ServiceOffering information by name - ", e);
throw new Exception("No ServiceOffering found to be defined by name"); throw new Exception("No ServiceOffering found to be defined by name");

View File

@ -31,7 +31,7 @@ label.smb.password=SMB Password
label.smb.domain=SMB Domain label.smb.domain=SMB Domain
label.hypervisors=Hypervisors label.hypervisors=Hypervisors
label.home=Home label.home=Home
label.sockets=Sockets label.sockets=CPU Sockets
label.root.disk.size=Root disk size label.root.disk.size=Root disk size
label.s3.nfs.server=S3 NFS Server label.s3.nfs.server=S3 NFS Server
label.s3.nfs.path=S3 NFS Path label.s3.nfs.path=S3 NFS Path
@ -706,6 +706,7 @@ label.lang.arabic=Arabic
label.lang.brportugese=Brazilian Portugese label.lang.brportugese=Brazilian Portugese
label.lang.catalan=Catalan label.lang.catalan=Catalan
label.lang.chinese=Chinese (Simplified) label.lang.chinese=Chinese (Simplified)
label.lang.dutch=Dutch (Netherlands)
label.lang.english=English label.lang.english=English
label.lang.french=French label.lang.french=French
label.lang.german=German label.lang.german=German
@ -713,6 +714,7 @@ label.lang.italian=Italian
label.lang.japanese=Japanese label.lang.japanese=Japanese
label.lang.korean=Korean label.lang.korean=Korean
label.lang.norwegian=Norwegian label.lang.norwegian=Norwegian
label.lang.polish=Polish
label.lang.russian=Russian label.lang.russian=Russian
label.lang.spanish=Spanish label.lang.spanish=Spanish
label.last.disconnected=Last Disconnected label.last.disconnected=Last Disconnected

View File

@ -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. error.unresolved.internet.name=El nombre de Internet no se puede resolver.
extractable=extra\u00c3\u00adble 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. 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.delete=Fuerza Borrar
force.remove=Fuerza Retire 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. 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 ICMP.type=Tipo ICMP
image.directory=Directorio de la imagen image.directory=Directorio de la imagen
inline=en l\u00c3\u00adnea 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=Cuenta
label.account.id=ID de la 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.accounts=Cuentas
label.account.specific=espec\u00c3\u00adficas de la cuenta 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=Conecte el disco
label.action.attach.disk.processing=disco Fijaci\u00c3\u00b3n .... label.action.attach.disk.processing=Conectando el disco....
label.action.attach.iso=Adjuntar ISO label.action.attach.iso=Conectar ISO
label.action.attach.iso.processing=Colocaci\u00c3\u00b3n de la norma ISO .... label.action.attach.iso.processing=Conectando el ISO....
label.action.cancel.maintenance.mode=Cancelar modo de mantenimiento label.action.cancel.maintenance.mode=Cancelar el modo de mantenimiento
label.action.cancel.maintenance.mode.processing=Cancelaci\u00c3\u00b3n del modo de mantenimiento .... label.action.cancel.maintenance.mode.processing=Cancelando el modo de mantenimiento....
label.action.change.password=Cambiar contrase\u00c3\u00b1a label.action.change.password=Cambiar la contrase\u00f1a
label.action.change.service=Cambio de Servicio label.action.change.service=Cambiar el Servicio
label.action.change.service.processing=Cambio de servicio .... label.action.change.service.processing=Cambiando el servicio....
label.action.copy.ISO=Copia de la ISO label.action.copy.ISO=Copiar ISO
label.action.copy.ISO.processing=hacer frente ISO .... label.action.copy.ISO.processing=Copiando ISO ....
label.action.copy.template=Copia de plantilla label.action.copy.template=Copiear la plantilla
label.action.copy.template.processing=hacer frente plantilla .... label.action.copy.template.processing=Copiando la plantilla ....
label.action.create.template=Crear plantilla label.action.create.template=Crear plantilla
label.action.create.template.from.vm=Crear plantilla de VM label.action.create.template.from.vm=Crear plantilla de VM
label.action.create.template.from.volume=Crear plantilla de volumen label.action.create.template.from.volume=Crear plantilla de volumen
@ -250,6 +264,9 @@ label.alert=Alerta
label.algorithm=Algoritmo label.algorithm=Algoritmo
label.allocated=Asignados label.allocated=Asignados
label.api.key=clave de API 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=Asignar
label.assign.to.load.balancer=instancia de Asignaci\u00c3\u00b3n de equilibrador de carga label.assign.to.load.balancer=instancia de Asignaci\u00c3\u00b3n de equilibrador de carga
label.associated.network.id=ID de red asociados label.associated.network.id=ID de red asociados
@ -263,9 +280,13 @@ label.basic.mode=Modo b\u00c3\u00a1sico
label.bootable=arranque label.bootable=arranque
label.broadcast.domain.type=Tipo de dominio de difusi\u00c3\u00b3n label.broadcast.domain.type=Tipo de dominio de difusi\u00c3\u00b3n
label.by.account=Por Cuenta label.by.account=Por Cuenta
label.by.alert.type=Por tipo de alerta
label.by.availability=Por Disponibilidad 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.domain=Por dominio
label.by.end.date=Por Fecha de finalizaci\u00c3\u00b3n 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.level=por Nivel
label.by.pod=Por Pod label.by.pod=Por Pod
label.by.role=por funci\u00c3\u00b3n label.by.role=por funci\u00c3\u00b3n
@ -300,6 +321,7 @@ label.cpu=CPU
label.cpu.utilized=CPU Utilizado label.cpu.utilized=CPU Utilizado
label.created=creaci\u00c3\u00b3n label.created=creaci\u00c3\u00b3n
label.cross.zones=Cruz Zonas label.cross.zones=Cruz Zonas
label.custom.disk.iops=IOPS personalizadas
label.custom.disk.size=Personal Disk Size label.custom.disk.size=Personal Disk Size
label.daily=diario label.daily=diario
label.data.disk.offering=Datos Disco Offering 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.month=D\u00c3\u00ada del mes
label.day.of.week=d\u00c3\u00ada de la semana label.day.of.week=d\u00c3\u00ada de la semana
label.default.use=Usar por defecto label.default.use=Usar por defecto
label.delete.alerts=Eliminar alertas
label.delete=Eliminar label.delete=Eliminar
label.delete.events=Eliminar sucesos
label.deleting.failed=No se pudo eliminar label.deleting.failed=No se pudo eliminar
label.deleting.processing=Eliminar .... label.deleting.processing=Eliminar ....
label.description=Descripci\u00c3\u00b3n label.description=Descripci\u00c3\u00b3n
@ -319,6 +343,9 @@ label.DHCP.server.type=Tipo de servidor DHCP
label.disabled=personas de movilidad reducida label.disabled=personas de movilidad reducida
label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso
label.disk.allocated=disco asignado 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.offering=disco Ofrenda
label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB) label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB)
label.disk.size=tama\u00c3\u00b1o de disco 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.double.quotes.are.not.allowed=comillas dobles no se permite
label.download.progress=Progreso de la descarga label.download.progress=Progreso de la descarga
label.edit=Editar label.edit=Editar
label.egress.default.policy=Directiva de salida predeterminada
label.email=correo electr\u00c3\u00b3nico label.email=correo electr\u00c3\u00b3nico
label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN
label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN
@ -374,6 +402,8 @@ label.host.name=nombre de host
label.hosts=Ej\u00c3\u00a9rcitos label.hosts=Ej\u00c3\u00a9rcitos
label.hourly=por hora label.hourly=por hora
label.hypervisor=Hypervisor label.hypervisor=Hypervisor
label.hypervisors=Hipervisores
label.hypervisor.snapshot.reserve=Reserva de instant\u00e1neas de hipervisores
label.hypervisor.type=Tipo Hypervisor label.hypervisor.type=Tipo Hypervisor
label.id=ID label.id=ID
label.info=Informaci\u00c3\u00b3n label.info=Informaci\u00c3\u00b3n
@ -576,7 +606,10 @@ label.resource=Recursos
label.resources=Recursos label.resources=Recursos
label.role=Papel label.role=Papel
label.root.disk.offering=Root Disco Offering label.root.disk.offering=Root Disco Offering
label.routing=Enrutamiento
label.running.vms=Ejecuci\u00c3\u00b3n de m\u00c3\u00a1quinas virtuales 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.s3.secret_key=clave secreta
label.saturday=s\u00c3\u00a1bado label.saturday=s\u00c3\u00a1bado
label.save=Guardar label.save=Guardar
@ -594,6 +627,7 @@ label.select.a.zone=Seleccione una zona.
label.sent=Enviados label.sent=Enviados
label.server=Servidor label.server=Servidor
label.service.offering=Oferta de Servicio label.service.offering=Oferta de Servicio
label.service.state=Estado del servicio
label.session.expired=Session Caducado label.session.expired=Session Caducado
label.shared=compartidas label.shared=compartidas
label.SharedMountPoint=SharedMountPoint 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.schedule=Lista de instant\u00c3\u00a1neas
label.snapshot.s=Instant\u00c3\u00a1nea (s) label.snapshot.s=Instant\u00c3\u00a1nea (s)
label.snapshots=instant\u00c3\u00a1neas label.snapshots=instant\u00c3\u00a1neas
label.sockets=Sockets
label.source.nat=NAT Fuente label.source.nat=NAT Fuente
label.specify.vlan=Especifique VLAN label.specify.vlan=Especifique VLAN
label.specify.vxlan=Especifique VXLAN label.specify.vxlan=Especifique VXLAN
@ -636,6 +671,7 @@ label.submit=Enviar
label.submitted.by=[Enviado por\: <span id\="submitted_by"> </span>] label.submitted.by=[Enviado por\: <span id\="submitted_by"> </span>]
label.succeeded=Sucesor label.succeeded=Sucesor
label.sunday=domingo label.sunday=domingo
label.switch.type=Cambiar el tipo
label.system.capacity=Capacidad de todo el sistema label.system.capacity=Capacidad de todo el sistema
label.system.vm=Sistema de VM label.system.vm=Sistema de VM
label.system.vms=Sistema de m\u00c3\u00a1quinas virtuales 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.password=vCenter Contrase\u00c3\u00b1a
label.vcenter.username=vCenter Nombre de usuario label.vcenter.username=vCenter Nombre de usuario
label.version=Versi\u00c3\u00b3n label.version=Versi\u00c3\u00b3n
label.view.secondary.ips=Ver las IP secundarias
label.virtual.appliances=Virtual Appliances label.virtual.appliances=Virtual Appliances
label.virtual.appliance=Virtual Appliance label.virtual.appliance=Virtual Appliance
label.virtual.machines=Maquinas virtuales 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.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.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.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.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.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. 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.

View File

@ -641,6 +641,7 @@ label.lang.arabic=Arabe
label.lang.brportugese=Portuguais Br\u00e9sil label.lang.brportugese=Portuguais Br\u00e9sil
label.lang.catalan=Catalan label.lang.catalan=Catalan
label.lang.chinese=Chinois (simplifi\u00e9) label.lang.chinese=Chinois (simplifi\u00e9)
label.lang.dutch=N\u00e9erlandais
label.lang.english=Anglais label.lang.english=Anglais
label.lang.french=Fran\u00e7ais label.lang.french=Fran\u00e7ais
label.lang.german=Allemand label.lang.german=Allemand
@ -648,6 +649,7 @@ label.lang.italian=Italien
label.lang.japanese=Japonais label.lang.japanese=Japonais
label.lang.korean=Cor\u00e9en label.lang.korean=Cor\u00e9en
label.lang.norwegian=Norv\u00e9gien label.lang.norwegian=Norv\u00e9gien
label.lang.polish=Polonais
label.lang.russian=Russe label.lang.russian=Russe
label.lang.spanish=Espagnol label.lang.spanish=Espagnol
label.last.disconnected=Derni\u00e8re D\u00e9connexion label.last.disconnected=Derni\u00e8re D\u00e9connexion

File diff suppressed because it is too large Load Diff

View File

@ -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.<br/> 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

View File

@ -373,6 +373,7 @@ label.compute.and.storage=Processamento e Armazenamento
label.compute.offering=Oferta de Computa\u00e7\u00e3o label.compute.offering=Oferta de Computa\u00e7\u00e3o
label.configuration=Configura\u00e7\u00e3o label.configuration=Configura\u00e7\u00e3o
label.configure=Configurar label.configure=Configurar
label.configure.ldap=Configurar LDAP
label.configure.network.ACLs=Configure ACLs de rede label.configure.network.ACLs=Configure ACLs de rede
label.configure.vpc=Configurar VPC label.configure.vpc=Configurar VPC
label.confirmation=Confirma\u00e7\u00e3o label.confirmation=Confirma\u00e7\u00e3o
@ -390,6 +391,7 @@ label.cpu.mhz=CPU (em MHz)
label.cpu.utilized=CPU Utilizada label.cpu.utilized=CPU Utilizada
label.created.by.system=Criado pelo sistema label.created.by.system=Criado pelo sistema
label.created=Criado label.created=Criado
label.create.nfs.secondary.staging.store=Criar storage staging secund\u00e1rio NFS
label.create.project=Criar um projeto label.create.project=Criar um projeto
label.create.template=Criar template label.create.template=Criar template
label.create.VPN.connection=Criar uma conex\u00e3o VPN 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.delete.vpn.user=Deletar usu\u00e1rio VPN
label.deleting.failed=Falha ao remover label.deleting.failed=Falha ao remover
label.deleting.processing=Removendo.... label.deleting.processing=Removendo....
label.deployment.planner=Deployment planejado
label.description=Descri\u00e7\u00e3o label.description=Descri\u00e7\u00e3o
label.destination.physical.network.id=ID de destino da rede f\u00edsica label.destination.physical.network.id=ID de destino da rede f\u00edsica
label.destination.zone=Zona de Destino label.destination.zone=Zona de Destino
@ -617,6 +620,9 @@ label.launch=Executar
label.launch.vm=Executar VM label.launch.vm=Executar VM
label.launch.zone=Executar zona. label.launch.zone=Executar zona.
label.LB.isolation=Isolamento de LB 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.least.connections=Least connections
label.level=N\u00edvel label.level=N\u00edvel
label.load.balancer=Load Balancer 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.CIFS.username=PING CIFS username
label.PING.dir=PING Directory label.PING.dir=PING Directory
label.PING.storage.IP=Disparar PING para IP do Storage 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.specify.netscaler.info=Por favor especifique as informa\u00e7\u00f5es do Netscaler
label.please.wait=Por Favor Aguarde label.please.wait=Por Favor Aguarde
label.pod.name=Nome do Pod label.pod.name=Nome do Pod
@ -791,6 +798,7 @@ label.pod=POD
label.pods=Pods label.pods=Pods
label.port.forwarding=Encaminhamento de Porta label.port.forwarding=Encaminhamento de Porta
label.port.forwarding.policies=Pol\u00edticas de redirecionamento de portas label.port.forwarding.policies=Pol\u00edticas de redirecionamento de portas
label.port=Porta
label.port.range=Range de Porta label.port.range=Range de Porta
label.PreSetup=PreSetup label.PreSetup=PreSetup
label.previous=Anterior label.previous=Anterior
@ -829,6 +837,15 @@ label.public.zone=Zona P\u00fablica
label.purpose=Prop\u00f3sito label.purpose=Prop\u00f3sito
label.Pxe.server.type=Tipo de Servidor PXE label.Pxe.server.type=Tipo de Servidor PXE
label.quickview=Visualiza\u00e7\u00e3o r\u00e1pida 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.reboot=Reiniciar
label.recent.errors=Erros Recentes label.recent.errors=Erros Recentes
label.redundant.router.capability=Recurso de roteador redundante 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.from.load.balancer=Removendo Cloud Server do Load Balancer
label.remove.ingress.rule=Remover regra ingress label.remove.ingress.rule=Remover regra ingress
label.remove.ip.range=Remover range de IP label.remove.ip.range=Remover range de IP
label.remove.ldap=Remover LDAP
label.remove.pf=Remover regra de redirecionamento de porta label.remove.pf=Remover regra de redirecionamento de porta
label.remove.project.account=Remover conta de projeto label.remove.project.account=Remover conta de projeto
label.remove.rule=Remover regra 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.site.to.site.VPN=Site-to-site VPN
label.size=Tamanho label.size=Tamanho
label.skip.guide=Eu utilizei o CloudStack antes, pular este guia 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.limits=Limites de Snapshot
label.snapshot.name=Nome do Snapshot label.snapshot.name=Nome do Snapshot
label.snapshot=Snapshot label.snapshot=Snapshot
@ -1080,6 +1101,12 @@ label.vm.state=Estado da VM
label.vm.stop=Parar label.vm.stop=Parar
label.vms=VMs label.vms=VMs
label.vmware.traffic.label=Etiqueta de tr\u00e1fego VMware 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.volgroup=Grupo de Volume
label.volume=Disco label.volume=Disco
label.volume.limits=Limites de Disco label.volume.limits=Limites de Disco
@ -1230,6 +1257,7 @@ message.basic.mode.desc=Escolha este modelo de rede se voc\u00ea <b>*<u>n\u00e3o
message.change.offering.confirm=Confirme que voc\u00ea deseja mudar o plano deste Cloud Server. message.change.offering.confirm=Confirme que voc\u00ea deseja mudar o plano deste Cloud Server.
message.change.password=Por favor, troque sua senha. 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.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.guest.traffic=Configurando tr\u00e1fego do guest
message.configuring.physical.networks=Configurando redes f\u00edsicas message.configuring.physical.networks=Configurando redes f\u00edsicas
message.configuring.public.traffic=Configurando tr\u00e1fego p\u00fablico 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.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.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 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. <br/><br/> 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.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.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 message.reset.password.warning.notPasswordEnabled=O template desta inst\u00e2ncia foi criado sem senha habilitada

View File

@ -72,6 +72,7 @@ migrateVirtualMachine=1
migrateVirtualMachineWithVolume=1 migrateVirtualMachineWithVolume=1
recoverVirtualMachine=7 recoverVirtualMachine=7
expungeVirtualMachine=7 expungeVirtualMachine=7
getVirtualMachineUserData=15
#### snapshot commands #### snapshot commands
createSnapshot=15 createSnapshot=15

View File

@ -16,31 +16,6 @@
// under the License. // under the License.
package com.cloud.agent.resource.virtualnetwork; 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.Answer;
import com.cloud.agent.api.BumpUpPriorityCommand; import com.cloud.agent.api.BumpUpPriorityCommand;
import com.cloud.agent.api.CheckRouterAnswer; 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.SavePasswordCommand;
import com.cloud.agent.api.routing.SetFirewallRulesAnswer; import com.cloud.agent.api.routing.SetFirewallRulesAnswer;
import com.cloud.agent.api.routing.SetFirewallRulesCommand; 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.SetPortForwardingRulesAnswer;
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand; 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.OutputInterpreter;
import com.cloud.utils.script.Script; import com.cloud.utils.script.Script;
import com.cloud.utils.ssh.SshHelper; 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 * VirtualNetworkResource controls and configures virtual networking
@ -105,16 +99,9 @@ import com.cloud.utils.ssh.SshHelper;
public class VirtualRoutingResource implements Manager { public class VirtualRoutingResource implements Manager {
private static final Logger s_logger = Logger.getLogger(VirtualRoutingResource.class); private static final Logger s_logger = Logger.getLogger(VirtualRoutingResource.class);
private String _publicIpAddress; private String _publicIpAddress;
private String _firewallPath;
private String _loadbPath;
private String _dhcpEntryPath;
private String _publicEthIf; private String _publicEthIf;
private String _privateEthIf; private String _privateEthIf;
private String _bumpUpPriorityPath;
private String _routerProxyPath; private String _routerProxyPath;
private String _createIpAliasPath;
private String _deleteIpAliasPath;
private String _callDnsMasqPath;
private int _timeout; private int _timeout;
private int _startTimeout; private int _startTimeout;
@ -240,18 +227,16 @@ public class VirtualRoutingResource implements Manager {
FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); FirewallRule.TrafficType trafficType = allrules[0].getTrafficType();
String[][] rules = cmd.generateFwRules(); String[][] rules = cmd.generateFwRules();
final Script command = new Script(_firewallPath, _timeout, s_logger); String args = " -F";
command.add(routerIp);
command.add("-F");
if (trafficType == FirewallRule.TrafficType.Egress) { if (trafficType == FirewallRule.TrafficType.Egress) {
command.add("-E"); args += "-E";
if (egressDefault.equals("true")) { if (egressDefault.equals("true")) {
command.add("-P ", "1"); args += " -P 1";
} else if (egressDefault.equals("System")) { } else if (egressDefault.equals("System")) {
command.add("-P ", "2"); args += " -P 2";
} else { } 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++) { for (int i = 0; i < fwRules.length; i++) {
sb.append(fwRules[i]).append(','); 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) { if (result != null) {
return new SetFirewallRulesAnswer(cmd, false, results); return new SetFirewallRulesAnswer(cmd, false, results);
} }
@ -278,22 +270,21 @@ public class VirtualRoutingResource implements Manager {
int i = 0; int i = 0;
boolean endResult = true; boolean endResult = true;
for (PortForwardingRuleTO rule : cmd.getRules()) { for (PortForwardingRuleTO rule : cmd.getRules()) {
String result = null; StringBuilder args = new StringBuilder();
final Script command = new Script(_firewallPath, _timeout, s_logger); 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); String result = routerProxy("firewall_nat.sh", routerIp, args.toString());
command.add(rule.revoked() ? "-D" : "-A");
command.add("-P ", rule.getProtocol().toLowerCase()); if (result == null || result.isEmpty()) {
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 {
results[i++] = "Failed"; results[i++] = "Failed";
endResult = false; endResult = false;
} else {
results[i++] = null;
} }
} }
@ -333,35 +324,46 @@ public class VirtualRoutingResource implements Manager {
int i = 0; int i = 0;
boolean endResult = true; boolean endResult = true;
for (StaticNatRuleTO rule : cmd.getRules()) { 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 //1:1 NAT needs instanceip;publicip;domrip;op
command.add(" -l ", rule.getSrcIp()); StringBuilder args = new StringBuilder();
command.add(" -r ", rule.getDstIp()); args.append(rule.revoked() ? " -D " : " -A ");
args.append(" -l ").append(rule.getSrcIp());
args.append(" -r ").append(rule.getDstIp());
if (rule.getProtocol() != null) { if (rule.getProtocol() != null) {
command.add(" -P ", rule.getProtocol().toLowerCase()); args.append(" -P ").append(rule.getProtocol().toLowerCase());
} }
command.add(" -d ", rule.getStringSrcPortRange()); args.append(" -d ").append(rule.getStringSrcPortRange());
command.add(" -G "); args.append(" -G ");
result = command.execute(); String result = routerProxy("firewall_nat.sh", routerIp, args.toString());
if (result == null) {
results[i++] = null; if (result == null || result.isEmpty()) {
} else {
results[i++] = "Failed"; results[i++] = "Failed";
endResult = false; endResult = false;
} else {
results[i++] = null;
} }
} }
return new SetStaticNatRulesAnswer(cmd, results, endResult); 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); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (routerIp == null) { if (routerIp == null) {
@ -375,25 +377,24 @@ public class VirtualRoutingResource implements Manager {
tmpCfgFileContents += config[i]; tmpCfgFileContents += config[i];
tmpCfgFileContents += "\n"; 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 { try {
SshHelper.scpTo(routerIp, 3922, "root", permKey, null, "/etc/haproxy/", tmpCfgFileContents.getBytes(), "haproxy.cfg.new", null);
String[][] rules = cfgtr.generateFwRules(cmd); String[][] rules = cfgtr.generateFwRules(cmd);
String[] addRules = rules[LoadBalancerConfigurator.ADD]; String[] addRules = rules[LoadBalancerConfigurator.ADD];
String[] removeRules = rules[LoadBalancerConfigurator.REMOVE]; String[] removeRules = rules[LoadBalancerConfigurator.REMOVE];
String[] statRules = rules[LoadBalancerConfigurator.STATS]; String[] statRules = rules[LoadBalancerConfigurator.STATS];
String ip = cmd.getNic().getIp(); String args = "";
String args = " -i " + ip;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (addRules.length > 0) { if (addRules.length > 0) {
for (int i = 0; i < addRules.length; i++) { for (int i = 0; i < addRules.length; i++) {
sb.append(addRules[i]).append(','); sb.append(addRules[i]).append(',');
} }
args += " -a " + sb.toString(); args += " -a " + sb.toString();
} }
@ -415,7 +416,15 @@ public class VirtualRoutingResource implements Manager {
args += " -s " + sb.toString(); 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) { if (result != null) {
return new Answer(cmd, false, "LoadBalancerConfigCommand failed"); 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) { protected Answer execute(VmDataCommand cmd) {
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
@ -503,50 +477,10 @@ public class VirtualRoutingResource implements Manager {
return new IpAssocAnswer(cmd, results); 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) { protected Answer execute(final SavePasswordCommand cmd) {
final String password = cmd.getPassword(); final String password = cmd.getPassword();
final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
final String vmName = cmd.getVmName();
final String vmIpAddress = cmd.getVmIpAddress(); final String vmIpAddress = cmd.getVmIpAddress();
final String local = vmName;
String args = "-v " + vmIpAddress; String args = "-v " + vmIpAddress;
args += " -p " + password; args += " -p " + password;
@ -559,57 +493,51 @@ public class VirtualRoutingResource implements Manager {
} }
protected Answer execute(final DhcpEntryCommand cmd) { protected Answer execute(final DhcpEntryCommand cmd) {
final Script command = new Script(_dhcpEntryPath, _timeout, s_logger); String args = " -m " + cmd.getVmMac();
command.add("-r", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP));
if (cmd.getVmIpAddress() != null) { if (cmd.getVmIpAddress() != null) {
command.add("-v", cmd.getVmIpAddress()); args += " -4 " + cmd.getVmIpAddress();
} }
command.add("-m", cmd.getVmMac()); args += " -h " + cmd.getVmName();
command.add("-n", cmd.getVmName());
if (cmd.getDefaultRouter() != null) { if (cmd.getDefaultRouter() != null) {
command.add("-d", cmd.getDefaultRouter()); args += " -d " + cmd.getDefaultRouter();
}
if (cmd.getStaticRoutes() != null) {
command.add("-s", cmd.getStaticRoutes());
} }
if (cmd.getDefaultDns() != null) { 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) { if (cmd.getVmIp6Address() != null) {
command.add("-6", cmd.getVmIp6Address()); args += " -6 " + cmd.getVmIp6Address();
command.add("-u", cmd.getDuid()); args += " -u " + cmd.getDuid();
} }
if (!cmd.isDefault()) { 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); return new Answer(cmd, result == null, result);
} }
protected Answer execute(final CreateIpAliasCommand cmd) { protected Answer execute(final CreateIpAliasCommand cmd) {
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
final Script command = new Script(_createIpAliasPath, _timeout, s_logger);
List<IpAliasTO> ipAliasTOs = cmd.getIpAliasList(); List<IpAliasTO> ipAliasTOs = cmd.getIpAliasList();
String args = ""; String args = "";
command.add(routerIp);
for (IpAliasTO ipaliasto : ipAliasTOs) { for (IpAliasTO ipaliasto : ipAliasTOs) {
args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-"; args = args + ipaliasto.getAlias_count() + ":" + ipaliasto.getRouterip() + ":" + ipaliasto.getNetmask() + "-";
} }
command.add(args); final String result = routerProxy("createipAlias.sh", routerIp, args);
final String result = command.execute();
return new Answer(cmd, result == null, result); return new Answer(cmd, result == null, result);
} }
protected Answer execute(final DeleteIpAliasCommand cmd) { protected Answer execute(final DeleteIpAliasCommand cmd) {
final Script command = new Script(_deleteIpAliasPath, _timeout, s_logger);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String args = ""; String args = "";
command.add(routerIp);
List<IpAliasTO> revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); List<IpAliasTO> revokedIpAliasTOs = cmd.getDeleteIpAliasTos();
for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { for (IpAliasTO ipAliasTO : revokedIpAliasTOs) {
args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-";
@ -619,22 +547,18 @@ public class VirtualRoutingResource implements Manager {
for (IpAliasTO ipAliasTO : activeIpAliasTOs) { for (IpAliasTO ipAliasTO : activeIpAliasTOs) {
args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-"; args = args + ipAliasTO.getAlias_count() + ":" + ipAliasTO.getRouterip() + ":" + ipAliasTO.getNetmask() + "-";
} }
command.add(args); final String result = routerProxy("deleteipAlias.sh", routerIp, args);
final String result = command.execute();
return new Answer(cmd, result == null, result); return new Answer(cmd, result == null, result);
} }
protected Answer execute(final DnsMasqConfigCommand cmd) { protected Answer execute(final DnsMasqConfigCommand cmd) {
final Script command = new Script(_callDnsMasqPath, _timeout, s_logger);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
List<DhcpTO> dhcpTos = cmd.getIps(); List<DhcpTO> dhcpTos = cmd.getIps();
String args = ""; String args = "";
for (DhcpTO dhcpTo : dhcpTos) { for (DhcpTO dhcpTo : dhcpTos) {
args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-"; args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-";
} }
command.add(routerIp); final String result = routerProxy("dnsmasq.sh", routerIp, args);
command.add(args);
final String result = command.execute();
return new Answer(cmd, result == null, result); return new Answer(cmd, result == null, result);
} }
@ -693,13 +617,9 @@ public class VirtualRoutingResource implements Manager {
} }
protected Answer execute(BumpUpPriorityCommand cmd) { protected Answer execute(BumpUpPriorityCommand cmd) {
final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String result = routerProxy("bumpup_priority.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null);
final Script command = new Script(_bumpUpPriorityPath, _timeout, s_logger);
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
command.add(routerPrivateIPAddress);
String result = command.execute(parser);
if (result != 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); 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); 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"); _publicEthIf = (String)params.get("public.network.device");
if (_publicEthIf == null) { if (_publicEthIf == null) {
_publicEthIf = "xenbr1"; _publicEthIf = "xenbr1";
@ -1154,28 +1059,10 @@ public class VirtualRoutingResource implements Manager {
} }
_privateEthIf = _privateEthIf.toLowerCase(); _privateEthIf = _privateEthIf.toLowerCase();
_bumpUpPriorityPath = findScript("bumpUpPriority.sh");
if (_bumpUpPriorityPath == null) {
throw new ConfigurationException("Unable to find bumpUpPriority.sh");
}
_routerProxyPath = findScript("router_proxy.sh"); _routerProxyPath = findScript("router_proxy.sh");
if (_routerProxyPath == null) { if (_routerProxyPath == null) {
throw new ConfigurationException("Unable to find router_proxy.sh"); 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; return true;
} }

View File

@ -23,6 +23,7 @@ import java.io.StringReader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@ -49,6 +50,7 @@ import com.cloud.exception.UnsupportedVersionException;
import com.cloud.serializer.GsonHelper; import com.cloud.serializer.GsonHelper;
import com.cloud.utils.NumbersUtil; import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
import com.cloud.utils.StringUtils;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
/** /**
@ -436,11 +438,35 @@ public class Request {
} }
buf.append(", Ver: ").append(_ver.toString()); buf.append(", Ver: ").append(_ver.toString());
buf.append(", Flags: ").append(Integer.toBinaryString(getFlags())).append(", "); 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(" }"); buf.append(" }");
return buf.toString(); 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<String> stringList = new ArrayList<String>();
Collections.addAll(stringList, temp);
cleanLogString = StringUtils.join(stringList, ",");
}
}
return cleanLogString;
}
/** /**
* Factory method for Request and Response. It expects the bytes to be * Factory method for Request and Response. It expects the bytes to be
* correctly formed so it's possible that it throws underflow exceptions * correctly formed so it's possible that it throws underflow exceptions

View File

@ -20,4 +20,5 @@ public interface VmWorkConstants {
public static final String VM_WORK_QUEUE = "VmWorkJobQueue"; public static final String VM_WORK_QUEUE = "VmWorkJobQueue";
public static final String VM_WORK_JOB_DISPATCHER = "VmWorkJobDispatcher"; 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_WAKEUP_DISPATCHER = "VmWorkJobWakeupDispatcher";
public static final String VM_WORK_JOB_PLACEHOLDER = "VmWorkJobPlaceHolder";
} }

View File

@ -492,7 +492,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId(); 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); Commands cmds = new Commands(Command.OnError.Stop);
for (Command volumeExpungeCommand : volumeExpungeCommands) { 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 TransitionTask(), 5000, VmJobStateReportInterval.value(), TimeUnit.SECONDS);
_executor.scheduleAtFixedRate(new CleanupTask(), VmOpCleanupInterval.value(), VmOpCleanupInterval.value(), TimeUnit.SECONDS); _executor.scheduleAtFixedRate(new CleanupTask(), VmOpCleanupInterval.value(), VmOpCleanupInterval.value(), TimeUnit.SECONDS);
cancelWorkItems(_nodeId); cancelWorkItems(_nodeId);
// cleanup left over place holder works
_workJobDao.expungeLeftoverWorkJobs(ManagementServerNode.getManagementServerId());
return true; return true;
} }
@ -751,7 +754,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy); Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy);
@ -1112,6 +1125,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
VolumeVO volume = _volsDao.findById(volumeId); VolumeVO volume = _volsDao.findById(volumeId);
disk.setPath(volume.get_iScsiName()); 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()); volume.setPath(volume.get_iScsiName());
_volsDao.update(volumeId, volume); _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 // 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<String, String> iqnToPath) { private void handlePath(DiskTO[] disks, Map<String, String> iqnToPath) {
if (disks != null) { if (disks != null && iqnToPath != null) {
for (DiskTO disk : disks) { for (DiskTO disk : disks) {
Map<String, String> details = disk.getDetails(); Map<String, String> details = disk.getDetails();
boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED)); boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED));
if (isManaged && disk.getPath() == null) { if (isManaged) {
Long volumeId = disk.getData().getId(); Long volumeId = disk.getData().getId();
VolumeVO volume = _volsDao.findById(volumeId); VolumeVO volume = _volsDao.findById(volumeId);
String iScsiName = volume.get_iScsiName(); String iScsiName = volume.get_iScsiName();
String path = iqnToPath.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(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = stopVmThroughJobQueue(vmUuid, cleanUpEvenIfUnableToStop); Outcome<VirtualMachine> outcome = stopVmThroughJobQueue(vmUuid, cleanUpEvenIfUnableToStop);
@ -1565,7 +1599,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = migrateVmStorageThroughJobQueue(vmUuid, destPool); Outcome<VirtualMachine> outcome = migrateVmStorageThroughJobQueue(vmUuid, destPool);
@ -1647,7 +1691,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = migrateVmThroughJobQueue(vmUuid, srcHostId, dest); Outcome<VirtualMachine> outcome = migrateVmThroughJobQueue(vmUuid, srcHostId, dest);
@ -1918,7 +1972,19 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = migrateVmWithStorageThroughJobQueue(vmUuid, srcHostId, destHostId, volumeToPool); Outcome<VirtualMachine> outcome = migrateVmWithStorageThroughJobQueue(vmUuid, srcHostId, destHostId, volumeToPool);
@ -2161,6 +2227,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.trace("VM Operation Thread Running"); s_logger.trace("VM Operation Thread Running");
try { try {
_workDao.cleanup(VmOpCleanupWait.value()); _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) { } catch (Exception e) {
s_logger.error("VM Operations failed due to ", 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(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = rebootVmThroughJobQueue(vmUuid, params); Outcome<VirtualMachine> outcome = rebootVmThroughJobQueue(vmUuid, params);
@ -2748,7 +2828,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.warn(e.getMessage()); s_logger.warn(e.getMessage());
} }
} }
} else if (serverState == State.Stopping) { } else if (serverState == State.Stopped) {
s_logger.debug("Scheduling a stop command for " + vm); s_logger.debug("Scheduling a stop command for " + vm);
_haMgr.scheduleStop(vm, hostId, WorkType.Stop); _haMgr.scheduleStop(vm, hostId, WorkType.Stop);
} else { } else {
@ -3118,7 +3198,16 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = addVmToNetworkThroughJobQueue(vm, network, requested); Outcome<VirtualMachine> outcome = addVmToNetworkThroughJobQueue(vm, network, requested);
@ -3221,7 +3310,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = removeNicFromVmThroughJobQueue(vm, nic); Outcome<VirtualMachine> outcome = removeNicFromVmThroughJobQueue(vm, nic);
@ -3460,7 +3559,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = migrateVmForScaleThroughJobQueue(vmUuid, srcHostId, dest, oldSvcOfferingId); Outcome<VirtualMachine> outcome = migrateVmForScaleThroughJobQueue(vmUuid, srcHostId, dest, oldSvcOfferingId);
@ -3709,7 +3818,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { if (!VmJobEnabled.value() || jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
// avoid re-entrance // 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 { } else {
Outcome<VirtualMachine> outcome = reconfigureVmThroughJobQueue(vmUuid, oldServiceOffering, reconfiguringOnExistingHost); Outcome<VirtualMachine> outcome = reconfigureVmThroughJobQueue(vmUuid, oldServiceOffering, reconfiguringOnExistingHost);
@ -4185,7 +4304,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(callingAccount.getId()); workJob.setAccountId(callingAccount.getId());
workJob.setUserId(callingUser.getId()); workJob.setUserId(callingUser.getId());
workJob.setStep(VmWorkJobVO.Step.Starting); workJob.setStep(VmWorkJobVO.Step.Starting);
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4238,7 +4357,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setStep(VmWorkJobVO.Step.Prepare); workJob.setStep(VmWorkJobVO.Step.Prepare);
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4291,7 +4410,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setStep(VmWorkJobVO.Step.Prepare); workJob.setStep(VmWorkJobVO.Step.Prepare);
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4341,7 +4460,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4395,7 +4514,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4447,7 +4566,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4499,7 +4618,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4549,7 +4668,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4598,7 +4717,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4647,7 +4766,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4698,7 +4817,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob.setAccountId(account.getId()); workJob.setAccountId(account.getId());
workJob.setUserId(user.getId()); workJob.setUserId(user.getId());
workJob.setVmType(vm.getType()); workJob.setVmType(VirtualMachine.Type.Instance);
workJob.setVmInstanceId(vm.getId()); workJob.setVmInstanceId(vm.getId());
workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId()); workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());
@ -4854,4 +4973,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
public Pair<JobInfo.Status, String> handleVmWorkJob(VmWork work) throws Exception { public Pair<JobInfo.Status, String> handleVmWorkJob(VmWork work) throws Exception {
return _jobHandlerProxy.handleVmWorkJob(work); 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;
}
} }

View File

@ -60,9 +60,6 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
String cmd = job.getCmd(); String cmd = job.getCmd();
assert (cmd != null); assert (cmd != null);
if (s_logger.isDebugEnabled())
s_logger.debug("Run VM work job: " + cmd + ", job origin: " + job.getRelated());
Class<?> workClz = null; Class<?> workClz = null;
try { try {
workClz = Class.forName(job.getCmd()); workClz = Class.forName(job.getCmd());
@ -80,27 +77,33 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
return; return;
} }
if (_handlers == null || _handlers.isEmpty()) { if (s_logger.isDebugEnabled())
s_logger.error("Invalid startup configuration, no work job handler is found. cmd: " + job.getCmd() + ", job info: " + job.getCmdInfo() s_logger.debug("Run VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated());
+ ", job origin: " + job.getRelated()); try {
_asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, "Invalid startup configuration. no job handler is found"); if (_handlers == null || _handlers.isEmpty()) {
return; 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<JobInfo.Status, String> 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<JobInfo.Status, String> result = handler.handleVmWorkJob(work);
_asyncJobMgr.completeAsyncJob(job.getId(), result.first(), 0, result.second());
} catch(Throwable e) { } catch(Throwable e) {
s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e); s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e);

View File

@ -323,6 +323,13 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, null, poolsToAvoid)) != null) { while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, null, poolsToAvoid)) != null) {
break; 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 @DB
public VolumeInfo createVolume(VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate template, DataCenter dc, Pod pod, Long clusterId, ServiceOffering offering, public VolumeInfo createVolume(VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate template, DataCenter dc, Pod pod, Long clusterId, ServiceOffering offering,
DiskOffering diskOffering, List<StoragePool> avoids, long size, HypervisorType hyperType) { DiskOffering diskOffering, List<StoragePool> 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); volume = updateHypervisorSnapshotReserveForVolume(diskOffering, volume, hyperType);
StoragePool pool = null; 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 // retry one more time in case of template reload is required for Vmware case
AsyncCallFuture<VolumeApiResult> future = null; AsyncCallFuture<VolumeApiResult> future = null;
if (templateId == 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); future = volService.createVolumeAsync(volume, destPool);
} else { } else {
TemplateInfo templ = tmplFactory.getTemplate(templateId, DataStoreRole.Image); 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()); 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()); newVol = _volsDao.findById(newVol.getId());
break; //break out of template-redeploy retry loop break; //break out of template-redeploy retry loop
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -27,11 +27,9 @@ import java.sql.SQLException;
import java.sql.Types; import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -83,7 +81,6 @@ public class Upgrade410to420 implements DbUpgrade {
persistVswitchConfiguration(conn); persistVswitchConfiguration(conn);
createPlaceHolderNics(conn); createPlaceHolderNics(conn);
updateRemoteAccessVpn(conn); updateRemoteAccessVpn(conn);
updateSystemVmTemplates(conn);
updateOverCommitRatioClusterDetails(conn); updateOverCommitRatioClusterDetails(conn);
updatePrimaryStore(conn); updatePrimaryStore(conn);
addEgressFwRulesForSRXGuestNw(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<HypervisorType> hypervisorsListInUse = new HashSet<HypervisorType>();
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<HypervisorType, String> NewTemplateNameList = new HashMap<HypervisorType, String>() {
{
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<HypervisorType, String> routerTemplateConfigurationNames = new HashMap<HypervisorType, String>() {
{
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<HypervisorType, String> newTemplateUrl = new HashMap<HypervisorType, String>() {
{
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<HypervisorType, String> newTemplateChecksum = new HashMap<HypervisorType, String>() {
{
put(HypervisorType.XenServer, "fb1b6e032a160d86f2c28feb5add6d83");
put(HypervisorType.VMware, "8fde62b1089e5844a9cd3b9b953f9596");
put(HypervisorType.KVM, "6cea42b2633841648040becb588bd8f0");
put(HypervisorType.LXC, "2755de1f9ef2ce4d6f2bee2efbb4da92");
put(HypervisorType.Hyperv, "fb1b6e032a160d86f2c28feb5add6d83");
}
};
for (Map.Entry<HypervisorType, String> 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; //KVM snapshot flag: only turn on if Customers is using snapshot;
private void setKVMSnapshotFlag(Connection conn) { private void setKVMSnapshotFlag(Connection conn) {
s_logger.debug("Verify and set the KVM snapshot flag if snapshot was used. "); s_logger.debug("Verify and set the KVM snapshot flag if snapshot was used. ");

View File

@ -24,10 +24,15 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Types; 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.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.crypt.DBEncryptionUtil;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script; import com.cloud.utils.script.Script;
@ -63,7 +68,9 @@ public class Upgrade421to430 implements DbUpgrade {
@Override @Override
public void performDataMigration(Connection conn) { public void performDataMigration(Connection conn) {
encryptLdapConfigParams(conn); encryptLdapConfigParams(conn);
encryptImageStoreDetails(conn);
upgradeMemoryOfSsvmOffering(conn); upgradeMemoryOfSsvmOffering(conn);
updateSystemVmTemplates(conn);
} }
private void upgradeMemoryOfSsvmOffering(Connection 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<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
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<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>(){
{ 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<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>(){
{ 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<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>(){
{ 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<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>(){
{ 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<Hypervisor.HypervisorType, String> 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 @Override
public File[] getCleanupScripts() { public File[] getCleanupScripts() {
String script = Script.findScript("", "db/schema-421to430-cleanup.sql"); String script = Script.findScript("", "db/schema-421to430-cleanup.sql");

View File

@ -25,6 +25,7 @@ import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.network.Network;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script; import com.cloud.utils.script.Script;
@ -59,6 +60,7 @@ public class Upgrade430to440 implements DbUpgrade {
@Override @Override
public void performDataMigration(Connection conn) { public void performDataMigration(Connection conn) {
populateACLGroupAccountMap(conn); populateACLGroupAccountMap(conn);
secondaryIpsAccountAndDomainIdsUpdate(conn);
} }
// populate acl_group_account_map table for existing accounts // 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."); 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 @Override
public File[] getCleanupScripts() { public File[] getCleanupScripts() {
String script = Script.findScript("", "db/schema-430to440-cleanup.sql"); String script = Script.findScript("", "db/schema-430to440-cleanup.sql");

View File

@ -26,6 +26,7 @@ import javax.inject.Inject;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailVO; 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.DataStoreRole;
import com.cloud.storage.ScopeType; import com.cloud.storage.ScopeType;
import com.cloud.utils.crypt.DBEncryptionUtil;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
@Component @Component
@ -104,7 +106,12 @@ public class ImageStoreHelper {
ImageStoreDetailVO detail = new ImageStoreDetailVO(); ImageStoreDetailVO detail = new ImageStoreDetailVO();
detail.setStoreId(store.getId()); detail.setStoreId(store.getId());
detail.setName(key); 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); imageStoreDetailsDao.persist(detail);
} }
} }

View File

@ -24,9 +24,11 @@ import javax.ejb.Local;
import org.springframework.stereotype.Component; 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.ImageStoreDetailVO;
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; 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.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria;
@ -68,7 +70,12 @@ public class ImageStoreDetailsDaoImpl extends GenericDaoBase<ImageStoreDetailVO,
List<ImageStoreDetailVO> details = listBy(sc); List<ImageStoreDetailVO> details = listBy(sc);
Map<String, String> detailsMap = new HashMap<String, String>(); Map<String, String> detailsMap = new HashMap<String, String>();
for (ImageStoreDetailVO detail : details) { 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; return detailsMap;

View File

@ -158,8 +158,9 @@ public class VolumeServiceImpl implements VolumeService {
return null; return null;
} }
@Override
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
DataStoreDriver dataStoreDriver = dataStore.getDriver(); DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
if (dataStoreDriver instanceof PrimaryDataStoreDriver) { if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
return ((PrimaryDataStoreDriver)dataStoreDriver).connectVolumeToHost(volumeInfo, host, dataStore); return ((PrimaryDataStoreDriver)dataStoreDriver).connectVolumeToHost(volumeInfo, host, dataStore);
@ -168,8 +169,9 @@ public class VolumeServiceImpl implements VolumeService {
return false; return false;
} }
@Override
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
DataStoreDriver dataStoreDriver = dataStore.getDriver(); DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
if (dataStoreDriver instanceof PrimaryDataStoreDriver) { if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore); ((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore);

View File

@ -26,7 +26,6 @@ public interface ClusterManager extends Manager {
"Interval to check for the heart beat between management server nodes", false); "Interval to check for the heart beat between management server nodes", false);
final ConfigKey<Integer> HeartbeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server", "150000", final ConfigKey<Integer> HeartbeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server", "150000",
"Threshold before self-fence the management server", true); "Threshold before self-fence the management server", true);
final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced", String.class, "host", "localhost", "The ip address of management server", true);
void OnReceiveClusterServicePdu(ClusterServicePdu pdu); void OnReceiveClusterServicePdu(ClusterServicePdu pdu);

View File

@ -1099,7 +1099,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
@Override @Override
public ConfigKey<?>[] getConfigKeys() { public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {HeartbeatInterval, HeartbeatThreshold, ManagementHostIPAdr}; return new ConfigKey<?>[] {HeartbeatInterval, HeartbeatThreshold};
} }
private boolean pingManagementNode(ManagementServerHostVO mshost) { private boolean pingManagementNode(ManagementServerHostVO mshost) {

View File

@ -29,4 +29,6 @@ public interface ConfigDepot {
Set<ConfigKey<?>> getConfigListByScope(String scope); Set<ConfigKey<?>> getConfigListByScope(String scope);
<T> void set(ConfigKey<T> key, T value); <T> void set(ConfigKey<T> key, T value);
<T> void createOrUpdateConfigObject(String componentName, ConfigKey<T> key, String value);
} }

View File

@ -27,15 +27,14 @@ import java.util.Set;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.inject.Inject; 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.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigDepotAdmin; import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.ScopedConfigStorage; import org.apache.cloudstack.framework.config.ScopedConfigStorage;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao; 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.Pair;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
@ -116,23 +115,8 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
} }
_allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(), key)); _allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(), key));
ConfigurationVO vo = _configDao.findById(key.key()); createOrupdateConfigObject(date, configurable.getConfigComponentName(), key, null);
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);
}
}
if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global)) { if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global)) {
Set<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope()); Set<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
currentConfigs.add(key); currentConfigs.add(key);
@ -142,6 +126,28 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
_configured.add(configurable); _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 @Override
public void populateConfiguration(Configurable configurable) { public void populateConfiguration(Configurable configurable) {
populateConfiguration(new Date(), configurable); populateConfiguration(new Date(), configurable);
@ -193,4 +199,10 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
public <T> void set(ConfigKey<T> key, T value) { public <T> void set(ConfigKey<T> key, T value) {
_configDao.update(key.key(), value.toString()); _configDao.update(key.key(), value.toString());
} }
@Override
public <T> void createOrUpdateConfigObject(String componentName, ConfigKey<T> key, String value) {
createOrupdateConfigObject(new Date(), componentName, key, value);
}
} }

View File

@ -30,7 +30,9 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.ResourceUnavailableException;
public class AsyncJobExecutionContext { public class AsyncJobExecutionContext {
private static final Logger s_logger = Logger.getLogger(AsyncJobExecutionContext.class);
private AsyncJob _job; private AsyncJob _job;
static private AsyncJobManager s_jobMgr; 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 // TODO : it is ugly and this will become unnecessary after we switch to full-async mode
// //
public void disjoinJob(long joinedJobId) throws InsufficientCapacityException, public void disjoinJob(long joinedJobId) throws InsufficientCapacityException,
@ -120,21 +123,34 @@ public class AsyncJobExecutionContext {
assert (_job != null); assert (_job != null);
AsyncJobJoinMapVO record = s_joinMapDao.getJoinRecord(_job.getId(), joinedJobId); AsyncJobJoinMapVO record = s_joinMapDao.getJoinRecord(_job.getId(), joinedJobId);
if (record.getJoinStatus() == JobInfo.Status.FAILED && record.getJoinResult() != null) { s_jobMgr.disjoinJob(_job.getId(), joinedJobId);
Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult());
if (exception != null && exception instanceof Exception) { if (record.getJoinStatus() == JobInfo.Status.FAILED) {
if (exception instanceof InsufficientCapacityException) if (record.getJoinResult() != null) {
throw (InsufficientCapacityException)exception; Object exception = JobSerializerHelper.fromObjectSerializedString(record.getJoinResult());
else if (exception instanceof ConcurrentOperationException) if (exception != null && exception instanceof Exception) {
throw (ConcurrentOperationException)exception; if (exception instanceof InsufficientCapacityException) {
else if (exception instanceof ResourceUnavailableException) s_logger.error("Job " + joinedJobId + " failed with InsufficientCapacityException");
throw (ResourceUnavailableException)exception; throw (InsufficientCapacityException)exception;
else }
throw new RuntimeException((Exception)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) { public void completeJoin(JobInfo.Status joinStatus, String joinResult) {
@ -151,6 +167,8 @@ public class AsyncJobExecutionContext {
public static AsyncJobExecutionContext getCurrentExecutionContext() { public static AsyncJobExecutionContext getCurrentExecutionContext() {
AsyncJobExecutionContext context = s_currentExectionContext.get(); AsyncJobExecutionContext context = s_currentExectionContext.get();
if (context == null) { 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(), context = registerPseudoExecutionContext(CallContext.current().getCallingAccountId(),
CallContext.current().getCallingUserId()); CallContext.current().getCallingUserId());
} }

View File

@ -35,4 +35,6 @@ public interface VmWorkJobDao extends GenericDao<VmWorkJobVO, Long> {
void updateStep(long workJobId, Step step); void updateStep(long workJobId, Step step);
void expungeCompletedWorkJobs(Date cutDate); void expungeCompletedWorkJobs(Date cutDate);
void expungeLeftoverWorkJobs(long msid);
} }

View File

@ -16,8 +16,11 @@
// under the License. // under the License.
package org.apache.cloudstack.framework.jobs.dao; package org.apache.cloudstack.framework.jobs.dao;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import javax.annotation.PostConstruct; 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.SearchBuilder;
import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Op; 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; import com.cloud.vm.VirtualMachine;
public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implements VmWorkJobDao { public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implements VmWorkJobDao {
protected SearchBuilder<VmWorkJobVO> PendingWorkJobSearch; protected SearchBuilder<VmWorkJobVO> PendingWorkJobSearch;
protected SearchBuilder<VmWorkJobVO> PendingWorkJobByCommandSearch; protected SearchBuilder<VmWorkJobVO> PendingWorkJobByCommandSearch;
protected SearchBuilder<VmWorkJobVO> ExpungeWorkJobSearch;
public VmWorkJobDaoImpl() { public VmWorkJobDaoImpl() {
} }
@ -48,7 +54,6 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
PendingWorkJobSearch.and("jobStatus", PendingWorkJobSearch.entity().getStatus(), Op.EQ); PendingWorkJobSearch.and("jobStatus", PendingWorkJobSearch.entity().getStatus(), Op.EQ);
PendingWorkJobSearch.and("vmType", PendingWorkJobSearch.entity().getVmType(), Op.EQ); PendingWorkJobSearch.and("vmType", PendingWorkJobSearch.entity().getVmType(), Op.EQ);
PendingWorkJobSearch.and("vmInstanceId", PendingWorkJobSearch.entity().getVmInstanceId(), Op.EQ); PendingWorkJobSearch.and("vmInstanceId", PendingWorkJobSearch.entity().getVmInstanceId(), Op.EQ);
PendingWorkJobSearch.and("step", PendingWorkJobSearch.entity().getStep(), Op.NEQ);
PendingWorkJobSearch.done(); PendingWorkJobSearch.done();
PendingWorkJobByCommandSearch = createSearchBuilder(); PendingWorkJobByCommandSearch = createSearchBuilder();
@ -58,11 +63,6 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
PendingWorkJobByCommandSearch.and("step", PendingWorkJobByCommandSearch.entity().getStep(), Op.NEQ); PendingWorkJobByCommandSearch.and("step", PendingWorkJobByCommandSearch.entity().getStep(), Op.NEQ);
PendingWorkJobByCommandSearch.and("cmd", PendingWorkJobByCommandSearch.entity().getCmd(), Op.EQ); PendingWorkJobByCommandSearch.and("cmd", PendingWorkJobByCommandSearch.entity().getCmd(), Op.EQ);
PendingWorkJobByCommandSearch.done(); PendingWorkJobByCommandSearch.done();
ExpungeWorkJobSearch = createSearchBuilder();
ExpungeWorkJobSearch.and("lastUpdated", ExpungeWorkJobSearch.entity().getLastUpdated(), Op.LT);
ExpungeWorkJobSearch.and("jobStatus", ExpungeWorkJobSearch.entity().getStatus(), Op.NEQ);
ExpungeWorkJobSearch.done();
} }
@Override @Override
@ -115,11 +115,80 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
} }
@Override @Override
public void expungeCompletedWorkJobs(Date cutDate) { public void expungeCompletedWorkJobs(final Date cutDate) {
SearchCriteria<VmWorkJobVO> sc = ExpungeWorkJobSearch.create(); // current DAO machenism does not support following usage
sc.setParameters("lastUpdated", cutDate); /*
sc.setParameters("jobStatus", JobInfo.Status.IN_PROGRESS); SearchCriteria<VmWorkJobVO> 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<VmWorkJobVO> 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) {
}
}
});
} }
} }

View File

@ -20,6 +20,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>cloud-framework-spring-module</artifactId> <artifactId>cloud-framework-spring-module</artifactId>
<name>Apache CloudStack Framework - Spring Module</name>
<parent> <parent>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId> <artifactId>cloud-maven-standard</artifactId>

View File

@ -111,6 +111,7 @@ The Apache CloudStack files shared between agent and management server
%package agent %package agent
Summary: CloudStack Agent for KVM hypervisors Summary: CloudStack Agent for KVM hypervisors
Requires: openssh-clients
Requires: java >= 1.6.0 Requires: java >= 1.6.0
Requires: %{name}-common = %{_ver} Requires: %{name}-common = %{_ver}
Requires: libvirt Requires: libvirt

View File

@ -1590,6 +1590,11 @@ namespace HypervResource
string templatePropFile = Path.Combine(path, "template.properties"); string templatePropFile = Path.Combine(path, "template.properties");
using (StreamWriter sw = new StreamWriter(File.Open(templatePropFile, FileMode.Create), Encoding.GetEncoding("iso-8859-1"))) 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.NewLine = "\n";
sw.WriteLine("id=" + templateId); sw.WriteLine("id=" + templateId);
sw.WriteLine("filename=" + templateUuid + "." + format); sw.WriteLine("filename=" + templateUuid + "." + format);
@ -1599,7 +1604,7 @@ namespace HypervResource
sw.WriteLine("virtualsize=" + virtualSize); sw.WriteLine("virtualsize=" + virtualSize);
sw.WriteLine(format + ".virtualsize=" + virtualSize); sw.WriteLine(format + ".virtualsize=" + virtualSize);
sw.WriteLine("size=" + physicalSize); sw.WriteLine("size=" + physicalSize);
sw.WriteLine("vhd.size=" + physicalSize); sw.WriteLine(format + ".size=" + physicalSize);
sw.WriteLine("public=false"); sw.WriteLine("public=false");
} }
} }

View File

@ -31,6 +31,8 @@ import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException; import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -41,6 +43,7 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException; 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.utils.ssh.SshHelper;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineName; import com.cloud.vm.VirtualMachineName;
/** /**
* Implementation of dummy resource to be returned from discoverer. * 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. // Only Answer instances are returned by remote agents.
// E.g. see Response.getAnswers() // E.g. see Response.getAnswers()
Answer[] result = s_gson.fromJson(ansStr, Answer[].class); 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) { if (result.length > 0) {
return result[0]; return result[0];
} }
@ -1679,7 +1682,10 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
// comment to use Apache HttpClient // comment to use Apache HttpClient
// http://stackoverflow.com/a/2793153/939250, but final comment is to // http://stackoverflow.com/a/2793153/939250, but final comment is to
// use Apache. // 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 // Create request
HttpClient httpClient = null; HttpClient httpClient = null;
@ -1719,7 +1725,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
StringEntity cmdJson = new StringEntity(jsonCmd); StringEntity cmdJson = new StringEntity(jsonCmd);
request.addHeader("content-type", "application/json"); request.addHeader("content-type", "application/json");
request.setEntity(cmdJson); 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); HttpResponse response = httpClient.execute(request);
// Unsupported commands will not route. // Unsupported commands will not route.
@ -1736,7 +1743,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
return null; return null;
} else { } else {
result = EntityUtils.toString(response.getEntity()); 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) { } catch (ClientProtocolException protocolEx) {
// Problem with HTTP message exchange // Problem with HTTP message exchange
@ -1862,4 +1870,22 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
return "Unable to connect"; 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<String> stringList = new ArrayList<String>();
Collections.addAll(stringList, temp);
cleanLogString = StringUtils.join(stringList, ",");
}
}
return cleanLogString;
}
} }

View File

@ -20,6 +20,7 @@
package com.cloud.hypervisor.kvm.resource; package com.cloud.hypervisor.kvm.resource;
import junit.framework.TestCase; import junit.framework.TestCase;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
public class LibvirtVMDefTest extends TestCase { 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 = "<disk device='disk' type='file'>\n<driver name='qemu' type='" + type.toString() + "' cache='" + cacheMode.toString() + "' />\n" +
"<source file='" + filePath + "'/>\n<target dev='" + diskLabel + "' bus='" + bus.toString() + "'/>\n</disk>\n";
assertEquals(xmlDef, expectedXml);
}
} }

View File

@ -27,13 +27,15 @@ import javax.persistence.Table;
import com.cloud.utils.NumbersUtil; 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 @Entity
@Table(name = "legacy_zones") @Table(name = "legacy_zones")
public class LegacyZoneVO implements LegacyZone { public class LegacyZoneVO implements LegacyZone {
private static final long serialVersionUID = -3979866054555152793L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
@ -60,7 +62,7 @@ public class LegacyZoneVO implements LegacyZone {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof LegacyZoneVO) { if (obj instanceof LegacyZoneVO) {
return ((LegacyZoneVO)obj).getId() == this.getId(); return ((LegacyZoneVO)obj).getId() == getId();
} else { } else {
return false; return false;
} }
@ -70,7 +72,7 @@ public class LegacyZoneVO implements LegacyZone {
} }
public LegacyZoneVO(long zoneId) { public LegacyZoneVO(long zoneId) {
this.id = zoneId; id = zoneId;
} }
public LegacyZoneVO(long id, long zoneId) { public LegacyZoneVO(long id, long zoneId) {

View File

@ -16,7 +16,6 @@
// under the License. // under the License.
package com.cloud.hypervisor.vmware; package com.cloud.hypervisor.vmware;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -98,16 +97,6 @@ public class VmwareCleanupMaid {
return _checkPoint; return _checkPoint;
} }
private synchronized static void addLeftOverVM(VmwareCleanupMaid cleanupMaid) {
List<VmwareCleanupMaid> l = s_leftoverDummyVMs.get(cleanupMaid.getVCenterServer());
if (l == null) {
l = new ArrayList<VmwareCleanupMaid>();
s_leftoverDummyVMs.put(cleanupMaid.getVCenterServer(), l);
}
l.add(cleanupMaid);
}
public synchronized static void gcLeftOverVMs(VmwareContext context) { public synchronized static void gcLeftOverVMs(VmwareContext context) {
List<VmwareCleanupMaid> l = s_leftoverDummyVMs.get(context.getServerAddress()); List<VmwareCleanupMaid> l = s_leftoverDummyVMs.get(context.getServerAddress());
VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);

View File

@ -37,6 +37,8 @@ import com.cloud.utils.db.Encrypt;
@Table(name = "vmware_data_center") @Table(name = "vmware_data_center")
public class VmwareDatacenterVO implements VmwareDatacenter { public class VmwareDatacenterVO implements VmwareDatacenter {
private static final long serialVersionUID = -9114941929893819232L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
@ -105,11 +107,11 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
} }
public void setVmwareDatacenterName(String name) { public void setVmwareDatacenterName(String name) {
this.vmwareDatacenterName = name; vmwareDatacenterName = name;
} }
public void setVcenterHost(String vCenterHost) { public void setVcenterHost(String vCenterHost) {
this.vcenterHost = vCenterHost; vcenterHost = vCenterHost;
} }
public void setUser(String user) { public void setUser(String user) {
@ -134,17 +136,17 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof VmwareDatacenterVO) { if (obj instanceof VmwareDatacenterVO) {
return ((VmwareDatacenterVO)obj).getId() == this.getId(); return ((VmwareDatacenterVO)obj).getId() == getId();
} else { } else {
return false; return false;
} }
} }
public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) { public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) {
this.uuid = UUID.randomUUID().toString(); uuid = UUID.randomUUID().toString();
this.vmwareDatacenterName = name; vmwareDatacenterName = name;
this.guid = guid; this.guid = guid;
this.vcenterHost = vCenterHost; vcenterHost = vCenterHost;
this.user = user; this.user = user;
this.password = password; this.password = password;
} }
@ -155,7 +157,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
} }
public VmwareDatacenterVO() { public VmwareDatacenterVO() {
this.uuid = UUID.randomUUID().toString(); uuid = UUID.randomUUID().toString();
} }
} }

View File

@ -32,6 +32,8 @@ import javax.persistence.Table;
@Table(name = "vmware_data_center_zone_map") @Table(name = "vmware_data_center_zone_map")
public class VmwareDatacenterZoneMapVO implements VmwareDatacenterZoneMap { public class VmwareDatacenterZoneMapVO implements VmwareDatacenterZoneMap {
private static final long serialVersionUID = -2155826205976479040L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")

View File

@ -126,7 +126,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
@Override @Override
public Map<? extends ServerResource, Map<String, String>> public Map<? extends ServerResource, Map<String, String>>
find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List<String> hostTags) throws DiscoveryException { find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List<String> hostTags) throws DiscoveryException {
if (s_logger.isInfoEnabled()) if (s_logger.isInfoEnabled())
s_logger.info("Discover host. dc: " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + url.getHost()); 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) { if (usernameNotProvided || passwordNotProvided) {
// Retrieve credentials associated with VMware DC // Retrieve credentials associated with VMware DC
s_logger.info("Username and/or Password not provided while adding cluster to cloudstack zone. " 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(); username = vmwareDc.getUser();
password = vmwareDc.getPassword(); password = vmwareDc.getPassword();
clusterDetails.put("username", username); 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 // Process traffic label information provided at zone level and cluster level
publicTrafficLabelObj = 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. // 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 (pNetworkListGuestTraffic.contains(pNetworkPublic)) {
if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) { if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) {
String msg = 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" + ". And virtual switch type chosen for each traffic is different" +
". A physical network cannot be shared by different types of virtual switches."; ". A physical network cannot be shared by different types of virtual switches.";
s_logger.error(msg); s_logger.error(msg);
@ -295,7 +295,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
} }
Pair<Boolean, Long> vsmInfo = new Pair<Boolean, Long>(false, 0L); Pair<Boolean, Long> vsmInfo = new Pair<Boolean, Long>(false, 0L);
if (nexusDVS && (guestTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) || 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 // Expect Cisco Nexus VSM details only if following 2 condition met
// 1) The global config parameter vmware.use.nexus.vswitch // 1) The global config parameter vmware.use.nexus.vswitch
// 2) Atleast 1 traffic type uses Nexus distributed virtual switch as backend. // 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); context.registerStockObject("vsmcredentials", vsmCredentials);
} }
} }
List<ManagedObjectReference> morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, URLDecoder.decode(url.getPath())); List<ManagedObjectReference> morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, URLDecoder.decode(url.getPath(), "UTF-8"));
if (morHosts == null) if (morHosts == null)
s_logger.info("Found 0 hosts."); s_logger.info("Found 0 hosts.");
if (privateTrafficLabel != null) if (privateTrafficLabel != null)
context.uregisterStockObject("privateTrafficLabel"); context.uregisterStockObject("privateTrafficLabel");
if (morHosts == null) { 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; return null;
} }
@ -350,7 +350,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
clusterDetails = _clusterDetailsDao.findDetails(clusterId); clusterDetails = _clusterDetailsDao.findDetails(clusterId);
if (clusterDetails.get("url") != null) { if (clusterDetails.get("url") != null) {
URI uriFromCluster = new URI(UriUtils.encodeURIComponent(clusterDetails.get("url"))); 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")) { if (morCluster == null || !morCluster.getType().equalsIgnoreCase("ClusterComputeResource")) {
s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails.get("url")); 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())) { if (!vCenterHost.equalsIgnoreCase(url.getHost())) {
msg = 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; ". Make sure the cluster being added belongs to vCenter " + vCenterHost + " and VMware DC " + vmwareDcNameFromDb;
s_logger.error(msg); s_logger.error(msg);
throw new DiscoveryException(msg); throw new DiscoveryException(msg);
} else if (!vmwareDcNameFromDb.equalsIgnoreCase(vmwareDcNameFromApi)) { } else if (!vmwareDcNameFromDb.equalsIgnoreCase(vmwareDcNameFromApi)) {
msg = 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; ". Make sure the cluster being added belongs to VMware DC " + vmwareDcNameFromDb + " in vCenter " + vCenterHost;
s_logger.error(msg); s_logger.error(msg);
throw new DiscoveryException(msg); throw new DiscoveryException(msg);
@ -567,8 +567,8 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
if (tmplt == null) { if (tmplt == null) {
id = _tmpltDao.getNextInSequence(Long.class, "id"); id = _tmpltDao.getNextInSequence(Long.class, "id");
VMTemplateVO template = VMTemplateVO template =
VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, 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); null, "VMware Tools Installer ISO", false, 1, false, HypervisorType.VMware);
_tmpltDao.persist(template); _tmpltDao.persist(template);
} else { } else {
id = tmplt.getId(); 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, private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWideTrafficLabel, VirtualSwitchType defaultVirtualSwitchType, String vSwitchType,
String vSwitchName, Long clusterId) { String vSwitchName, Long clusterId) {
VmwareTrafficLabel trafficLabelObj = null; VmwareTrafficLabel trafficLabelObj = null;
Map<String, String> clusterDetails = null; Map<String, String> clusterDetails = null;
try { try {
@ -664,7 +664,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
} }
private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWideTrafficLabel, Map<String, String> clusterDetails, private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWideTrafficLabel, Map<String, String> clusterDetails,
VirtualSwitchType defVirtualSwitchType) { VirtualSwitchType defVirtualSwitchType) {
VmwareTrafficLabel trafficLabelObj = null; VmwareTrafficLabel trafficLabelObj = null;
try { try {
trafficLabelObj = new VmwareTrafficLabel(zoneWideTrafficLabel, trafficType, defVirtualSwitchType); trafficLabelObj = new VmwareTrafficLabel(zoneWideTrafficLabel, trafficType, defVirtualSwitchType);

View File

@ -21,7 +21,6 @@ import java.util.List;
import com.vmware.vim25.ManagedObjectReference; import com.vmware.vim25.ManagedObjectReference;
import com.cloud.agent.api.Command; 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.mo.VmwareHypervisorHost;
import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.hypervisor.vmware.util.VmwareContext;
@ -34,11 +33,9 @@ public interface VmwareHostService {
String getWorkerName(VmwareContext context, Command cmd, int workerSequence); String getWorkerName(VmwareContext context, Command cmd, int workerSequence);
ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, String iqn, ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName,
String initiatorChapName, String initiatorChapSecret, String mutualChapName, String mutualChapSecret) throws Exception; String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret,
String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception;
void createVmdk(Command cmd, DatastoreMO dsMo, String volumeDatastorePath, Long volumeSize) throws Exception;
void handleDatastoreAndVmdkDetach(String iqn, String storageHost, int storagePort) throws Exception; void handleDatastoreAndVmdkDetach(String iqn, String storageHost, int storagePort) throws Exception;
void removeManagedTargetsFromCluster(List<String> managedIqns) throws Exception; void removeManagedTargetsFromCluster(List<String> managedIqns) throws Exception;

View File

@ -40,7 +40,6 @@ import org.apache.log4j.Logger;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.vmware.vim25.AboutInfo; import com.vmware.vim25.AboutInfo;
import com.vmware.vim25.HostConnectSpec;
import com.vmware.vim25.ManagedObjectReference; import com.vmware.vim25.ManagedObjectReference;
import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd; 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.HostFirewallSystemMO;
import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.HostMO;
import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper; 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.VirtualEthernetCardType;
import com.cloud.hypervisor.vmware.mo.VmwareHostType; import com.cloud.hypervisor.vmware.mo.VmwareHostType;
import com.cloud.hypervisor.vmware.resource.VmwareContextFactory; 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.VmwareContext;
import com.cloud.hypervisor.vmware.util.VmwareHelper; import com.cloud.hypervisor.vmware.util.VmwareHelper;
import com.cloud.network.CiscoNexusVSMDeviceVO; import com.cloud.network.CiscoNexusVSMDeviceVO;
@ -400,7 +397,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
@Override @Override
public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, String hostInventoryPath) public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, String hostInventoryPath)
throws Exception { throws Exception {
ManagedObjectReference mor = null; ManagedObjectReference mor = null;
if (serviceContext != null) { if (serviceContext != null) {
mor = serviceContext.getHostMorByPath(hostInventoryPath); mor = serviceContext.getHostMorByPath(hostInventoryPath);
@ -415,7 +412,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
List<ManagedObjectReference> returnedHostList = new ArrayList<ManagedObjectReference>(); List<ManagedObjectReference> returnedHostList = new ArrayList<ManagedObjectReference>();
if (mor.getType().equals("ComputeResource")) { if (mor.getType().equals("ComputeResource")) {
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)serviceContext.getVimClient().getDynamicProperty(mor, "host"); List<ManagedObjectReference> hosts = serviceContext.getVimClient().getDynamicProperty(mor, "host");
assert (hosts != null && hosts.size() > 0); assert (hosts != null && hosts.size() > 0);
// For ESX host, we need to enable host firewall to allow VNC access // 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)); returnedHostList.add(hosts.get(0));
return returnedHostList; return returnedHostList;
} else if (mor.getType().equals("ClusterComputeResource")) { } else if (mor.getType().equals("ClusterComputeResource")) {
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)serviceContext.getVimClient().getDynamicProperty(mor, "host"); List<ManagedObjectReference> hosts = serviceContext.getVimClient().getDynamicProperty(mor, "host");
assert (hosts != null); assert (hosts != null);
if (hosts.size() > 0) { if (hosts.size() > 0) {
@ -462,45 +459,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
return null; 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 @Override
public String getSecondaryStorageStoreUrl(long dcId) { public String getSecondaryStorageStoreUrl(long dcId) {
@ -579,7 +537,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
return false; return false;
} }
long startTick = Long.parseLong(tokens[0]); Long.parseLong(tokens[0]);
long msid = Long.parseLong(tokens[1]); long msid = Long.parseLong(tokens[1]);
long runid = Long.parseLong(tokens[2]); 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); s_logger.info("Worker VM expired, seconds elapsed: " + (System.currentTimeMillis() - startTick) / 1000);
return true; return true;
} }
*/ */
return false; return false;
} }
@ -631,7 +589,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
_configServer.updateKeyPairs(); _configServer.updateKeyPairs();
s_logger.info("Copy System VM patch ISO file to secondary storage. source ISO: " + srcIso.getAbsolutePath() + ", destination: " + s_logger.info("Copy System VM patch ISO file to secondary storage. source ISO: " + srcIso.getAbsolutePath() + ", destination: " +
destIso.getAbsolutePath()); destIso.getAbsolutePath());
try { try {
FileUtil.copyfile(srcIso, destIso); FileUtil.copyfile(srcIso, destIso);
} catch (IOException e) { } catch (IOException e) {
@ -1040,7 +998,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
if (vCenterHost == null) { if (vCenterHost == null) {
throw new InvalidParameterValueException("Missing or invalid parameter name. " 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) { if (zoneId == null) {
@ -1060,11 +1018,11 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
VmwareDatacenterVO associatedVmwareDc = _vmwareDcDao.findById(associatedVmwareDcId); VmwareDatacenterVO associatedVmwareDc = _vmwareDcDao.findById(associatedVmwareDcId);
if (associatedVmwareDc.getVcenterHost().equalsIgnoreCase(vCenterHost) && associatedVmwareDc.getVmwareDatacenterName().equalsIgnoreCase(vmwareDcName)) { if (associatedVmwareDc.getVcenterHost().equalsIgnoreCase(vCenterHost) && associatedVmwareDc.getVmwareDatacenterName().equalsIgnoreCase(vmwareDcName)) {
s_logger.info("Ignoring API call addVmwareDc, because VMware DC " + vCenterHost + "/" + 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; return associatedVmwareDc;
} else { } else {
throw new CloudRuntimeException("Zone " + zoneId + " is already associated with a VMware datacenter. " + 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. // 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 userName;
String password; String password;
DatacenterMO dcMo = null; DatacenterMO dcMo = null;
Transaction txn;
final VmwareDatacenterZoneMapVO vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId); final VmwareDatacenterZoneMapVO vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
// Check if zone is associated with VMware DC // Check if zone is associated with VMware DC
if (vmwareDcZoneMap == null) { if (vmwareDcZoneMap == null) {

View File

@ -198,9 +198,6 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
String installPath = volume.getPath(); String installPath = volume.getPath();
int index = installPath.lastIndexOf(File.separator); int index = installPath.lastIndexOf(File.separator);
String volumeUuid = installPath.substring(index + 1); String volumeUuid = installPath.substring(index + 1);
String details = null;
boolean success = false;
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl); String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl);
//The real volume path //The real volume path
String volumePath = installPath + File.separator + volumeUuid + ".ova"; String volumePath = installPath + File.separator + volumeUuid + ".ova";
@ -351,8 +348,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
} }
snapshotBackupUuid = snapshotBackupUuid =
backupSnapshotToSecondaryStorage(vmMo, accountId, volumeId, cmd.getVolumePath(), snapshotUuid, secondaryStorageUrl, prevSnapshotUuid, prevBackupUuid, backupSnapshotToSecondaryStorage(vmMo, accountId, volumeId, cmd.getVolumePath(), snapshotUuid, secondaryStorageUrl, prevSnapshotUuid, prevBackupUuid,
hostService.getWorkerName(context, cmd, 1)); hostService.getWorkerName(context, cmd, 1));
success = (snapshotBackupUuid != null); success = (snapshotBackupUuid != null);
if (success) { if (success) {
@ -407,7 +404,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
if (vmMo == null) { if (vmMo == null) {
if (s_logger.isDebugEnabled()) { if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to find the owner VM for CreatePrivateTemplateFromVolumeCommand on host " + hyperHost.getHyperHostName() + 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()); vmMo = hyperHost.findVmOnPeerHyperHost(cmd.getVmName());
@ -419,8 +416,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
} }
Ternary<String, Long, Long> result = Ternary<String, Long, Long> result =
createTemplateFromVolume(vmMo, accountId, templateId, cmd.getUniqueName(), secondaryStoragePoolURL, volumePath, createTemplateFromVolume(vmMo, accountId, templateId, cmd.getUniqueName(), secondaryStoragePoolURL, volumePath,
hostService.getWorkerName(context, cmd, 0)); hostService.getWorkerName(context, cmd, 0));
return new CreatePrivateTemplateAnswer(cmd, true, null, result.first(), result.third(), result.second(), cmd.getUniqueName(), ImageFormat.OVA); 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<String, String> result; Pair<String, String> result;
if (cmd.toSecondaryStorage()) { if (cmd.toSecondaryStorage()) {
result = result =
copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, volumeId, cmd.getPool().getUuid(), volumePath, secondaryStorageURL, copyVolumeToSecStorage(hostService, hyperHost, cmd, vmName, volumeId, cmd.getPool().getUuid(), volumePath, secondaryStorageURL,
hostService.getWorkerName(context, cmd, 0)); hostService.getWorkerName(context, cmd, 0));
} else { } else {
StorageFilerTO poolTO = cmd.getPool(); StorageFilerTO poolTO = cmd.getPool();
@ -549,10 +546,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
// templateName: name in secondary storage // templateName: name in secondary storage
// templateUuid: will be used at hypervisor layer // templateUuid: will be used at hypervisor layer
private void copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl, 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: " + s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " +
templatePathAtSecondaryStorage + ", templateName: " + templateName); templatePathAtSecondaryStorage + ", templateName: " + templateName);
String secondaryMountPoint = _mountService.getMountPoint(secondaryStorageUrl); String secondaryMountPoint = _mountService.getMountPoint(secondaryStorageUrl);
s_logger.info("Secondary storage mount point: " + secondaryMountPoint); s_logger.info("Secondary storage mount point: " + secondaryMountPoint);
@ -587,7 +584,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
if (vmMo == null) { if (vmMo == null) {
String msg = String msg =
"Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage + "Failed to import OVA template. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " + templatePathAtSecondaryStorage +
", templateName: " + templateName + ", templateUuid: " + templateUuid; ", templateName: " + templateName + ", templateUuid: " + templateUuid;
s_logger.error(msg); s_logger.error(msg);
throw new Exception(msg); throw new Exception(msg);
@ -605,7 +602,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
} }
private Ternary<String, Long, Long> createTemplateFromVolume(VirtualMachineMO vmMo, long accountId, long templateId, String templateUniqueName, String secStorageUrl, private Ternary<String, Long, Long> 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 secondaryMountPoint = _mountService.getMountPoint(secStorageUrl);
String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId); String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId);
@ -670,7 +667,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
} }
private Ternary<String, Long, Long> createTemplateFromSnapshot(long accountId, long templateId, String templateUniqueName, String secStorageUrl, long volumeId, private Ternary<String, Long, Long> 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 secondaryMountPoint = _mountService.getMountPoint(secStorageUrl);
String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId); 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, 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); restoreVolumeFromSecStorage(hyperHost, primaryDsMo, newVolumeName, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), snapshotBackupUuid);
return null; return null;
} }
private void restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String secStorageDir, 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 secondaryMountPoint = _mountService.getMountPoint(secStorageUrl);
String srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/" + backupName + "." + ImageFormat.OVA.getFileExtension(); 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, 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(); String backupUuid = UUID.randomUUID().toString();
exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), backupUuid, workerVmName); 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, 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 secondaryMountPoint = _mountService.getMountPoint(secStorageUrl);
String exportPath = secondaryMountPoint + "/" + secStorageDir + "/" + exportName; 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<String> filenames = new ArrayList<String>();
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<String, String> copyVolumeToSecStorage(VmwareHostService hostService, VmwareHypervisorHost hyperHost, CopyVolumeCommand cmd, String vmName, private Pair<String, String> 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) + "/"; String volumeFolder = String.valueOf(volumeId) + "/";
VirtualMachineMO workerVm = null; VirtualMachineMO workerVm = null;
@ -1043,7 +1008,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
vmMo.createSnapshot(exportName, "Temporary snapshot for copy-volume command", false, false); vmMo.createSnapshot(exportName, "Temporary snapshot for copy-volume command", false, false);
exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, "volumes/" + volumeFolder, exportName, exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, "volumes/" + volumeFolder, exportName,
hostService.getWorkerName(hyperHost.getContext(), cmd, 1)); hostService.getWorkerName(hyperHost.getContext(), cmd, 1));
return new Pair<String, String>(volumeFolder, exportName); return new Pair<String, String>(volumeFolder, exportName);
} finally { } finally {
@ -1066,7 +1031,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
} }
private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost hyperHost, long volumeId, DatastoreMO dsMo, String secStorageUrl, String exportName) private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost hyperHost, long volumeId, DatastoreMO dsMo, String secStorageUrl, String exportName)
throws Exception { throws Exception {
String volumeFolder = String.valueOf(volumeId) + "/"; String volumeFolder = String.valueOf(volumeId) + "/";
String newVolume = UUID.randomUUID().toString().replaceAll("-", ""); String newVolume = UUID.randomUUID().toString().replaceAll("-", "");
@ -1085,69 +1050,54 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
s_logger.info("getOVAfromMetaFile: " + metafileName); s_logger.info("getOVAfromMetaFile: " + metafileName);
try { try {
strm = new FileInputStream(ova_metafile); 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); s_logger.error(msg);
throw new Exception(msg); throw new Exception(msg);
} }
String[] disks = new String[diskNum];
s_logger.info("loading properties from ova meta file: " + metafileName); for (int i = 0; i < diskNum; i++) {
if (null != ova_metafile) { // String diskNameKey = "disk" + Integer.toString(i+1) + ".name"; // Fang use this
props = new Properties(); String diskNameKey = "disk1.name";
props.load(strm); disks[i] = props.getProperty(diskNameKey);
if (props == null) { s_logger.info("diskname " + disks[i]);
s_logger.info("getOVAfromMetaFile: props is null. ");
}
} }
if (null != props) { String exportDir = ova_metafile.getParent();
ovaFileName = props.getProperty("ova.filename"); s_logger.info("exportDir: " + exportDir);
s_logger.info("ovafilename: " + ovaFileName); // Important! we need to sync file system before we can safely use tar to work around a linux kernal bug(or feature)
String ovfFileName = props.getProperty("ovf"); s_logger.info("Sync file system before we package OVA..., before tar ");
s_logger.info("ovffilename: " + ovfFileName); s_logger.info("ova: " + ovaFileName + ", ovf:" + ovfFileName + ", vmdk:" + disks[0] + ".");
int diskNum = Integer.parseInt(props.getProperty("numDisks")); Script commandSync = new Script(true, "sync", 0, s_logger);
if (diskNum <= 0) { commandSync.execute();
String msg = "VMDK disk file number is 0. Error"; Script command = new Script(false, "tar", 0, s_logger);
s_logger.error(msg); command.setWorkDir(exportDir); // Fang: pass this in to the method?
throw new Exception(msg); command.add("-cf", ovaFileName);
} command.add(ovfFileName); // OVF file should be the first file in OVA archive
String[] disks = new String[diskNum]; for (String diskName : disks) {
for (int i = 0; i < diskNum; i++) { command.add(diskName);
// String diskNameKey = "disk" + Integer.toString(i+1) + ".name"; // Fang use this }
String diskNameKey = "disk1.name"; command.execute();
disks[i] = props.getProperty(diskNameKey); s_logger.info("Package OVA for template in dir: " + exportDir + "cmd: " + command.toString());
s_logger.info("diskname " + disks[i]); // to be safe, physically test existence of the target OVA file
} if ((new File(exportDir + ovaFileName)).exists()) {
String exportDir = ova_metafile.getParent(); s_logger.info("ova file is created and ready to extract ");
s_logger.info("exportDir: " + exportDir); return (ovaFileName);
// 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);
}
} else { } 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); s_logger.error(msg);
throw new Exception(msg); throw new Exception(msg);
} }
} catch (Exception e) { } catch (Exception e) {
s_logger.error("Exception in getOVAFromMetafile", e);
return null; return null;
// Do something, re-throw the exception // Do something, re-throw the exception
} finally { } finally {
@ -1252,7 +1202,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
// wait if there are already VM snapshot task running // wait if there are already VM snapshot task running
ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); List<ManagedObjectReference> tasks = context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
for (ManagedObjectReference taskMor : tasks) { for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info")); 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 // wait if there are already VM revert task running
ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask"); List<ManagedObjectReference> tasks = context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
for (ManagedObjectReference taskMor : tasks) { for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info")); TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));

View File

@ -40,6 +40,8 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice {
// We need to know what properties a VSM has. Put them here. // We need to know what properties a VSM has. Put them here.
private static final long serialVersionUID = 3091674059522739481L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
@ -167,11 +169,11 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice {
// Setter methods // Setter methods
public void setHostId(long hostid) { public void setHostId(long hostid) {
this.hostId = hostid; hostId = hostid;
} }
public void setVsmUserName(String username) { public void setVsmUserName(String username) {
this.vsmUserName = username; vsmUserName = username;
} }
public void setVsmName(String vsmName) { public void setVsmName(String vsmName) {
@ -179,7 +181,7 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice {
} }
public void setVsmPassword(String password) { public void setVsmPassword(String password) {
this.vsmPassword = password; vsmPassword = password;
} }
public void setMgmtIpAddr(String ipaddr) { public void setMgmtIpAddr(String ipaddr) {
@ -187,50 +189,50 @@ public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice {
} }
public void setManagementVlan(int vlan) { public void setManagementVlan(int vlan) {
this.managementVlan = vlan; managementVlan = vlan;
} }
public void setControlVlan(int vlan) { public void setControlVlan(int vlan) {
this.controlVlan = vlan; controlVlan = vlan;
} }
public void setPacketVlan(int vlan) { public void setPacketVlan(int vlan) {
this.packetVlan = vlan; packetVlan = vlan;
} }
public void setStorageVlan(int vlan) { public void setStorageVlan(int vlan) {
this.storageVlan = vlan; storageVlan = vlan;
} }
public void setVsmDomainId(long id) { public void setVsmDomainId(long id) {
this.vsmDomainId = id; vsmDomainId = id;
} }
public void setVsmConfigMode(VSMConfigMode mode) { public void setVsmConfigMode(VSMConfigMode mode) {
this.vsmConfigMode = mode; vsmConfigMode = mode;
} }
public void setVsmConfigState(VSMConfigState state) { public void setVsmConfigState(VSMConfigState state) {
this.vsmConfigState = state; vsmConfigState = state;
} }
public void setVsmDeviceState(VSMDeviceState devState) { public void setVsmDeviceState(VSMDeviceState devState) {
this.vsmDeviceState = devState; vsmDeviceState = devState;
} }
// Constructors. // Constructors.
public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String password) { public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String password) {
// Set all the VSM's properties here. // Set all the VSM's properties here.
this.uuid = UUID.randomUUID().toString(); uuid = UUID.randomUUID().toString();
this.setMgmtIpAddr(vsmIpAddr); setMgmtIpAddr(vsmIpAddr);
this.setVsmUserName(username); setVsmUserName(username);
this.setVsmPassword(password); setVsmPassword(password);
this.setVsmName(vsmName); setVsmName(vsmName);
this.setVsmDeviceState(VSMDeviceState.Enabled); setVsmDeviceState(VSMDeviceState.Enabled);
} }
public CiscoNexusVSMDeviceVO() { public CiscoNexusVSMDeviceVO() {
this.uuid = UUID.randomUUID().toString(); uuid = UUID.randomUUID().toString();
} }
} }

View File

@ -269,8 +269,6 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
throw new CloudRuntimeException(msg); throw new CloudRuntimeException(msg);
} }
Transaction txn;
// If VSM already exists and is mapped to a cluster, fail this operation. // If VSM already exists and is mapped to a cluster, fail this operation.
vsm = _vsmDao.getVSMbyIpaddress(vsmIp); vsm = _vsmDao.getVSMbyIpaddress(vsmIp);
if (vsm != null) { if (vsm != null) {

View File

@ -42,13 +42,11 @@ import com.cloud.hypervisor.vmware.manager.VmwareStorageManager;
import com.cloud.hypervisor.vmware.manager.VmwareStorageManagerImpl; import com.cloud.hypervisor.vmware.manager.VmwareStorageManagerImpl;
import com.cloud.hypervisor.vmware.manager.VmwareStorageMount; import com.cloud.hypervisor.vmware.manager.VmwareStorageMount;
import com.cloud.hypervisor.vmware.mo.ClusterMO; 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.HostMO;
import com.cloud.hypervisor.vmware.mo.VmwareHostType; import com.cloud.hypervisor.vmware.mo.VmwareHostType;
import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost;
import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary;
import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.hypervisor.vmware.util.VmwareContext;
import com.cloud.hypervisor.vmware.util.VmwareHelper;
import com.cloud.serializer.GsonHelper; import com.cloud.serializer.GsonHelper;
import com.cloud.utils.NumbersUtil; import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
@ -126,7 +124,7 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
} }
protected Answer execute(CreateEntityDownloadURLCommand cmd) { protected Answer execute(CreateEntityDownloadURLCommand cmd) {
boolean result = _storageMgr.execute(this, cmd); _storageMgr.execute(this, cmd);
return _resource.defaultAction(cmd); return _resource.defaultAction(cmd);
} }
@ -316,54 +314,10 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
return _resource.getRootDir(storageUrl); 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 @Override
public ManagedObjectReference getVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress, int storagePortNumber, String iqn, public ManagedObjectReference prepareManagedStorage(VmwareHypervisorHost hyperHost, String iScsiName,
String initiatorChapName, String initiatorChapSecret, String mutualChapName, String mutualChapSecret) throws Exception { String storageHost, int storagePort, String chapInitiatorUsername, String chapInitiatorSecret,
throw new OperationNotSupportedException(); String chapTargetUsername, String chapTargetSecret, long size, Command cmd) throws Exception {
}
@Override
public void createVmdk(Command cmd, DatastoreMO dsMo, String volumeDatastorePath, Long volumeSize) throws Exception {
throw new OperationNotSupportedException(); throw new OperationNotSupportedException();
} }

View File

@ -1155,22 +1155,13 @@ public class VmwareStorageProcessor implements StorageProcessor {
if (isAttach && isManaged) { if (isAttach && isManaged) {
Map<String, String> details = disk.getDetails(); Map<String, String> details = disk.getDetails();
morDs = morDs = hostService.prepareManagedStorage(hyperHost, iScsiName, storageHost, storagePort,
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_INITIATOR_USERNAME), details.get(DiskTO.CHAP_INITIATOR_SECRET), details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_USERNAME), details.get(DiskTO.CHAP_TARGET_SECRET),
details.get(DiskTO.CHAP_TARGET_SECRET)); volumeTO.getSize(), cmd);
}
DatastoreMO dsMo = new DatastoreMO(hostService.getServiceContext(null), morDs); else {
morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid());
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());
} }
if (morDs == null) { if (morDs == null) {

View File

@ -86,7 +86,7 @@ public class VmwareResourceTest {
doReturn(false).when(vmSpec).getLimitCpuUse(); doReturn(false).when(vmSpec).getLimitCpuUse();
when(vmMo.configureVm(vmConfigSpec)).thenReturn(true); when(vmMo.configureVm(vmConfigSpec)).thenReturn(true);
ScaleVmAnswer answer = _resource.execute(cmd); _resource.execute(cmd);
verify(_resource).execute(cmd); verify(_resource).execute(cmd);
} }

View File

@ -142,7 +142,7 @@ public class VmwareStorageMotionStrategyTest {
when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); 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 @Test
@ -166,7 +166,7 @@ public class VmwareStorageMotionStrategyTest {
when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); 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 @Test
@ -190,7 +190,7 @@ public class VmwareStorageMotionStrategyTest {
when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); 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 @Test
@ -214,25 +214,20 @@ public class VmwareStorageMotionStrategyTest {
when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock); when(agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
strategy.copyAsync(volumeMap, to, srcHost, destHost, caller); 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<T> extends AsyncRpcContext<T> { private class MockContext<T> extends AsyncRpcContext<T> {
final Map<VolumeInfo, DataStore> volumeToPool;
final AsyncCallFuture<CommandResult> future;
/** /**
* @param callback * @param callback
*/ */
public MockContext(AsyncCompletionCallback<T> callback, AsyncCallFuture<CommandResult> future, Map<VolumeInfo, DataStore> volumeToPool) { public MockContext(AsyncCompletionCallback<T> callback, AsyncCallFuture<CommandResult> future, Map<VolumeInfo, DataStore> volumeToPool) {
super(callback); super(callback);
this.volumeToPool = volumeToPool;
this.future = future;
} }
} }
protected Void mockCallBack(AsyncCallbackDispatcher<VmwareStorageMotionStrategyTest, CopyCommandResult> callback, MockContext<CommandResult> context) { protected Void mockCallBack(AsyncCallbackDispatcher<VmwareStorageMotionStrategyTest, CopyCommandResult> callback, MockContext<CommandResult> context) {
this.result = callback.getResult(); result = callback.getResult();
return null; return null;
} }

View File

@ -108,7 +108,11 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
if (volume.getVolumeType() == Volume.Type.DATADISK) { if (volume.getVolumeType() == Volume.Type.DATADISK) {
StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); 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(); DataTO volTO = _volFactory.getVolume(volume.getId()).getTO();
DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType()); DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType());

View File

@ -195,8 +195,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
String hostIp = ia.getHostAddress(); String hostIp = ia.getHostAddress();
Queue<String> pass = new LinkedList<String>(); Queue<String> pass = new LinkedList<String>();
pass.add(password); pass.add(password);
String masterIp = _connPool.getMasterIp(hostIp, username, pass); conn = _connPool.getConnect(hostIp, username, pass);
conn = _connPool.masterConnect(masterIp, username, pass);
if (conn == null) { if (conn == null) {
String msg = "Unable to get a connection to " + url; String msg = "Unable to get a connection to " + url;
s_logger.debug(msg); s_logger.debug(msg);
@ -398,7 +397,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
password = host.getDetail("password"); password = host.getDetail("password");
pass.add(password); pass.add(password);
String address = host.getPrivateIpAddress(); String address = host.getPrivateIpAddress();
Connection hostConn = _connPool.slaveConnect(address, username, pass); Connection hostConn = _connPool.getConnect(address, username, pass);
if (hostConn == null) { if (hostConn == null) {
continue; continue;
} }
@ -411,9 +410,9 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
} catch (Exception e) { } catch (Exception e) {
s_logger.warn("Can not get master ip address from host " + address); s_logger.warn("Can not get master ip address from host " + address);
} finally { } finally {
try { try{
Session.localLogout(hostConn); Session.logout(hostConn);
} catch (Exception e) { } catch (Exception e ) {
} }
hostConn.dispose(); hostConn.dispose();
hostConn = null; hostConn = null;

View File

@ -16,46 +16,6 @@
// under the License. // under the License.
package com.cloud.hypervisor.xen.resource; 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.IAgentControl;
import com.cloud.agent.api.Answer; import com.cloud.agent.api.Answer;
import com.cloud.agent.api.AttachIsoCommand; import com.cloud.agent.api.AttachIsoCommand;
@ -274,6 +234,44 @@ import com.xensource.xenapi.VLAN;
import com.xensource.xenapi.VM; import com.xensource.xenapi.VM;
import com.xensource.xenapi.VMGuestMetrics; import com.xensource.xenapi.VMGuestMetrics;
import com.xensource.xenapi.XenAPIObject; 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() { protected boolean pingXenServer() {
Session slaveSession = null; Connection conn = getConnection();
Connection slaveConn = null;
try { try {
URL slaveUrl = null; callHostPlugin(conn, "echo", "main");
slaveUrl = ConnPool.getURL(_host.ip);
slaveConn = new Connection(slaveUrl, 10);
slaveSession = ConnPool.slaveLocalLoginWithPassword(slaveConn, _username, _password);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
} finally { s_logger.debug("cannot ping host " + _host.ip + " due to " + e.toString(), e);
if (slaveSession != null) {
try {
Session.localLogout(slaveConn);
} catch (Exception e) {
}
slaveConn.dispose();
}
} }
return false; 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) { private Answer execute(PerformanceMonitorCommand cmd) {
Connection conn = getConnection(); Connection conn = getConnection();
String perfMon = getPerfMon(conn, cmd.getParams(), cmd.getWait()); 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(); Volume.Type type = volume.getType();
VDI vdi = mount(conn, vmName, volume); if (vdi == null) {
vdi = mount(conn, vmName, volume);
}
if (vdi != null) { if (vdi != null) {
if ("detached".equals(vdi.getNameLabel(conn))) { if ("detached".equals(vdi.getNameLabel(conn))) {
@ -1754,7 +1749,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vm = createVmFromTemplate(conn, vmSpec, host); vm = createVmFromTemplate(conn, vmSpec, host);
for (DiskTO disk : vmSpec.getDisks()) { 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) { 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<String, String> 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<SR> 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<String, String> 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) { protected Answer execute(ModifySshKeysCommand cmd) {
return new Answer(cmd); return new Answer(cmd);
} }
@ -1910,12 +1960,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) { private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) {
Connection conn = getConnection(); String args = "";
String args = "checkbatchs2svpn.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
for (String ip : cmd.getVpnIps()) { 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()) { if (result == null || result.isEmpty()) {
return new CheckS2SVpnConnectionsAnswer(cmd, false, "CheckS2SVpnConneciontsCommand failed"); return new CheckS2SVpnConnectionsAnswer(cmd, false, "CheckS2SVpnConneciontsCommand failed");
} }
@ -1923,9 +1972,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
private CheckRouterAnswer execute(CheckRouterCommand cmd) { private CheckRouterAnswer execute(CheckRouterCommand cmd) {
Connection conn = getConnection(); String result = routerProxy("checkrouter.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null);
String args = "checkrouter.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
if (result == null || result.isEmpty()) { if (result == null || result.isEmpty()) {
return new CheckRouterAnswer(cmd, "CheckRouterCommand failed"); return new CheckRouterAnswer(cmd, "CheckRouterCommand failed");
} }
@ -1933,9 +1980,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
private GetDomRVersionAnswer execute(GetDomRVersionCmd cmd) { private GetDomRVersionAnswer execute(GetDomRVersionCmd cmd) {
Connection conn = getConnection(); String result = routerProxy("get_template_version.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null);
String args = "get_template_version.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
if (result == null || result.isEmpty()) { if (result == null || result.isEmpty()) {
return new GetDomRVersionAnswer(cmd, "getDomRVersionCmd failed"); return new GetDomRVersionAnswer(cmd, "getDomRVersionCmd failed");
} }
@ -1948,8 +1993,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
private Answer execute(BumpUpPriorityCommand cmd) { private Answer execute(BumpUpPriorityCommand cmd) {
Connection conn = getConnection(); Connection conn = getConnection();
String args = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String args = "bumpup_priority.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String result = callHostPlugin(conn, "vmops", "bumpUpPriority", "args", args); String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
if (result == null || result.isEmpty()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "BumpUpPriorityCommand failed"); return new Answer(cmd, false, "BumpUpPriorityCommand failed");
} }
@ -1991,7 +2036,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
boolean endResult = true; boolean endResult = true;
for (PortForwardingRuleTO rule : cmd.getRules()) { for (PortForwardingRuleTO rule : cmd.getRules()) {
StringBuilder args = new StringBuilder(); StringBuilder args = new StringBuilder();
args.append(routerIp);
args.append(rule.revoked() ? " -D " : " -A "); args.append(rule.revoked() ? " -D " : " -A ");
args.append(" -P ").append(rule.getProtocol().toLowerCase()); args.append(" -P ").append(rule.getProtocol().toLowerCase());
args.append(" -l ").append(rule.getSrcIp()); 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(" -r ").append(rule.getDstIp());
args.append(" -d ").append(rule.getStringDstPortRange()); 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()) { if (result == null || result.isEmpty()) {
results[i++] = "Failed"; results[i++] = "Failed";
@ -2013,18 +2057,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
protected SetStaticNatRulesAnswer SetVPCStaticNatRules(SetStaticNatRulesCommand cmd) { protected SetStaticNatRulesAnswer SetVPCStaticNatRules(SetStaticNatRulesCommand cmd) {
Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
//String args = routerIp; //String args = routerIp;
String[] results = new String[cmd.getRules().length]; String[] results = new String[cmd.getRules().length];
int i = 0; int i = 0;
boolean endResult = true; boolean endResult = true;
for (StaticNatRuleTO rule : cmd.getRules()) { for (StaticNatRuleTO rule : cmd.getRules()) {
String args = "vpc_staticnat.sh " + routerIp; String args = rule.revoked() ? "-D" : "-A";
args += rule.revoked() ? " -D" : " -A";
args += " -l " + rule.getSrcIp(); args += " -l " + rule.getSrcIp();
args += " -r " + rule.getDstIp(); 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()) { if (result == null || result.isEmpty()) {
results[i++] = "Failed"; results[i++] = "Failed";
@ -2043,14 +2084,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Connection conn = getConnection(); Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
//String args = routerIp;
String[] results = new String[cmd.getRules().length]; String[] results = new String[cmd.getRules().length];
int i = 0; int i = 0;
boolean endResult = true; boolean endResult = true;
for (StaticNatRuleTO rule : cmd.getRules()) { for (StaticNatRuleTO rule : cmd.getRules()) {
//1:1 NAT needs instanceip;publicip;domrip;op //1:1 NAT needs instanceip;publicip;domrip;op
StringBuilder args = new StringBuilder(); StringBuilder args = new StringBuilder();
args.append(routerIp);
args.append(rule.revoked() ? " -D " : " -A "); args.append(rule.revoked() ? " -D " : " -A ");
args.append(" -l ").append(rule.getSrcIp()); args.append(" -l ").append(rule.getSrcIp());
args.append(" -r ").append(rule.getDstIp()); 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(" -d ").append(rule.getStringSrcPortRange());
args.append(" -G "); 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()) { if (result == null || result.isEmpty()) {
results[i++] = "Failed"; results[i++] = "Failed";
@ -2075,8 +2114,66 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return new SetStaticNatRulesAnswer(cmd, results, endResult); 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<IpAliasTO> 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<IpAliasTO> 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<IpAliasTO> 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<DhcpTO> 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(); 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); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (routerIp == null) { if (routerIp == null) {
@ -2091,7 +2188,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
tmpCfgFileContents += "\n"; tmpCfgFileContents += "\n";
} }
String tmpCfgFilePath = "/etc/haproxy/haproxy.cfg.new"; 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "LoadBalancerConfigCommand failed to create HA proxy cfg file."); 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[] removeRules = rules[LoadBalancerConfigurator.REMOVE];
String[] statRules = rules[LoadBalancerConfigurator.STATS]; String[] statRules = rules[LoadBalancerConfigurator.STATS];
String args = "vpc_loadbalancer.sh " + routerIp;
String ip = cmd.getNic().getIp(); String ip = cmd.getNic().getIp();
args += " -i " + ip; String args = " -i " + ip;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (addRules.length > 0) { if (addRules.length > 0) {
for (int i = 0; i < addRules.length; i++) { for (int i = 0; i < addRules.length; i++) {
@ -2133,7 +2229,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -s " + sb.toString(); 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "LoadBalancerConfigCommand failed"); return new Answer(cmd, false, "LoadBalancerConfigCommand failed");
@ -2141,154 +2243,23 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return new Answer(cmd); return new Answer(cmd);
} }
protected Answer execute(final CreateIpAliasCommand cmd) {
Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
List<IpAliasTO> 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<IpAliasTO> 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<IpAliasTO> 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<DhcpTO> 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) { protected synchronized Answer execute(final DhcpEntryCommand cmd) {
Connection conn = getConnection(); String args = " -m " + cmd.getVmMac();
String args = "-r " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (cmd.getVmIpAddress() != null) { if (cmd.getVmIpAddress() != null) {
args += " -v " + cmd.getVmIpAddress(); args += " -4 " + cmd.getVmIpAddress();
} }
args += " -m " + cmd.getVmMac(); args += " -h " + cmd.getVmName();
args += " -n " + cmd.getVmName();
if (cmd.getDefaultRouter() != null) { if (cmd.getDefaultRouter() != null) {
args += " -d " + cmd.getDefaultRouter(); args += " -d " + cmd.getDefaultRouter();
} }
if (cmd.getStaticRoutes() != null) {
args += " -s " + cmd.getStaticRoutes();
}
if (cmd.getDefaultDns() != null) { if (cmd.getDefaultDns() != null) {
args += " -N " + cmd.getDefaultDns(); args += " -n " + cmd.getDefaultDns();
}
if (cmd.getStaticRoutes() != null) {
args += " -s " + cmd.getStaticRoutes();
} }
if (cmd.getVmIp6Address() != null) { if (cmd.getVmIp6Address() != null) {
@ -2297,10 +2268,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
if (!cmd.isDefault()) { 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "DhcpEntry failed"); 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) { protected synchronized Answer execute(final RemoteAccessVpnCfgCommand cmd) {
Connection conn = getConnection(); String args = "";
String args = "vpn_l2tp.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (cmd.isCreate()) { if (cmd.isCreate()) {
args += " -r " + cmd.getIpRange(); args += " -r " + cmd.getIpRange();
args += " -p " + cmd.getPresharedKey(); args += " -p " + cmd.getPresharedKey();
@ -2322,7 +2292,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
args += " -C " + cmd.getLocalCidr(); args += " -C " + cmd.getLocalCidr();
args += " -i " + cmd.getPublicInterface(); 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "Configure VPN failed"); 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) { protected synchronized Answer execute(final VpnUsersCfgCommand cmd) {
Connection conn = getConnection(); for (VpnUsersCfgCommand.UsernamePassword userpwd: cmd.getUserpwds()) {
for (VpnUsersCfgCommand.UsernamePassword userpwd : cmd.getUserpwds()) { String args = "";
String args = "vpn_l2tp.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (!userpwd.isAdd()) { if (!userpwd.isAdd()) {
args += " -U " + userpwd.getUsername(); args += " -U " + userpwd.getUsername();
} else { } else {
args += " -u " + userpwd.getUsernamePassword(); 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "Configure VPN user failed for user " + userpwd.getUsername()); 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) { protected Answer execute(final VmDataCommand cmd) {
Connection conn = getConnection();
String routerPrivateIpAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
Map<String, List<String[]>> data = new HashMap<String, List<String[]>>(); Map<String, List<String[]>> data = new HashMap<String, List<String[]>>();
data.put(cmd.getVmIpAddress(), cmd.getVmData()); data.put(cmd.getVmIpAddress(), cmd.getVmData());
String json = new Gson().toJson(data); String json = new Gson().toJson(data);
json = Base64.encodeBase64String(json.getBytes()); 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "vm_data failed"); 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) { protected Answer execute(final SavePasswordCommand cmd) {
Connection conn = getConnection();
final String password = cmd.getPassword(); final String password = cmd.getPassword();
final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
final String vmIpAddress = cmd.getVmIpAddress(); final String vmIpAddress = cmd.getVmIpAddress();
String args = "savepassword.sh " + routerPrivateIPAddress; String args = " -v " + vmIpAddress;
args += " -v " + vmIpAddress;
args += " -p " + password; 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "savePassword failed"); 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."); throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with.");
} }
String args = "ipassoc.sh " + privateIpAddress; String args = "";
if (add) { if (add) {
args += " -A "; args += " -A ";
@ -2471,7 +2435,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -n"; args += " -n";
} }
String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); String result = routerProxy("ipassoc.sh", privateIpAddress, args);
if (result == null || result.isEmpty()) { if (result == null || result.isEmpty()) {
throw new InternalErrorException("Xen plugin \"ipassoc\" failed."); 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 args = "";
String snatArgs = "vpc_privateGateway.sh " + routerIp; String snatArgs = "";
if (ip.isAdd()) { if (ip.isAdd()) {
args += " -A "; args += " -A ";
@ -2542,7 +2507,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -n "; args += " -n ";
args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); 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()) { if (result == null || result.isEmpty()) {
throw new InternalErrorException("Xen plugin \"vpc_ipassoc\" failed."); throw new InternalErrorException("Xen plugin \"vpc_ipassoc\" failed.");
} }
@ -2551,7 +2516,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
snatArgs += " -l " + ip.getPublicIp(); snatArgs += " -l " + ip.getPublicIp();
snatArgs += " -c " + "eth" + correctVif.getDevice(conn); 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()) { if (result == null || result.isEmpty()) {
throw new InternalErrorException("Xen plugin \"vpc_privateGateway\" failed."); throw new InternalErrorException("Xen plugin \"vpc_privateGateway\" failed.");
} }
@ -6044,9 +6009,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
private void CheckXenHostInfo() throws ConfigurationException { private void CheckXenHostInfo() throws ConfigurationException {
Connection conn = ConnPool.slaveConnect(_host.ip, _username, _password); Connection conn = ConnPool.getConnect(_host.ip, _username, _password);
if (conn == null) { if( conn == null ) {
throw new ConfigurationException("Can not create slave connection to " + _host.ip); throw new ConfigurationException("Can not create connection to " + _host.ip);
} }
try { try {
Host.Record hostRec = null; Host.Record hostRec = null;
@ -6066,7 +6031,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
} finally { } finally {
try { try {
Session.localLogout(conn); Session.logout(conn);
} catch (Exception e) { } catch (Exception e) {
} }
} }
@ -7335,35 +7300,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Host.Record hostr = poolr.master.getRecord(conn); Host.Record hostr = poolr.master.getRecord(conn);
if (_host.uuid.equals(hostr.uuid)) { if (_host.uuid.equals(hostr.uuid)) {
boolean mastermigrated = false;
Map<Host, Host.Record> hostMap = Host.getAllRecords(conn); Map<Host, Host.Record> hostMap = Host.getAllRecords(conn);
if (hostMap.size() != 1) { if (hostMap.size() > 1) {
Host newMaster = null; String msg = "This host is XS master, please designate a new XS master throught XenCenter before you delete this host from CS";
Host.Record newMasterRecord = null;
for (Map.Entry<Host, Host.Record> 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";
s_logger.debug(msg); s_logger.debug(msg);
return new Answer(cmd, false, msg); return new Answer(cmd, false, msg);
} }
} }
@ -7534,17 +7475,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String config = cmd.getConfiguration(); String config = cmd.getConfiguration();
Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (routerIp == null) { if (routerIp == null) {
return new Answer(cmd); return new Answer(cmd);
} }
String args = "monitor_service.sh " + routerIp; String args = " -c " + config;
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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "SetMonitorServiceCommand failed to create cfg file."); 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[][] rules = cmd.generateFwRules();
String args = ""; String args = " -F";
args += routerIp + " -F";
if (trafficType == FirewallRule.TrafficType.Egress) { if (trafficType == FirewallRule.TrafficType.Egress) {
args += " -E"; args += " -E";
if (egressDefault.equals("true")) { if (egressDefault.equals("true")) {
@ -7587,7 +7524,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -a " + sb.toString(); 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()) { 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 //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); 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); String dev = "eth" + domrVif.getDevice(conn);
args += " -d " + dev; args += " -d " + dev;
args += " -i " + domrGIP; args += " -i " + domrGIP;
@ -7892,7 +7833,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (domainName != null && !domainName.isEmpty()) { if (domainName != null && !domainName.isEmpty()) {
args += " -e " + domainName; 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()) { if (result == null || result.isEmpty()) {
return new SetupGuestNetworkAnswer(cmd, false, "creating guest network failed due to " + ((result == null) ? "null" : result)); 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) { protected Answer execute(Site2SiteVpnCfgCommand cmd) {
Connection conn = getConnection(); String args = "";
String args = "ipsectunnel.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
if (cmd.isCreate()) { if (cmd.isCreate()) {
args += " -A"; args += " -A";
args += " -l "; args += " -l ";
@ -7968,7 +7908,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -N "; args += " -N ";
args += cmd.getPeerGuestCidrList(); 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()) { if (result == null || result.isEmpty()) {
return new Answer(cmd, false, "Configure site to site VPN failed! "); 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) { protected SetSourceNatAnswer execute(SetSourceNatCommand cmd) {
Connection conn = getConnection(); Connection conn = getConnection();
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
IpAddressTO pubIp = cmd.getIpAddress(); IpAddressTO pubIp = cmd.getIpAddress();
try { try {
VM router = getVM(conn, routerName); VM router = getVM(conn, routerName);
VIF correctVif = getCorrectVif(conn, router, pubIp); VIF correctVif = getCorrectVif(conn, router, pubIp);
String args = "vpc_snat.sh " + routerIp; String args = "";
args += " -A "; args += " -A ";
args += " -l "; args += " -l ";
@ -7994,7 +7933,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -c "; args += " -c ";
args += "eth" + correctVif.getDevice(conn); 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()) { if (result == null || result.isEmpty()) {
throw new InternalErrorException("Xen plugin \"vpc_snat\" failed."); throw new InternalErrorException("Xen plugin \"vpc_snat\" failed.");
} }
@ -8011,7 +7950,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String callResult; String callResult;
Connection conn = getConnection(); Connection conn = getConnection();
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String privateGw = cmd.getAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY); String privateGw = cmd.getAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY);
try { try {
@ -8032,11 +7970,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (privateGw != null) { if (privateGw != null) {
s_logger.debug("Private gateway configuration is set"); s_logger.debug("Private gateway configuration is set");
String args = "vpc_privategw_acl.sh " + routerIp; String args = "";
args += " -d " + "eth" + vif.getDevice(conn); args += " -d " + "eth" + vif.getDevice(conn);
args += " -a " + sb.toString(); 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()) { 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 //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++) { 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); return new SetNetworkACLAnswer(cmd, false, results);
} }
} else { } else {
String args = "vpc_acl.sh " + routerIp; String args = "";
args += " -d " + "eth" + vif.getDevice(conn); args += " -d " + "eth" + vif.getDevice(conn);
args += " -i " + nic.getIp(); args += " -i " + nic.getIp();
args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask())); args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
args += " -a " + sb.toString(); 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()) { 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 //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++) { for (int i = 0; i < results.length; i++) {
@ -8069,15 +8007,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} }
protected SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cmd) { protected SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cmd) {
Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String[] results = new String[cmd.getRules().length]; String[] results = new String[cmd.getRules().length];
int i = 0; int i = 0;
boolean endResult = true; boolean endResult = true;
for (PortForwardingRuleTO rule : cmd.getRules()) { for (PortForwardingRuleTO rule : cmd.getRules()) {
String args = "vpc_portforwarding.sh " + routerIp; String args = "";
args += rule.revoked() ? " -D" : " -A"; args += rule.revoked() ? " -D" : " -A";
args += " -P " + rule.getProtocol().toLowerCase(); args += " -P " + rule.getProtocol().toLowerCase();
args += " -l " + rule.getSrcIp(); args += " -l " + rule.getSrcIp();
@ -8085,7 +8020,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
args += " -r " + rule.getDstIp(); args += " -r " + rule.getDstIp();
args += " -d " + rule.getStringDstPortRange().replace(":", "-"); 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()) { if (result == null || result.isEmpty()) {
results[i++] = "Failed"; results[i++] = "Failed";
@ -8099,8 +8034,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) { private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) {
String callResult; String callResult;
Connection conn = getConnection();
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
try { try {
String[] results = new String[cmd.getStaticRoutes().length]; String[] results = new String[cmd.getStaticRoutes().length];
String[][] rules = cmd.generateSRouteRules(); String[][] rules = cmd.generateSRouteRules();
@ -8109,9 +8042,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
for (int i = 0; i < srRules.length; i++) { for (int i = 0; i < srRules.length; i++) {
sb.append(srRules[i]).append(','); sb.append(srRules[i]).append(',');
} }
String args = "vpc_staticroute.sh " + routerIp; String args = "-a " + sb.toString();
args += " -a " + sb.toString(); callResult = routerProxy("vpc_staticroute.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args);
callResult = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
if (callResult == null || callResult.isEmpty()) { 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 //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++) { for (int i = 0; i < results.length; i++) {

View File

@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Queue; import java.util.Queue;
import java.util.Set;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
@ -43,7 +42,6 @@ import com.xensource.xenapi.Pool;
import com.xensource.xenapi.Session; import com.xensource.xenapi.Session;
import com.xensource.xenapi.Types; import com.xensource.xenapi.Types;
import com.xensource.xenapi.Types.BadServerResponse; import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.UuidInvalid;
import com.xensource.xenapi.Types.XenAPIException; import com.xensource.xenapi.Types.XenAPIException;
import com.cloud.utils.NumbersUtil; import com.cloud.utils.NumbersUtil;
@ -55,7 +53,6 @@ public class XenServerConnectionPool {
protected HashMap<String /* poolUuid */, XenServerConnection> _conns = new HashMap<String, XenServerConnection>(); protected HashMap<String /* poolUuid */, XenServerConnection> _conns = new HashMap<String, XenServerConnection>();
protected int _retries; protected int _retries;
protected int _interval; protected int _interval;
protected static boolean s_managePool = true;
protected static long s_sleepOnError = 10 * 1000; // in ms protected static long s_sleepOnError = 10 * 1000; // in ms
static { static {
File file = PropertiesUtil.findConfigFile("environment.properties"); File file = PropertiesUtil.findConfigFile("environment.properties");
@ -68,15 +65,11 @@ public class XenServerConnectionPool {
final Properties props = new Properties(); final Properties props = new Properties();
props.load(finputstream); props.load(finputstream);
finputstream.close(); finputstream.close();
String search = props.getProperty("manage.xenserver.pool.master"); String search = props.getProperty("sleep.interval.on.error");
if (search != null) {
s_managePool = Boolean.parseBoolean(search);
}
search = props.getProperty("sleep.interval.on.error");
if (search != null) { if (search != null) {
s_sleepOnError = NumbersUtil.parseInterval(search, 10) * 1000; 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) { } catch (FileNotFoundException e) {
s_logger.debug("File is not found", e); s_logger.debug("File is not found", e);
} catch (IOException e) { } catch (IOException e) {
@ -214,288 +207,27 @@ public class XenServerConnectionPool {
return false; return false;
} }
public void switchMaster(String slaveIp, String poolUuid, Connection conn, Host host, String username, Queue<String> 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); public Connection getConnect(String ip, String username, Queue<String> password) {
slaveSession = slaveLocalLoginWithPassword(slaveConn, username, password); Connection conn = new Connection(getURL(ip), 10);
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;
try { 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<String> 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<String> 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()); loginWithPassword(conn, username, password, APIVersion.latest().toString());
return conn; } catch (Types.HostIsSlave e) {
} catch (Exception e) { String maddress = e.masterIPAddress;
s_logger.debug("Failed to slave local login to " + ip); conn = new Connection(getURL(maddress), 10);
} try {
throw new RuntimeException("can not log in to master " + ip); loginWithPassword(conn, username, password, APIVersion.latest().toString());
} } catch (Exception e1) {
String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString();
public String getMasterIp(String ip, String username, Queue<String> password) throws XenAPIException { s_logger.debug(msg);
Connection slaveConn = null; throw new CloudRuntimeException(msg, e1);
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<String> 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<String> 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<String> password, int wait) {
try {
// try recoverSlave first
Set<Host> 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<Host> 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 (Exception e) { } catch (Exception e) {
if (s_logger.isDebugEnabled()) { String msg = "Unable to create master connection to host(" + ip +") , due to " + e.toString();
s_logger.debug("Catch " + e.getClass().getName() + " due to " + e.toString()); s_logger.debug(msg);
} throw new CloudRuntimeException(msg, e);
} }
return conn;
} }
public URL getURL(String ip) { public URL getURL(String ip) {
@ -512,39 +244,17 @@ public class XenServerConnectionPool {
public Connection connect(String hostUuid, String poolUuid, String ipAddress, String username, Queue<String> password, int wait) { public Connection connect(String hostUuid, String poolUuid, String ipAddress, String username, Queue<String> password, int wait) {
XenServerConnection mConn = null; XenServerConnection mConn = null;
Connection sConn = null;
String masterIp = null;
if (hostUuid == null || poolUuid == null || ipAddress == null || username == null || password == 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; String msg = "Connect some parameter are null hostUuid:" + hostUuid + " ,poolUuid:" + poolUuid + " ,ipAddress:" + ipAddress;
s_logger.debug(msg); s_logger.debug(msg);
throw new CloudRuntimeException(msg); throw new CloudRuntimeException(msg);
} }
Host host = null;
synchronized (poolUuid.intern()) { synchronized (poolUuid.intern()) {
// Let's see if it is an existing connection. // Let's see if it is an existing connection.
mConn = getConnect(poolUuid); mConn = getConnect(poolUuid);
if (mConn != null) { if (mConn != null){
try { try{
host = Host.getByUuid(mConn, hostUuid); 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);
} catch (Exception e) { } catch (Exception e) {
if (s_logger.isDebugEnabled()) { if (s_logger.isDebugEnabled()) {
s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString()); 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 { 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 { 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()); loginWithPassword(mConn, username, password, APIVersion.latest().toString());
addConnect(poolUuid, mConn); } catch (Exception e1) {
return mConn; String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString();
} catch (Exception e) { s_logger.debug(msg);
String msg = "Unable to logon in " + masterIp + " as master in pool(" + poolUuid + ")"; throw new CloudRuntimeException(msg, e1);
if (s_logger.isDebugEnabled()) {
s_logger.debug(msg);
}
throw new CloudRuntimeException(msg);
} }
} finally { } catch (Exception e) {
localLogout(sConn); String msg = "Unable to create master connection to host(" + ipAddress +") , due to " + e.toString();
sConn = null; s_logger.debug(msg);
throw new CloudRuntimeException(msg, e);
} }
addConnect(poolUuid, mConn);
} }
} }
if (mConn != null) {
if (s_managePool) {
try {
Map<String, String> args = new HashMap<String, String>();
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; return mConn;
} }

View File

@ -185,7 +185,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
catch (CloudRuntimeException ex) { catch (CloudRuntimeException ex) {
} }
Map<String, String> details = cmd.getDisk().getDetails(); Map<String, String> details = disk.getDetails();
boolean isManaged = Boolean.parseBoolean(details.get(DiskTO.MANAGED)); 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) // 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; VDI vdi = null;
if (isManaged) { if (isManaged) {
String iScsiName = details.get(DiskTO.IQN); vdi = hypervisorResource.prepareManagedStorage(conn, details, data.getPath(), vdiNameLabel);
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);
}
if (vmNotRunning) { if (vmNotRunning) {
DiskTO newDisk = new DiskTO(disk.getData(), disk.getDiskSeq(), vdi.getUuid(conn), disk.getType()); DiskTO newDisk = new DiskTO(disk.getData(), disk.getDiskSeq(), vdi.getUuid(conn), disk.getType());

View File

@ -34,14 +34,14 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; 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.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import org.apache.cloudstack.config.ApiServiceConfiguration;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.managed.context.ManagedContextRunnable; 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.AgentManager;
import com.cloud.agent.api.Answer; 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.routing.NetworkElementCommand;
import com.cloud.agent.api.to.LoadBalancerTO; import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.manager.Commands; import com.cloud.agent.manager.Commands;
import com.cloud.cluster.ClusterManager;
import com.cloud.configuration.Config; import com.cloud.configuration.Config;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
@ -802,7 +801,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
if (s_logger.isInfoEnabled()) { 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() + "/" + 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: " + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " +
ClusterManager.ManagementHostIPAdr.value()); ApiServiceConfiguration.ManagementHostIPAdr.value());
} }
if (s_logger.isDebugEnabled()) { if (s_logger.isDebugEnabled()) {

View File

@ -1,20 +1,22 @@
<!-- <!--
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 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.
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.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -34,6 +36,21 @@
<filtering>true</filtering> <filtering>true</filtering>
</testResource> </testResource>
</testResources> </testResources>
<plugins>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<executions>
<execution>
<id>cloudstack-checklicence</id>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
<profiles> <profiles>

View File

@ -1,3 +1,4 @@
#
# Licensed to the Apache Software Foundation (ASF) under one # 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 # distributed with this work for additional information
@ -14,5 +15,7 @@
# 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 # specific language governing permissions and limitations
# under the License. # under the License.
#
name=nvp name=nvp
parent=network parent=network

View File

@ -1,20 +1,22 @@
<!-- <!--
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 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.
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.
--> -->
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
import java.util.List; import java.util.List;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class ConfigurePublicIpsOnLogicalRouterAnswer extends Answer { public class ConfigurePublicIpsOnLogicalRouterAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
import java.util.List; import java.util.List;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
import java.util.List; import java.util.List;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class CreateLogicalSwitchAnswer extends Answer { public class CreateLogicalSwitchAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class CreateLogicalSwitchCommand extends Command { public class CreateLogicalSwitchCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class CreateLogicalSwitchPortAnswer extends Answer { public class CreateLogicalSwitchPortAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class CreateLogicalSwitchPortCommand extends Command { public class CreateLogicalSwitchPortCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
/** /**

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class DeleteLogicalSwitchAnswer extends Answer { public class DeleteLogicalSwitchAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class DeleteLogicalSwitchCommand extends Command { public class DeleteLogicalSwitchCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class DeleteLogicalSwitchPortAnswer extends Answer { public class DeleteLogicalSwitchPortAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class DeleteLogicalSwitchPortCommand extends Command { public class DeleteLogicalSwitchPortCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class FindLogicalSwitchPortAnswer extends Answer { public class FindLogicalSwitchPortAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class FindLogicalSwitchPortCommand extends Command { public class FindLogicalSwitchPortCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
import com.cloud.host.Host; import com.cloud.host.Host;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class UpdateLogicalSwitchPortAnswer extends Answer { public class UpdateLogicalSwitchPortAnswer extends Answer {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.agent.api; package com.cloud.agent.api;
public class UpdateLogicalSwitchPortCommand extends Command { public class UpdateLogicalSwitchPortCommand extends Command {

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.api.commands; package com.cloud.api.commands;
import javax.inject.Inject; import javax.inject.Inject;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.api.commands; package com.cloud.api.commands;
import javax.inject.Inject; import javax.inject.Inject;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.api.commands; package com.cloud.api.commands;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.api.commands; package com.cloud.api.commands;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.api.response; package com.cloud.api.response;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network; package com.cloud.network;
import java.util.UUID; import java.util.UUID;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network; package com.cloud.network;
import javax.persistence.Column; import javax.persistence.Column;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network; package com.cloud.network;
import javax.persistence.Column; import javax.persistence.Column;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network.dao; package com.cloud.network.dao;
import java.util.List; import java.util.List;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network.dao; package com.cloud.network.dao;
import java.util.List; import java.util.List;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network.dao; package com.cloud.network.dao;
import com.cloud.network.NiciraNvpNicMappingVO; import com.cloud.network.NiciraNvpNicMappingVO;

View File

@ -1,3 +1,4 @@
//
// Licensed to the Apache Software Foundation (ASF) under one // 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 // distributed with this work for additional information
@ -14,6 +15,8 @@
// 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 // specific language governing permissions and limitations
// under the License. // under the License.
//
package com.cloud.network.dao; package com.cloud.network.dao;
import javax.ejb.Local; import javax.ejb.Local;

Some files were not shown because too many files have changed in this diff Show More