Merge release branch 4.9 to master

* 4.9:
  CLOUDSTACK-9746 system-vm: logrotate config causes critical failures
  CLOUDSTACK-9788: Fix exception listNetworks with pagesize=0
  CLOUDSTACK-8663: Fixed various issues to allow VM snapshots and volume snapshots to exist together
  Fix HVM VM restart bug in XenServer
This commit is contained in:
Rajani Karuturi 2017-02-28 05:47:06 +05:30
commit fa85151be9
13 changed files with 45 additions and 28 deletions

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.hypervisor.xenserver.resource;
import org.apache.commons.collections.MapUtils;
import com.cloud.agent.IAgentControl;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
@ -1147,8 +1149,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vbdr.unpluggable = (volume.getType() == Volume.Type.ROOT) ? false : true;
vbdr.userdevice = "autodetect";
final Long deviceId = volume.getDiskSeq();
if (deviceId != null && !isDeviceUsed(conn, vm, deviceId)) {
vbdr.userdevice = deviceId.toString();
if (deviceId != null && (!isDeviceUsed(conn, vm, deviceId) || deviceId > 3)) {
vbdr.userdevice = deviceId.toString();
}
}
final VBD vbd = VBD.create(conn, vbdr);
@ -1413,6 +1415,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vbdr.userdevice = "autodetect";
vbdr.mode = Types.VbdMode.RW;
vbdr.type = Types.VbdType.DISK;
Long deviceId = volumeTO.getDeviceId();
if (deviceId != null && (!isDeviceUsed(conn, vm, deviceId) || deviceId > 3)) {
vbdr.userdevice = deviceId.toString();
}
VBD.create(conn, vbdr);
}
return vm;
@ -4396,6 +4402,30 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
}
protected void skipOrRemoveSR(Connection conn, SR sr) {
if (sr == null) {
return;
}
if (s_logger.isDebugEnabled()) {
s_logger.debug(logX(sr, "Removing SR"));
}
try {
Set<VDI> vdis = sr.getVDIs(conn);
for (VDI vdi : vdis) {
if (MapUtils.isEmpty(vdi.getCurrentOperations(conn))) {
continue;
}
return;
}
removeSR(conn, sr);
return;
} catch (XenAPIException | XmlRpcException e) {
s_logger.warn(logX(sr, "Unable to get current opertions " + e.toString()), e);
}
String msg = "Remove SR failed";
s_logger.warn(msg);
}
public void removeSR(final Connection conn, final SR sr) {
if (sr == null) {
return;

View File

@ -1198,7 +1198,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
final Set<VDI> snapshots = volume.getSnapshots(conn);
for (final VDI snapshot : snapshots) {
try {
if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid) && snapshot.getSnapshotTime(conn).before(avoidSnapshot.getSnapshotTime(conn))) {
if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid) && snapshot.getSnapshotTime(conn).before(avoidSnapshot.getSnapshotTime(conn)) && snapshot.getVBDs(conn).isEmpty()) {
snapshot.destroy(conn);
}
} catch (final Exception e) {

View File

@ -788,7 +788,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
s_logger.warn(details, e);
} finally {
if (srcSr != null) {
hypervisorResource.removeSR(conn, srcSr);
hypervisorResource.skipOrRemoveSR(conn, srcSr);
}
if (pool.isManaged()) {

View File

@ -2155,13 +2155,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
throw new InvalidParameterValueException("Can't find zone by id " + volume.getDataCenterId());
}
if (volume.getInstanceId() != null) {
// Check that Vm to which this volume is attached does not have VM Snapshots
if (_vmSnapshotDao.findByVm(volume.getInstanceId()).size() > 0) {
throw new InvalidParameterValueException("Volume snapshot is not allowed, please detach it from VM with VM Snapshots");
}
}
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) {
throw new PermissionDeniedException("Cannot perform this operation, Zone is currently disabled: " + zone.getName());
}

View File

@ -292,10 +292,6 @@ public class VMSnapshotManagerImpl extends MutualExclusiveIdsManagerBase impleme
}
if (_snapshotDao.listByInstanceId(vmId, Snapshot.State.BackedUp).size() > 0 && ! HypervisorType.KVM.equals(userVmVo.getHypervisorType())) {
throw new InvalidParameterValueException(
"VM snapshot for this VM is not allowed. This VM has volumes attached which has snapshots, please remove all snapshots before taking VM snapshot");
}
// VM snapshot with memory is not supported for VGPU Vms
if (snapshotMemory && _serviceOfferingDetailsDao.findDetail(userVmVo.getServiceOfferingId(), GPU.Keys.vgpuType.toString()) != null) {
throw new InvalidParameterValueException("VM snapshot with MEMORY is not supported for vGPU enabled VMs.");

View File

@ -4,6 +4,6 @@
rotate 3
compress
dateext
size 10M
maxsize 10M
notifempty
}

View File

@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
/var/log/cloud.log {
rotate 4
size 10M
rotate 10
maxsize 10M
missingok
notifempty
compress

View File

@ -1,5 +1,5 @@
/var/log/conntrackd-stats.log {
size 10M
maxsize 10M
rotate 2
missingok
compress

View File

@ -1,5 +1,5 @@
/var/log/dnsmasq.log {
size 10M
maxsize 10M
missingok
rotate 5
notifempty

View File

@ -2,7 +2,7 @@
rotate 5
missingok
notifempty
size 10M
maxsize 10M
postrotate
/bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true
endscript

View File

@ -1,5 +1,5 @@
/var/log/ppp-connect-errors {
size 10M
maxsize 10M
rotate 5
missingok
notifempty

View File

@ -1,10 +1,9 @@
/var/log/syslog
{
rotate 7
size 50M
maxsize 10M
missingok
notifempty
delaycompress
compress
postrotate
/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
@ -25,11 +24,10 @@
/var/log/messages
{
rotate 10
size 50M
maxsize 10M
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null

View File

@ -296,8 +296,8 @@ public class StringUtils {
public static <T> List<T> applyPagination(final List<T> originalList, final Long startIndex, final Long pageSizeVal) {
// Most likely pageSize will never exceed int value, and we need integer to partition the listToReturn
final boolean applyPagination = startIndex != null && pageSizeVal != null
&& startIndex <= Integer.MAX_VALUE && startIndex >= Integer.MIN_VALUE && pageSizeVal <= Integer.MAX_VALUE
&& pageSizeVal >= Integer.MIN_VALUE;
&& startIndex <= Integer.MAX_VALUE && startIndex >= 0 && pageSizeVal <= Integer.MAX_VALUE
&& pageSizeVal > 0;
List<T> listWPagination = null;
if (applyPagination) {
listWPagination = new ArrayList<>();