Introduction
Purpose
Currently if an admin wants to update the hosts connected to CloudStack, he needs to search the released updates from a given source URL and check the updates as per the applicable XenServer version. Then admin needs to compare them with the already applied patches to find out the available updates. To reduce this effort we are adding this feature to CloudStack.
This feature will list the available patches/hotfixes for hypervisors connected to Cloudstack and the Cloudstack managed by CloudStack. CloudStack admin will be able to see the available updates on Cloudstack UI, this is CloudStack UI. This is a functional specification of feature "XS alert hotfix updates notification" which has Jira ID CS_CLOUDSTACK-16206192
References
Feature Specifications
- Requirements
- Display available and applied updates for a hostSurface up the list of all available updates applicable to XenServers hosts being managed by CloudStack and display them by means of APIs or on CloudStack UI dashboard so that admin can have the list of available updates and take appropriate action to install them manually.
- Non-requirements:
- Test guidelines
- CloudStack will only list the applicable updates and it is not responsible for applying the updates on the host.
- Configuration
- There are two three global configuration parameters:
- *xen.update.url - * URL to get latest Xenserver Updates. Default value for this is http://updates.xensource.com/XenServer/updates.xml;
- *xen.update.check.interval (in secminutes) - * How frequent update thread frequently should CloudStack check for Xenserver Updates. By default CloudStack will check for new updates once a week.
- host.updates.enable - To enable or disable the functionality based on admin demand.
- User permission
- Root-Admin would have privilege to list the available updates.
Use Cases
- Admin wants to check if there are any updates available for a host. She navigates to Infrastructure -> Hosts -> Updates in CloudStack UI. If there are any updates available that have not been applied to the host, are listed there along with the link for downloading the updates.
Architecture and Design description
search for Host Updates
This hostUpdates feature will come as a separate plugin which will enumerate all the hosts managed by CloudStack to provide the udpates. This will use this PluggableService to add the HostUpdate feature APIs into CloudStack* and the *HostUpdatesManager will be responsible for thread scheduling. This functionality will be contained in an independent jar file.
Search for Host Updates
The initial time to start thread after the management server comes up is set to 10 minutes and after regular intervals(default is one week), update.check.interval, management server will look for all available updates for a Hypervisior. For Xenserver, it'll downloads the latest update information from For Xenserver hypervisor, latest information about the updates for any version of Xenserver is available at this location : http://updates.xensource.com/XenServer/updates.xml. The location is configurable through xen.update.url in global configuration.
- Search the released patches for applicable XenServer version.
- Fetch the information about the already applied patches from the agent.
- Compare the list of available patches with the list of already applied patches.
- Prepare a list of patches that are not yet applied.
- Fill/update the patch details into host_updates table.
- Make a corresponding entry into host_updates_ref table.
Admin Once in a week, thread will check this location to search for updates and fill the database with available updates(if any) or admin can change the time interval to check the updates by changing the value of xen. update.check.interval global config parameter(by default interval is set to check the for updates "Once in once a week").
list Host Updates
http://10.102.125.207:8096/client/api?command=listHostUpdates&id=&hostid=&applied=true/false
Parameter | Description |
---|
id | uuid of update |
hostid | uuid of host |
applied | if the patch/update is applied or not(true/false) |
New cloudStack object:
update
- update label
- updateId
- description
- after-apply-guidance
- version
- url
- timestamp
List Host Updates
DB Schema changes
New tables
- host_updates (id, uuid, label, description, after_apply_guidancelabel, url, timestamp)
+-------------------------------------------------------------------------------+----------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------------------------------------------------------------------------------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| uuid | varchar(40) | YES | | NULL | |
| description | varchar(999) | YES | | NULL | |
| label | varchar(40) | YES | | NULL | |
| after_apply_guidance | varchar(40) | YES | | NULL | |
| timestamp | varchar(80) | YES | | NULL | |
| URL | varchar(999) | YES | | NULL | |
+--------------------------------------------------------------------------------+-----------------------+patch_host_ref : This table contains the details about the patches for different XenServers versions. Field | Type | NULL | Key | Default | Extra |
---|
id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
uuid | varchar(40) | NO | | NULL | |
description | varchar(999) | YES | | NULL | |
label | varchar(40) | YES | | NULL | |
timestamp | timestamp | YES | | NULL | |
url | varchar(999) | YES | | NULL | |
- host_updates_ref (id, host_id,patch_id, update_applied)
+-------------------------------------------------------------------------------+----------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------------------------------------------------------------------------------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| host_id | bigint(20) unsigned | NO | MUL | NULL | |
| patch_id | bigint(20) unsigned | NO | | NULL | |
| update_applied | tinyint(1) | NO | | 0 | |
+--------------------------------------------------------------------------------+-----------------------+
...
- : This table maps the hosts from host table with the applicable patches from host_updates table.
Field | Type | NULL | Key | Default | Extra |
---|
id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
host_id | bigint(20) unsigned | NO | MUL | NULL | |
patch_id | bigint(20) unsigned | NO | | NULL | |
update_applied | tinyint(1) | NO | | 0 | |
New client APIs
ApiName | Request parameters | Response parameters | Available to regular user |
---|
listHostUpdates | - id
- hostid (required)
- applied
| - idhost Id
- update Label
- description
- update URL
- timestamp
- isApplied
| No |
In the above mentioned API, only hostid is required parameter and the other parameters (id and applied) are optional. If admin wants to list all the patches that are not yet applied to a host, set the applied parameter as false and if admin wants to list the applied ones, set the applied parameter as true. If applied parameter is not passed with the API, it will return the list of all applied and not applied patches. To get the details about the single patch, admin need to pass the id (uuid)* *of the patch.
ApiName | Request parameters | Response parameters | Available to regular user |
---|
listHostsWithPendingUpdates | | | No |
This API will return a list of hosts which have pending updates. Admin can also search hosts with pending updates by passing a parameter patchid, it will return a list of hosts which do not have this patch applied.
New classes for client APIs
- ListHostUpdatesCmd.java
- HostUpdatesResponse.java
- ListHostsWithPendingUpdatesCmd.java
- HostsWithPendingUpdatesResponse.java
New objects interfaces:
- HostUpdatesRef.java
- PatchHostRefHostUpdatesService.java
New VO and Dao objects:
- HostUpdatesDao.java
- HostUpdatesDaoImpl.java
- HostUpdatesVO.java
- PatchHostRefDaoHostUpdatesRefDao.java
- PatchHostRefDaoImplHostUpdatesRefDaoImpl.java
- PatchHostVOHostUpdatesRefVO.java
New managers interfaces and implementation:
- HostUpdatesManager.java
- HostUpdatesManagerImpl.java
Changes to Existing Files:
- Added Add a new method "searchForHostUpdates" in ManagementServiceCitrixResourceBase.java and implemented in ManagementServerImpl.javaAdded a new method* in CitrixResourceBase.java to to get the information about the applied patches to a host using XAPI using *XAPI *calls.
- Added a call in ResourceManagerImpl.java to delete the update entries from patch_host_ref table only if admin removes the associated host.
- Added new call createHostUpdateResponse in interface ResponseGenerator.java *and implemented it in *ApiResponseHelper.java .
Added new files HostUpdatesDaoImpl.java and PatchHostRefDaoImpl.java into DefaultComponentLibrary.java .- Add a new method in ResourceManagerImpl.java* *to get a list of hosts which are up and enabled by hypervisor type.
- Add a new component HostUpdatesManager.
New Agent APIs:
- hostUpdatesCommand.java
- hostUpdatesAnswer.java
These agent APIs will not be present in hostUpdates plugin, these APIs will come the api project under com.cloud.agent.api packages.
Logging and Debugging
All logs will go to vmops.log (dev setup) and management-server.log (RPM install setup)
Current limitations
- Implements Initial implementation will be there only for Xenserver Hypervisorhypervisor. Going forward, this feature can be made available for other hypervisors.
UI flow
This is the mockup UI, will modify it as per the suggestions.
Step 1: Navigate to the detailView page of a host, there you will find a new tab "Updates".
Image Removed
Step 2: *Click on "Updates"* tab to get a list of updates for this host.
Image Removed
Appendix
Appendix A:
We are planning to display the XS alert notifications under “Alerts”, where admin can see the Update Alerts.
Image Added
Because of this the “Updates Alerts” will get displayed on Dashboard too.
Image Added
Also, admin can navigate to Events tab -> Host Updates (dropdown option), to get the list of all the hosts which have pending updates.
Image Added
By clicking on any listed host, Admin can see the list of all the applicable updates that needs to be applied.
Image Added
Admin can also see the udpates in “Update” tab under the Host detailView:
Image Added
Image Added
...