[Kimchi-devel] [PATCH] [Kimchi 1/3] Add support to create netboot templates.
pvital at linux.vnet.ibm.com
pvital at linux.vnet.ibm.com
Mon Apr 18 19:21:53 UTC 2016
From: Paulo Vital <pvital at linux.vnet.ibm.com>
Changed API.json and model to accept 'netboot' as source media parameter while
creating a new template.
Now, when creating a new template and specifying 'netboot' as source media
parameter, it is assumed the template will use netboot process -
PXE/DHCP/TFTP/(NFS/HTTP/FTP).
This is part of solution to Issue #372.
Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
API.json | 4 ++--
model/templates.py | 11 ++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/API.json b/API.json
index ff505b1..2926620 100644
--- a/API.json
+++ b/API.json
@@ -469,9 +469,9 @@
},
"memory": { "$ref": "#/kimchitype/memory" },
"source_media": {
- "description": "Path for installation media (ISO, disk, remote ISO)",
+ "description": "Path for installation media (ISO, disk, remote ISO) or netboot",
"type" : "string",
- "pattern" : "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
+ "pattern" : "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$|(netboot)",
"required": true
},
"disks": {
diff --git a/model/templates.py b/model/templates.py
index a02099c..043fe49 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -65,6 +65,12 @@ class TemplatesModel(object):
# get source_media
path = params.pop("source_media")
+ # Check if source_media is 'netboot'
+ if path == 'netboot':
+ params['os_distro'] = 'unknown'
+ params['os_version'] = 'unknown'
+ return self.save_template(params)
+
# not local image: set as remote ISO
if urlparse.urlparse(path).scheme in ["http", "https", "tftp", "ftp",
"ftps"]:
@@ -104,7 +110,10 @@ class TemplatesModel(object):
def save_template(self, params):
# Creates the template class with necessary information
- t = LibvirtVMTemplate(params, scan=True, conn=self.conn)
+ if 'cdrom' not in params.keys():
+ t = LibvirtVMTemplate(params, conn=self.conn)
+ else:
+ t = LibvirtVMTemplate(params, scan=True, conn=self.conn)
# Validate cpu info
t.cpuinfo_validate()
--
2.5.5
More information about the Kimchi-devel
mailing list