Title: RBD/RADOS volume management should be handled by libvirt · Issue #6180 · apache/cloudstack · GitHub
Open Graph Title: RBD/RADOS volume management should be handled by libvirt · Issue #6180 · apache/cloudstack
X Title: RBD/RADOS volume management should be handled by libvirt · Issue #6180 · apache/cloudstack
Description: ISSUE TYPE Enhancement Request COMPONENT NAME CloudStack Agent CLOUDSTACK VERSION all SUMMARY The CloudStack Agent uses com.ceph.rados.* for many operations as when implementing the RBD storage pool support not all features were supporte...
Open Graph Description: ISSUE TYPE Enhancement Request COMPONENT NAME CloudStack Agent CLOUDSTACK VERSION all SUMMARY The CloudStack Agent uses com.ceph.rados.* for many operations as when implementing the RBD storage poo...
X Description: ISSUE TYPE Enhancement Request COMPONENT NAME CloudStack Agent CLOUDSTACK VERSION all SUMMARY The CloudStack Agent uses com.ceph.rados.* for many operations as when implementing the RBD storage poo...
Opengraph URL: https://github.com/apache/cloudstack/issues/6180
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RBD/RADOS volume management should be handled by libvirt","articleBody":"##### ISSUE TYPE\r\n * Enhancement Request\r\n\r\n##### COMPONENT NAME\r\n~~~\r\nCloudStack Agent\r\n~~~\r\n\r\n##### CLOUDSTACK VERSION\r\n~~~\r\nall\r\n~~~\r\n\r\n##### SUMMARY\r\nThe CloudStack Agent uses com.ceph.rados.* for many operations as when implementing the RBD storage pool support not all features were supported by Libvirt.\r\n\r\nFor example: https://github.com/apache/cloudstack/blob/1a304ccf68a75d835cf5e723b56b57155be6ebda/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java#L913\r\n\r\n```\r\n IoCTX io = r.ioCtxCreate(pool.getSourceDir());\r\n Rbd rbd = new Rbd(io);\r\n RbdImage image = rbd.open(uuid);\r\n s_logger.debug(\"Fetching list of snapshots of RBD image \" + pool.getSourceDir() + \"/\" + uuid);\r\n List\u003cRbdSnapInfo\u003e snaps = image.snapList();\r\n try {\r\n for (RbdSnapInfo snap : snaps) {\r\n if (image.snapIsProtected(snap.name)) {\r\n s_logger.debug(\"Unprotecting snapshot \" + pool.getSourceDir() + \"/\" + uuid + \"@\" + snap.name);\r\n image.snapUnprotect(snap.name);\r\n } else {\r\n s_logger.debug(\"Snapshot \" + pool.getSourceDir() + \"/\" + uuid + \"@\" + snap.name + \" is not protected.\");\r\n }\r\n s_logger.debug(\"Removing snapshot \" + pool.getSourceDir() + \"/\" + uuid + \"@\" + snap.name);\r\n image.snapRemove(snap.name);\r\n }\r\n s_logger.info(\"Successfully unprotected and removed any remaining snapshots (\" + snaps.size() + \") of \"\r\n + pool.getSourceDir() + \"/\" + uuid + \" Continuing to remove the RBD image\");\r\n } catch (RbdException e) {\r\n s_logger.error(\"Failed to remove snapshot with exception: \" + e.toString() +\r\n \", RBD error: \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n throw new CloudRuntimeException(e.toString() + \" - \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n } finally {\r\n s_logger.debug(\"Closing image and destroying context\");\r\n rbd.close(image);\r\n r.ioCtxDestroy(io);\r\n }\r\n } catch (RadosException e) {\r\n s_logger.error(\"Failed to remove snapshot with exception: \" + e.toString() +\r\n \", RBD error: \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n throw new CloudRuntimeException(e.toString() + \" - \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n } catch (RbdException e) {\r\n s_logger.error(\"Failed to remove snapshot with exception: \" + e.toString() +\r\n \", RBD error: \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n throw new CloudRuntimeException(e.toString() + \" - \" + ErrorCode.getErrorMessage(e.getReturnValue()));\r\n }\r\n }\r\n```\r\n\r\nHere the CloudStack agent purges any RBD snapshots as they need to be removed prior to removing the RBD image.\r\n\r\nModern libvirt can do this for you (pseudo code):\r\n\r\n```\r\nStorageVol.delete(VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS)\r\n```\r\n\r\nThis removes a lot of lines of code from CloudStack and leverages what libvirt can do for us.\r\n\r\nThis is just one example, but there are other places where the CloudStack agent uses the librados Java bindings directly while those things can be handled by libvirt.\r\n\r\n","author":{"url":"https://github.com/wido","@type":"Person","name":"wido"},"datePublished":"2022-03-30T19:56:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/6180/cloudstack/issues/6180"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7e9c3500-ab1f-34a4-f723-8577516c8a46 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E704:D3583:97DF27:D19FB7:6A4DDBE5 |
| html-safe-nonce | 94d4be616ce2e40bd134268a90f464996e1a92931d90d3efe83080e54790f3d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzA0OkQzNTgzOjk3REYyNzpEMTlGQjc6NkE0RERCRTUiLCJ2aXNpdG9yX2lkIjoiNDM1Nzc5Nzk5NjM5OTU0OTQxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 47723b5c7a9a5554726241ca645f632529ebe617c8a11211482e65d08c5def33 |
| hovercard-subject-tag | issue:1186920656 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/cloudstack/6180/issue_layout |
| twitter:image | https://opengraph.githubassets.com/299fd95dd6dcecce9937d46856eac01310d2a0bfb26100854b598122bcb79e99/apache/cloudstack/issues/6180 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/299fd95dd6dcecce9937d46856eac01310d2a0bfb26100854b598122bcb79e99/apache/cloudstack/issues/6180 |
| og:image:alt | ISSUE TYPE Enhancement Request COMPONENT NAME CloudStack Agent CLOUDSTACK VERSION all SUMMARY The CloudStack Agent uses com.ceph.rados.* for many operations as when implementing the RBD storage poo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wido |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width