[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13655881#comment-13655881
 ] 

Nicolas Lamirault commented on CLOUDSTACK-528:
----------------------------------------------

I change code like this :

 git diff server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java
diff --git 
a/server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java 
b/server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java
index 3ca74a3..9e219bb 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java
@@ -92,8 +92,9 @@ public class SecondaryStorageDiscoverer extends 
DiscovererBase implements Discov
             s_logger.debug("It's not NFS or file or ISO, so not a secondary 
storage server: " + uri.toString());
             return null;
         }
-
+        s_logger.info("URI Scheme: " + uri.getScheme());
         if (uri.getScheme().equalsIgnoreCase("nfs") || 
uri.getScheme().equalsIgnoreCase("iso")) {
+            s_logger.info("NFS Secondary Storage find");
             return createNfsSecondaryStorageResource(dcId, podId, uri);
         } else if (uri.getScheme().equalsIgnoreCase("file")) {
             return createLocalSecondaryStorageResource(dcId, podId, uri);
@@ -105,7 +106,11 @@ public class SecondaryStorageDiscoverer extends 
DiscovererBase implements Discov
     }
     
     protected Map<? extends ServerResource, Map<String, String>> 
createNfsSecondaryStorageResource(long dcId, Long podId, URI uri) {
-        
+
+        s_logger.info("userServiceVM : " + _useServiceVM);
+        if (!_useServiceVM) {
+            _useServiceVM = true;
+        }
        if (_useServiceVM) {
            return createDummySecondaryStorageResource(dcId, podId, uri);
        }

In logs :

2013-05-13 11:52:12,913 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Trying to add a new host at 
nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage 
in data center 1
2013-05-13 11:52:12,913 INFO  [storage.secondary.SecondaryStorageDiscoverer] 
(TP-Processor17:null) URI Scheme: nfs
2013-05-13 11:52:12,913 INFO  [storage.secondary.SecondaryStorageDiscoverer] 
(TP-Processor17:null) NFS Secondary Storage find
2013-05-13 11:52:12,913 INFO  [storage.secondary.SecondaryStorageDiscoverer] 
(TP-Processor17:null) userServiceVM : false
2013-05-13 11:52:12,920 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Retrieving network interface: xenbr0
2013-05-13 11:52:12,920 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Unable to get network interface for xenbr0
2013-05-13 11:52:12,920 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Retrieving network interface: xenbr1
2013-05-13 11:52:12,921 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Unable to get network interface for xenbr1
2013-05-13 11:52:12,921 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Retrieving network interface: null
2013-05-13 11:52:12,921 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Retrieving network interface: null
2013-05-13 11:52:12,921 ERROR [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Nics are not configured!
2013-05-13 11:52:12,922 INFO  [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Designating private to be nic eth0
2013-05-13 11:52:12,923 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Find resource Storage
2013-05-13 11:52:12,924 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Parameters for private nic: 10.200.194.26 - 
00:50:56:a9:50:b6-255.255.254.0
2013-05-13 11:52:12,924 DEBUG [cloud.resource.ServerResourceBase] 
(TP-Processor17:null) Parameters for storage nic: 10.200.194.26 - 
00:50:56:a9:50:b6-255.255.254.0
2013-05-13 11:52:12,931 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Startup cmds : 1
2013-05-13 11:52:12,931 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Cmd: StartupCommand{type=Storage, dataCenter='1', 
pod='null', cluster='null', guid='nfs://rr.isia.boi.cloud.mbs/ifs/cloud/ch
evilly/clustervmw-prp/secondarystorage', 
name='nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage',
 id=null, version='4.1.0', iqn='null', publicIpAddress='null', 
publicNetmask='null', p
ublicMacAddress='null', privateIpAddress='nfs', 
privateMacAddress='00:50:56:a9:50:b6', privateNetmask='255.255.254.0', 
storageIpAddress='10.200.194.26', storageNetmask='255.255.254.0', 
storageMacAddress='00:50:56:
a9:50:b6', storageIpAddressDeux='null', storageMacAddressDeux='null', 
storageNetmaskDeux='null', agentTag='null', resourceName='null', 
gatewayIpAddress='null'}
2013-05-13 11:52:12,934 DEBUG [agent.transport.Request] (TP-Processor17:null) 
Seq -1--1: Startup request from directly connected host:  { Cmd , MgmtId: -1, 
via: -1, Ver: v1, Flags: 11, [{"parent":"dummy","template
Info":{"207-2-42628997-747f-3f54-97a2-5ce9a2cca743":{"templateName":"207-2-42628997-747f-3f54-97a2-5ce9a2cca743","installPath":"template/tmpl/1/207/","size":0,"physicalSize":0,"id":0,"isPublic":false,"isCorrupted"
:false},"routing-9":{"templateName":"routing-9","installPath":"template/tmpl/1/9/","size":0,"physicalSize":0,"id":0,"isPublic":false,"isCorrupted":false},"routing-8":{"templateName":"routing-8","installPath":"temp
late/tmpl/1/8/","size":0,"physicalSize":0,"id":0,"isPublic":false,"isCorrupted":false},"routing-3":{"templateName":"routing-3","installPath":"template/tmpl/1/3/","size":0,"physicalSize":0,"id":0,"isPublic":false,"
isCorrupted":false},"routing-1":{"templateName":"routing-1","installPath":"template/tmpl/1/1/","size":0,"physicalSize":0,"id":0,"isPublic":false,"isCorrupted":false}},"totalSize":107374182400,"resourceType":"SECON
DARY_STORAGE","fsType":"NetworkFilesystem","hostDetails":{"mount.parent":"dummy","mount.path":"dummy","orig.url":"nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage"},"nfsShare":"nfs://
rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage","type":"Storage","dataCenter":"1","guid":"nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage","name":"nfs://rr.
isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage","version":"4.1.0","privateIpAddress":"nfs","privateMacAddress":"00:50:56:a9:50:b6","privateNetmask":"255.255.254.0","storageIpAddress":"10.200
.194.26","storageNetmask":"255.255.254.0","storageMacAddress":"00:50:56:a9:50:b6","wait":0}]
 }
2013-05-13 11:52:12,940 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Create cmd com.cloud.agent.api.StartupStorageCommand
2013-05-13 11:52:12,954 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Dispatch event CREATE_HOST_VO_FOR_DIRECT_CONNECT for 
Host[-0-null]
2013-05-13 11:52:12,954 DEBUG [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Dispatching resource state event 
CREATE_HOST_VO_FOR_DIRECT_CONNECT to 
XcpServerDiscoverer_EnhancerByCloudStack_2a52b4bf
2013-05-13 11:52:12,954 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Event ok ... create host
2013-05-13 11:52:12,954 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Result dispatch event : null
2013-05-13 11:52:12,954 DEBUG [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Dispatching resource state event 
CREATE_HOST_VO_FOR_DIRECT_CONNECT to 
PremiumSecondaryStorageManagerImpl_EnhancerByCloudStac
k_5c5dbbf0
2013-05-13 11:52:12,954 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Event ok ... create host
2013-05-13 11:52:12,954 INFO  [storage.secondary.SecondaryStorageManagerImpl] 
(TP-Processor17:null) Create Host .......
2013-05-13 11:52:12,954 INFO  [storage.secondary.SecondaryStorageManagerImpl] 
(TP-Processor17:null) Startup command: 
nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage
2013-05-13 11:52:12,954 INFO  [storage.secondary.SecondaryStorageManagerImpl] 
(TP-Processor17:null) ssCmd type : Storage
2013-05-13 11:52:12,954 INFO  [storage.secondary.SecondaryStorageManagerImpl] 
(TP-Processor17:null) End host : Host[-0-SecondaryStorage]
2013-05-13 11:52:12,954 INFO  [cloud.resource.ResourceManagerImpl] 
(TP-Processor17:null) Result dispatch event : Host[-0-SecondaryStorage]
2013-05-13 11:52:13,007 DEBUG [cloud.resource.ResourceState] 
(TP-Processor17:null) Resource state update: [id = 6; name = 
nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage; 
old state =
 Creating; event = InternalCreated; new state = Enabled]
2013-05-13 11:52:13,007 DEBUG [cloud.host.Status] (TP-Processor17:null) 
Transition:[Resource state = Enabled, Agent event = AgentConnected, Host id = 
6, name = nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/cluste
rvmw-prp/secondarystorage]
2013-05-13 11:52:13,024 DEBUG [cloud.host.Status] (TP-Processor17:null) Agent 
status update: [id = 6; name = 
nfs://rr.isia.boi.cloud.mbs/ifs/cloud/chevilly/clustervmw-prp/secondarystorage; 
old status = Creating; e
vent = AgentConnected; new status = Connecting; old update count = 0; new 
update count = 1]

...

And now it works (secondary storage correctly added).
                
> Failed to create secondary storage
> ----------------------------------
>
>                 Key: CLOUDSTACK-528
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-528
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Storage Controller
>    Affects Versions: 4.0.0, 4.1.0
>         Environment: CentOS 
>            Reporter: Tamas Monos
>            Priority: Blocker
>             Fix For: 4.1.0
>
>
>          Hi,
> I cannot add secondary storage to my existing Zone. This prevents the 
> platform from operating.
> API call via GUI captured by tcpdump:
> http://sandbox.veber.co.uk/client/api?command=addSecondaryStorage&zoneId=a8d21e6d-bc9e-4dc2-b996-fc22727cd9c1&url=nfs%3A%2F%2F192.168.1.2%2Fwatford_cloud&response=json&sessionkey=DGl3OmkfQRGwuIDZFoOpoF2WBJU%3D&_=1353673985114
> Result:
> Unable to connect due to 
> java.lang.IllegalArgumentException: Host 192.168.1.4 sent incorrect data 
> center: null
>         at 
> com.cloud.resource.ResourceManagerImpl.createHostVO(ResourceManagerImpl.java:1501)
>         at 
> com.cloud.resource.ResourceManagerImpl.createHostAndAgent(ResourceManagerImpl.java:1629)
>         at 
> com.cloud.resource.ResourceManagerImpl.discoverHostsFull(ResourceManagerImpl.java:720)
>         at 
> com.cloud.resource.ResourceManagerImpl.discoverHosts(ResourceManagerImpl.java:551)
>         at 
> com.cloud.api.commands.AddSecondaryStorageCmd.execute(AddSecondaryStorageCmd.java:79)
>         at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:138)
>         at com.cloud.api.ApiServer.queueCommand(ApiServer.java:543)
>         at com.cloud.api.ApiServer.handleRequest(ApiServer.java:422)
>         at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:304)
>         at com.cloud.api.ApiServlet.doGet(ApiServlet.java:63)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>         at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>         at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>         at 
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
>         at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>         at 
> org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889)
>         at 
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721)
>         at 
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2268)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:679)
> 2012-11-23 12:32:58,518 INFO  [cloud.resource.ResourceManagerImpl] 
> (catalina-exec-23:null) server resources successfully discovered by 
> SecondaryStorage
> 2012-11-23 12:32:58,518 WARN  [cloud.api.ApiDispatcher] 
> (catalina-exec-23:null) class com.cloud.api.ServerApiException : Failed to 
> add secondary storage
> Debug:
> mysql> select uuid from data_center where name='Watford';
> +--------------------------------------+
> | uuid                                 |
> +--------------------------------------+
> | a8d21e6d-bc9e-4dc2-b996-fc22727cd9c1 |
> +--------------------------------------+
> The Zone ID matches but API throws exception while the IS is supplied in the 
> query.
> Scenario:
> I have upgraded from 3.0.2 to 4.0.0. Due to the upgrade scripts did not 
> update the systemVMs to the new template I've applied a workaround and 
> recreated the systemVMs with the new templates. After that I've enabled 
> storage clean-up and the cleanup script destroyed everything on my primary 
> storage including systemVMs. I wanted to re-create them but cannot add 
> secondary storage to the Zone.
> The applied workarounds during upgrade:
> 1. Add new vmware template to CS with name systemvm-vmware-4.0 (I have 
> re-imported it) 2. Wait till the template is downloaded and installed 
> successfully
> 3. Look up id of this template in DB (Name should match the input provided in 
> step
> mysql> select id from `cloud`.`vm_template` where name = 
> mysql> 'systemvm-vmware-4.0' and removed is null;
> 4. Update template type to SYSTEM
> mysql> update `cloud`.`vm_template` set type='SYSTEM' where id = 
> mysql> <id-from-step3>;
> 5. Update template Id for all system Vms
> mysql> update `cloud`.`vm_instance` set vm_template_id = <id-from-step3> 
> mysql> where type <> 'User' and hypervisor_type = 'VMware';
> 6. Restart all system Vms

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to