diff --git a/pkg/machines/actions/provider-actions.es6 b/pkg/machines/actions/provider-actions.es6
index 518979e0776e..9d9a1e61940f 100644
--- a/pkg/machines/actions/provider-actions.es6
+++ b/pkg/machines/actions/provider-actions.es6
@@ -29,6 +29,7 @@ import {
CREATE_AND_ATTACH_VOLUME,
CREATE_VM,
DELETE_VM,
+ DETACH_DISK,
ENABLE_LIBVIRT,
FORCEOFF_VM,
FORCEREBOOT_VM,
@@ -79,6 +80,10 @@ export function deleteVm(vm, options) {
return virt(DELETE_VM, { name: vm.name, id: vm.id, connectionName: vm.connectionName, options: options });
}
+export function detachDisk({ connectionName, target, name, id, live = false }) {
+ return virt(DETACH_DISK, { connectionName, target, name, id, live });
+}
+
export function enableLibvirt(enable, serviceName) {
return virt(ENABLE_LIBVIRT, { enable, serviceName });
}
diff --git a/pkg/machines/components/diskRemove.jsx b/pkg/machines/components/diskRemove.jsx
new file mode 100644
index 000000000000..42a680414de2
--- /dev/null
+++ b/pkg/machines/components/diskRemove.jsx
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Cockpit.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * Cockpit is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * Cockpit is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Cockpit; If not, see .
+ */
+import React from 'react';
+
+import { detachDisk } from '../actions/provider-actions.es6';
+
+const onDetachDisk = (dispatch, vm, target) => {
+ return () => {
+ dispatch(detachDisk({ connectionName:vm.connectionName, id:vm.id, name:vm.name, target, live: vm.state == 'running' }));
+ };
+};
+
+const RemoveDiskAction = ({ dispatch, vm, target, idPrefixRow }) => {
+ return (
+
+ );
+};
+
+export default RemoveDiskAction;
diff --git a/pkg/machines/components/vmDisksTab.jsx b/pkg/machines/components/vmDisksTab.jsx
index 84a7d6398fc3..cdb32915e5ef 100644
--- a/pkg/machines/components/vmDisksTab.jsx
+++ b/pkg/machines/components/vmDisksTab.jsx
@@ -23,6 +23,7 @@ import cockpit from 'cockpit';
import { Listing, ListingRow } from 'cockpit-components-listing.jsx';
import { Info } from './notification/inlineNotification.jsx';
import { convertToUnit, toReadableNumber, units } from "../helpers.es6";
+import RemoveDiskAction from './diskRemove.jsx';
const _ = cockpit.gettext;
@@ -54,7 +55,7 @@ const VmDiskCell = ({ value, id }) => {
);
};
-const VmDisksTab = ({ idPrefix, disks, actions, renderCapacity, notificationText }) => {
+const VmDisksTab = ({ idPrefix, vm, disks, actions, renderCapacity, notificationText, dispatch, provider }) => {
let notification = null;
const columnTitles = [_("Device"), _("Target")];
let renderCapacityUsed, renderReadOnly;
@@ -106,6 +107,17 @@ const VmDisksTab = ({ idPrefix, disks, actions, renderCapacity, notificationText
}
columns.push(disk.diskSourceCell);
+
+ if (provider === 'LibvirtDBus') {
+ const removeDiskAction = RemoveDiskAction({
+ dispatch,
+ vm,
+ target: disk.target,
+ idPrefixRow,
+ });
+ columns.push(