Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 846F5187C5 for ; Wed, 14 Oct 2015 20:38:05 +0000 (UTC) Received: (qmail 89863 invoked by uid 500); 14 Oct 2015 20:38:05 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 89822 invoked by uid 500); 14 Oct 2015 20:38:05 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 89811 invoked by uid 500); 14 Oct 2015 20:38:05 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 89804 invoked by uid 99); 14 Oct 2015 20:38:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Oct 2015 20:38:05 +0000 Date: Wed, 14 Oct 2015 20:38:05 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8832) Update Nuage VSP plugin to work with Nuage VSP release 3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14957702#comment-14957702 ] ASF GitHub Bot commented on CLOUDSTACK-8832: -------------------------------------------- Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/801#discussion_r42049470 --- Diff: plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java --- @@ -285,60 +507,341 @@ public boolean deleteNuageVspDevice(DeleteNuageVspDeviceCmd cmd) { return responseList; } - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - try { - initNuageScheduledTasks(); - } catch (Exception ce) { - s_logger.warn("Failed to load NuageVsp configuration properties. Check if the NuageVsp properties are configured correctly"); + private void registerNewNuageVspDevice(ConfigurationVO currentConfig, String registeredNuageVspDevice) { + if (currentConfig == null) { + ConfigKey configKey = new ConfigKey("Advanced", String.class, "nuagevsp.cms.id", registeredNuageVspDevice, + ": - Do not edit", false); + ConfigurationVO configuration = new ConfigurationVO("management-server", configKey); + _configDao.persist(configuration); + } else { + String newValue; + String currentValue = currentConfig.getValue(); + if (StringUtils.isNotBlank(currentValue)) { + newValue = currentValue + ";" + registeredNuageVspDevice; + } else { + newValue = registeredNuageVspDevice; + } + _configDao.update("nuagevsp.cms.id", newValue); } - return true; } - private void initNuageScheduledTasks() { - Integer numOfSyncThreads = Integer.valueOf(_configDao.getValue(NuageVspManager.NuageVspSyncWorkers.key())); - Integer syncUpIntervalInMinutes = Integer.valueOf(_configDao.getValue(NuageVspManager.NuageVspSyncInterval.key())); - - if (numOfSyncThreads != null && syncUpIntervalInMinutes != null) { - ThreadFactory threadFactory = new ThreadFactory() { - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable, "Nuage Vsp sync task"); - if (thread.isDaemon()) - thread.setDaemon(false); - if (thread.getPriority() != Thread.NORM_PRIORITY) - thread.setPriority(Thread.NORM_PRIORITY); - return thread; + private void auditHost(HostVO host) { + _hostDao.loadDetails(host); + + boolean validateDomains = true; + List nuageVspDevices = _nuageVspDao.listByHost(host.getId()); + if (!CollectionUtils.isEmpty(nuageVspDevices)) { + for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { + ConfigurationVO cmsIdConfig = _configDao.findByName("nuagevsp.cms.id"); + String nuageVspCmsId = findNuageVspCmsIdForDevice(nuageVspDevice.getId(), cmsIdConfig); + SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId); + SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd); + + if (answer != null && !answer.getSuccess()) { + s_logger.fatal("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!"); + validateDomains = false; + } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) { + registerNewNuageVspDevice(cmsIdConfig, nuageVspDevice.getId() + ":" + answer.getNuageVspCmsId()); } - }; - scheduler = Executors.newScheduledThreadPool(numOfSyncThreads, threadFactory); - scheduler.scheduleWithFixedDelay(new NuageVspSyncTask("FLOATING_IP"), ONE_MINUTE_MULTIPLIER * 15, ONE_MINUTE_MULTIPLIER * syncUpIntervalInMinutes, - TimeUnit.MILLISECONDS); - scheduler.scheduleWithFixedDelay(new NuageVspSyncTask("ENTERPRISE_NTWK_MACRO"), ONE_MINUTE_MULTIPLIER * 15, ONE_MINUTE_MULTIPLIER * syncUpIntervalInMinutes, - TimeUnit.MILLISECONDS); - scheduler - .scheduleWithFixedDelay(new NuageVspSyncTask("ENTERPRISE"), ONE_MINUTE_MULTIPLIER * 15, ONE_MINUTE_MULTIPLIER * syncUpIntervalInMinutes, TimeUnit.MILLISECONDS); - } else { - s_logger.warn("NuageVsp configuration for syncWorkers=" + numOfSyncThreads + " syncInterval=" + syncUpIntervalInMinutes - + " could not be read properly. So, check if the properties are configured properly in global properties"); + } + } + + if (validateDomains) { + auditDomainsOnVsp(host, true, false); } } - public class NuageVspSyncTask implements Runnable { + private boolean auditDomainsOnVsp(HostVO host, boolean add, boolean remove) { + List nuageVspDevices = _nuageVspDao.listByHost(host.getId()); + if (!CollectionUtils.isEmpty(nuageVspDevices)) { + _hostDao.loadDetails(host); + List allDomains = _domainDao.listAll(); + for (DomainVO domain : allDomains) { + try { + SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), add, remove); + SyncDomainAnswer answer = (SyncDomainAnswer) _agentMgr.easySend(host.getId(), cmd); + return answer.getSuccess(); + } catch (Exception e) { --- End diff -- @nlivens what's the status of addressing this comment? > Update Nuage VSP plugin to work with Nuage VSP release 3.2 > ---------------------------------------------------------- > > Key: CLOUDSTACK-8832 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8832 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the default.) > Components: Management Server > Affects Versions: 4.6.0 > Reporter: Nick Livens > Assignee: Nick Livens > Attachments: nuageVspMarvinLogs.tar.gz > > > Nuage VSP 3.2 is being released, we want to bring the plugin up to date for this release -- This message was sent by Atlassian JIRA (v6.3.4#6332)