Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backroll Plugin #8251

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

Backroll Plugin #8251

wants to merge 31 commits into from

Conversation

PeterBackroll
Copy link

@PeterBackroll PeterBackroll commented Nov 20, 2023

Description

This is the pull request for Backroll Plugin (a backup & restore plugin).
This plugin allows users to use Backroll as backup provider inside Cloudstack.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Copy link

boring-cyborg bot commented Nov 20, 2023

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: Patch coverage is 0% with 518 lines in your changes missing coverage. Please review.

Project coverage is 15.76%. Comparing base (d6181d5) to head (8e3c8f7).

Files with missing lines Patch % Lines
...che/cloudstack/backup/backroll/BackrollClient.java 0.00% 265 Missing ⚠️
...ache/cloudstack/backup/BackrollBackupProvider.java 0.00% 188 Missing ⚠️
...dstack/backup/backroll/model/BackrollOffering.java 0.00% 13 Missing ⚠️
...tack/backup/backroll/model/BackrollTaskStatus.java 0.00% 10 Missing ⚠️
...dstack/backup/backroll/model/BackrollVmBackup.java 0.00% 8 Missing ⚠️
...k/backup/backroll/model/BackrollBackupMetrics.java 0.00% 6 Missing ⚠️
...oudstack/backup/backroll/model/BackrollBackup.java 0.00% 4 Missing ⚠️
...ll/model/response/BackrollTaskRequestResponse.java 0.00% 1 Missing ⚠️
...tack/backup/backroll/model/response/TaskState.java 0.00% 1 Missing ⚠️
...kup/backroll/model/response/TaskStateResponse.java 0.00% 1 Missing ⚠️
... and 21 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8251      +/-   ##
============================================
- Coverage     15.78%   15.76%   -0.02%     
+ Complexity    12552    12551       -1     
============================================
  Files          5625     5656      +31     
  Lines        491993   492511     +518     
  Branches      63581    61853    -1728     
============================================
- Hits          77670    77663       -7     
- Misses       405864   406389     +525     
  Partials       8459     8459              
Flag Coverage Δ
uitests 4.03% <ø> (ø)
unittests 16.58% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 7806

@DaanHoogland
Copy link
Contributor

@PeterBackroll , nice to see this coming in. Will you add a documentation PR as well? I think you'll have a lot of reviews ;)

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-8383)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 45945 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8251-t8383-kvm-centos7.zip
Smoke tests completed. 117 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 672.30 test_kubernetes_clusters.py

@PeterBackroll
Copy link
Author

Hi @DaanHoogland Yes I will add a documentation PR as soon as possible :)

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments @PeterBackroll .
I haven't gotten to review the Provider and Client yet, the core of the plugin.
I'll do that next week ;)

@@ -0,0 +1,38 @@
package org.apache.cloudstack.backup.backroll.model.response.policy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package org.apache.cloudstack.backup.backroll.model.response.policy;
// 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 org.apache.cloudstack.backup.backroll.model.response.policy;

@@ -0,0 +1,31 @@
package org.apache.cloudstack.backup.backroll.model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package org.apache.cloudstack.backup.backroll.model;
// 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 org.apache.cloudstack.backup.backroll.model;

@@ -0,0 +1,19 @@
package org.apache.cloudstack.backup.backroll.model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package org.apache.cloudstack.backup.backroll.model;
// 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 org.apache.cloudstack.backup.backroll.model;

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 7834

@shwstppr
Copy link
Contributor

@PeterBackroll can you please have a look at the GH actions failures

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments @PeterBackroll .
I haven't gotten to review the Provider and Client yet, the core of the plugin.
Thatś up next ;)

Comment on lines 19 to 25
/* import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.backup.backroll.api.response.ApiHelloResponse; */

/* @APICommand(name = "getBackrollHello", responseObject = ApiHelloResponse.class, description = "Get Hello",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code in comment (stealing git's job;)
Makes me think if this class is really needed? maybe remove it from the PR?

import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;

public class ApiHelloResponse extends BaseResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this class be included?

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generally good, @PeterBackroll .
some changes will have to be done though (before merging)

Comment on lines 48 to 51
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move up to the other org.apache.cloudstack imports

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ;)


public ConfigKey<String> BackrollPasswordConfigKey = new ConfigKey<>("Advanced", String.class,
"backup.plugin.backroll.config.password",
"VviX8dALauSyYJMqVYJqf3UyZOpO3joS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this more clear, this string is just as insecure but less inviting to change

Suggested change
"VviX8dALauSyYJMqVYJqf3UyZOpO3joS",
"password",

or

Suggested change
"VviX8dALauSyYJMqVYJqf3UyZOpO3joS",
"C'est vraiment secret",

message = MessageFormat.format("Backup {0} deleted in CS for virtual machine {1}", backup.getId(), vm.getName());
s_logger.info(message);
} else {
isAnyProblemWhileRemovingBackups = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why reset to false? the prior one have failed right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!!

}

@Override
public void syncBackups(VirtualMachine vm, Backup.Metric metric) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe disect this method. it is rather big.

List<BackrollVmBackup> backupsFromBackroll = client.getAllBackupsfromVirtualMachine(vm.getUuid());
backupsInDb = backupDao.listByVmId(null, vm.getId());

// insert new backroll backup in CS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// insert new backroll backup in CS
// insert new backroll backups in CS DB

This could easily be a method name for a private method

}
}

// delete deleted backroll backup in CS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// delete deleted backroll backup in CS
// delete deleted backroll backups from CS DB

another private method to extract

Comment on lines 215 to 218
final BackrollClient client = getClient(vm.getDataCenterId());
List<Backup> backupsInDb = backupDao.listByVmId(null, vm.getId());

for (Backup backup : backupsInDb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the start of three privat methods for improved readibility

public boolean deleteBackup(Backup backup, boolean forced) {
s_logger.info("backroll delete backup id: " + backup.getExternalId());
if(backup.getStatus().equals(Backup.Status.BackingUp)) {
throw new CloudRuntimeException("You can't delete a backup while it still BackingUp");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new CloudRuntimeException("You can't delete a backup while it still BackingUp");
throw new CloudRuntimeException("You can't delete a backup while it's still BackingUp");

Comment on lines 61 to 62
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.backup.Backup.Metric;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be mixed up there ^ with the rest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ;)

@andrijapanicsb
Copy link
Contributor

@PeterBackroll do we have any docs on how to configure the plugin, what kind of storage is supported, any limitations, etc?
Thx!

m-dhellin and others added 8 commits October 1, 2024 19:20
…apache#9731)

* added a v-if directive within the EditVm view to not show the field userdata if the vm's network does not offer the feature

* added the parameter listall:true to the requests made to listNetworks and listVirtualMachines
… than English (apache#9766)

* Fix updateTemplatePermission UI in non-english language

* Improve fix

---------

Co-authored-by: Lucas Martins <[email protected]>
@rajujith
Copy link
Collaborator

rajujith commented Oct 7, 2024

@blueorangutan package

@blueorangutan
Copy link

@rajujith a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11293

@rajujith
Copy link
Collaborator

rajujith commented Oct 8, 2024

@blueorangutan package

@rajujith
Copy link
Collaborator

rajujith commented Oct 8, 2024

@blueorangutan package

@blueorangutan
Copy link

@rajujith a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11302

Copy link
Collaborator

@rajujith rajujith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PeterBackroll below is my review summary.
I used this plugin with Backroll version v0.4.0-alpha-1-25-g50d43bf.
Backup VM works sometimes with no changes to the configuration.
There is a delay in listing the backup policy while creating the backup offering.
Delay in syncing the backup completion status to CloudStack. The delay observed varies from a few minutes and upwards.
Many times the backup API is not send to Backroll by the cloudstack backroll client, but it works after restarting cloudstack-management service a couple of times. Some of these failed jobs fails with "Failed to authenticate Backroll API service due to:Timeout waiting for connection from pool"
Restore Backup fails with: "Virtual machine not found to process restore"
Single instance backup of an instance with 2 volumes, ROOT and data is listed as two individual instance backups instead of one. The volume is not listed in these backups.

@rajujith
Copy link
Collaborator

@blueorangutan package

@blueorangutan
Copy link

@rajujith a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11355

@rajujith
Copy link
Collaborator

@PeterBackroll
Create backup fails instantly now, no task is visible on the backroll.
Unable to delete an existing backup, unable to remove an instance from backup offering having backups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.