[ https://issues.apache.org/jira/browse/CLOUDSTACK-10241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16345205#comment-16345205 ]
ASF GitHub Bot commented on CLOUDSTACK-10241: --------------------------------------------- DaanHoogland commented on a change in pull request #2414: [CLOUDSTACK-10241] Duplicated file SRs being created in XenServer pools URL: https://github.com/apache/cloudstack/pull/2414#discussion_r164773896 ########## File path: plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessorTest.java ########## @@ -0,0 +1,459 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.cloud.hypervisor.xenserver.resource; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.times; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang.StringUtils; +import org.apache.xmlrpc.XmlRpcException; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InOrder; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.xensource.xenapi.Connection; +import com.xensource.xenapi.Host; +import com.xensource.xenapi.PBD; +import com.xensource.xenapi.PBD.Record; +import com.xensource.xenapi.SR; +import com.xensource.xenapi.Types.InternalError; +import com.xensource.xenapi.Types.XenAPIException; + +@RunWith(PowerMockRunner.class) +public class Xenserver625StorageProcessorTest { + + @InjectMocks + private Xenserver625StorageProcessor xenserver625StorageProcessor; + + @Mock + private CitrixResourceBase citrixResourceBase; + + @Mock + private Connection connectionMock; + + private String pathMock = "pathMock"; + + @Before + public void before() { + xenserver625StorageProcessor = Mockito.spy(new Xenserver625StorageProcessor(citrixResourceBase)); + citrixResourceBase._host = Mockito.mock(XsHost.class); + Mockito.when(citrixResourceBase.getHost()).thenReturn(citrixResourceBase._host); + } + + @Test + public void makeDirectoryTestCallHostPlugingReturningEmpty() { + boolean makeDirectoryReturn = configureAndExecuteMakeDirectoryMethodForTest(pathMock, StringUtils.EMPTY); + + assertFalse(makeDirectoryReturn); + } + + @Test + public void makeDirectoryTestCallHostPlugingReturningNull() { + boolean makeDirectoryReturn = configureAndExecuteMakeDirectoryMethodForTest(pathMock, null); + + assertFalse(makeDirectoryReturn); + } + + @Test + public void makeDirectoryTestCallHostPlugingReturningSomething() { + boolean makeDirectoryReturn = configureAndExecuteMakeDirectoryMethodForTest(pathMock, "Soemthing"); Review comment: Soemthing on purpose or Something intended? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Duplicated file SRs being created in XenServer pools > ---------------------------------------------------- > > Key: CLOUDSTACK-10241 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10241 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Rafael Weingärtner > Assignee: Rafael Weingärtner > Priority: Major > > Due to a race condition between multiple management servers, in some rare > cases, CloudStack is creating multiple file SRs to the same secondary folder. > This causes a problem when introducing the SR to the XenServer pools, as > “there will be VDIs with duplicated UUIDs“. The VDIs are the same, but they > are seen in different SRs, and therefore cause an error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)