From 8ad2a0aacd280ec29a6b53e7663b968068f89ab9 Mon Sep 17 00:00:00 2001 From: "yogg@epsina.com" Date: Sun, 31 Jan 2016 19:48:30 +0100 Subject: Modification of options for create_image --- server/core/Image.php | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'server/core') diff --git a/server/core/Image.php b/server/core/Image.php index a986a40..37efa9d 100644 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -1,7 +1,6 @@ oidentity->createImage([ - 'name' => $opt['name'], - //'tags' => $opt['tag'], // A VOIR COMMENT CA MARCHE - 'containerFormat' => $opt['containerFormat'], - 'diskFormat' => $opt['diskFormat'], - 'visibility' => $opt['visibility'], - 'minDisk' => $opt['minDisk'], - 'protected' => $opt['protected'], - 'minRam' => $opt['minRam'], - ]); + // VOIR SI MAUVAIS TYPE + $options = Array(); + if(array_key_exists('name', $opt)){ // string, rendre le nom obligatoire + $options['name'] = $opt['name']; + } + if(array_key_exists('id', $opt)){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn + $options['id'] = $opt['id']; + } + if(array_key_exists('visibility', $opt)){ // public, private + $options['visibility'] = $opt['visibility']; + } + if(array_key_exists('tags', $opt)){ // list + $options['tags'] = $opt['tags']; + } + if(array_key_exists('containerFormat', $opt)){ // string : ami, ari, aki, bare, ovf, ova, docker + $options['containerFormat'] = $opt['containerFormat']; + } + if(array_key_exists('diskFormat', $opt)){ // string : ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, iso + $options['diskFormat'] = $opt['diskFormat']; + } + if(array_key_exists('minDisk', $opt)){ //int + $options['minDisk'] = $opt['minDisk']; + } + if(array_key_exists('minRam', $opt)){ // int + $options['minRam'] = $opt['minRam']; + } + if(array_key_exists('protected', $opt)){ // boolean + $options['protected'] = $opt['protected']; + } + if(array_key_exists('properties', $opt)){ // type dict ? + $options['properties'] = $opt['properties']; + } + + $image = $this->oidentity->createImage($options); return $image; } -- cgit v1.2.3