[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[Ovirt-devel] [PATCH server] Refines the validation for an NFS URL for Cobbler images.
- From: "Darryl L. Pierce" <dpierce redhat com>
- To: ovirt-devel redhat com
- Cc:
- Subject: [Ovirt-devel] [PATCH server] Refines the validation for an NFS URL for Cobbler images.
- Date: Mon, 22 Dec 2008 10:14:26 -0500
If the URL contains a : after the hostname but no port, then it is
ignored. However, if there is no protocol specified and no port supplied
then an exception is raised.
For now, however, we do not use the port if it's included and use the
default NFS port regardless.
Signed-off-by: Darryl L. Pierce <dpierce redhat com>
---
src/task-omatic/task_vm.rb | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb
index c187287..345bde5 100644
--- a/src/task-omatic/task_vm.rb
+++ b/src/task-omatic/task_vm.rb
@@ -369,7 +369,7 @@ def start_vm(task)
# extract the components of the image filename
image_uri = details.file
- protocol = auth = ip_addr = export_path = filename = ""
+ protocol = auth = ip_addr = port = export_path = filename = ""
protocol, image_uri = image_uri.split("://") if image_uri.include?("://")
auth, image_uri = image_uri.split("@") if image_uri.include?("@")
@@ -377,9 +377,14 @@ def start_vm(task)
# result here, so we'll just ignore it
ignored, ip_addr, image_uri =
image_uri.split(/^([^\/]+)(\/.*)/) unless image_uri =~ /^\//
+ # we extract the port even though we currently do not make use of it
+ ip_addr, port = ip_addr.split(":") if ip_addr.include?(":")
+ port = "" if !port
ignored, export_path, filename =
image_uri.split(/^(.*)\/(.+)/)
+ raise "Invalid image URL specified" if ip_addr && port.empty? && protocol.empty?
+
found = false
vm.storage_volumes.each do |volume|
--
1.6.0.6
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]