diff --git a/share/man/onevm.1 b/share/man/onevm.1
index 5d6da7fc53..6903f85576 100644
--- a/share/man/onevm.1
+++ b/share/man/onevm.1
@@ -67,6 +67,8 @@
\-\-cache cache_mode Hypervisor cache mode: default, none,
writethrough, writeback, directsync or unsafe\.
(Only KVM driver)
+ \-\-discard discard_mode Hypervisor discard mode: ignore or unmap\.
+ (Only KVM driver)
\-n, \-\-network id|name Selects the virtual network
\-i, \-\-ip ip IP address for the new NIC
\-l, \-\-list x,y,z Selects columns to display with list command
@@ -370,7 +372,7 @@ disk\-attach \fIvmid\fR Attaches a disk to a running VM\. When using \-\-file ad
.nf
States: RUNNING
-valid options: file, image, target, cache
+valid options: file, image, target, cache, discard
.
.fi
.
diff --git a/src/cli/onevm b/src/cli/onevm
index 3109a80b9a..c96bbb01e1 100755
--- a/src/cli/onevm
+++ b/src/cli/onevm
@@ -79,6 +79,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
" writeback, directsync or unsafe. (Only KVM driver)"
}
+ DISCARD={
+ :name => "discard",
+ :large => "--discard discard_mode",
+ :format => String,
+ :description => "Hypervisor discard mode: ignore or unmap."<<
+ " (Only KVM driver)"
+ }
+
ENFORCE={
:name => "enforce",
:short => "-e",
@@ -590,7 +598,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :"disk-attach", disk_attach_desc, :vmid,
:options => [OneVMHelper::FILE, OneVMHelper::IMAGE,
- TARGET, CACHE, PREFIX] do
+ TARGET, CACHE, DISCARD, PREFIX] do
if options[:file].nil? and options[:image].nil?
STDERR.puts "Provide a template file or an image:"
@@ -618,6 +626,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
template<<", CACHE = \"#{options[:cache]}\""
end
+ if options[:discard]
+ template<<", DISCARD = \"#{options[:discard]}\""
+ end
+
template << " ]"
end
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs
index 0ad0f8ac69..9300d24324 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs
@@ -142,6 +142,17 @@
+
+
+
+