Merge branch 'Evan' into Eole
This commit is contained in:
commit
10fb56b935
1 changed files with 67 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
ini_set('display_errors', 1);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
require 'vendor/autoload.php';
|
||||
include("core/Image.php");
|
||||
|
||||
$options = Array();
|
||||
$options["user"] = Array("name"=>"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]);
|
||||
|
@ -15,7 +16,6 @@ $openstack = new OpenStack\OpenStack($options);
|
|||
// Since usernames will not be unique across an entire OpenStack installation,
|
||||
// when authenticating with them you must also provide your domain ID. You do
|
||||
// not have to do this if you authenticate with a user ID.
|
||||
|
||||
/*$token = $identity->generateToken([
|
||||
'user' => [
|
||||
'name' => 'admin',
|
||||
|
@ -26,11 +26,72 @@ $openstack = new OpenStack\OpenStack($options);
|
|||
]
|
||||
]);
|
||||
*/
|
||||
$compute = $openstack->computeV2(["region" => "RegionOne"]);
|
||||
//$compute = $openstack->computeV2(["region" => "RegionOne"]);
|
||||
//$image= $openstack->imagesV2(["region" => "RegionOne"]);
|
||||
//var_dump($compute->client);
|
||||
//$servers = $compute->listServers(true);
|
||||
|
||||
//foreach($servers as $server){
|
||||
// echo $server->id." !!! ";
|
||||
// echo $server->name." !!! ";
|
||||
//}
|
||||
// Initialisation Image()
|
||||
$optImage = Array();
|
||||
$optImage["region"] = "RegionOne";
|
||||
$image = new Image($openstack, $optImage);
|
||||
|
||||
$opt = Array();
|
||||
$opt['name'] = "Test";
|
||||
$opt['tags'] = ['test', 'openstack'];
|
||||
//$opt['containerFormat'] = 'ami';
|
||||
//$opt['diskFormat'] = 'iso';
|
||||
$opt['visibility'] = 'public';
|
||||
$opt['minDisk'] = 1;
|
||||
$opt['protected'] = false;
|
||||
$opt['minRam'] = 10;
|
||||
|
||||
//$new_image = $image->create_image($opt);
|
||||
|
||||
//Liste des images
|
||||
$images = $image->list_images();
|
||||
|
||||
echo "Images présentes :";
|
||||
echo "</br>";
|
||||
|
||||
foreach($images as $i){
|
||||
echo $i->name;
|
||||
if($i->name == "Test"){
|
||||
$id_image = $i->id;
|
||||
$list = $i->tags;
|
||||
echo $i->status;
|
||||
}
|
||||
echo "</br>";
|
||||
}
|
||||
echo "</br>";
|
||||
|
||||
if(isset($list)){
|
||||
foreach ($list as $l) {
|
||||
echo $l;
|
||||
echo "</br>";
|
||||
}
|
||||
}
|
||||
|
||||
// Détails Image
|
||||
//$details = $image->image_details($id_image);
|
||||
|
||||
//$image->delete_image('123456');
|
||||
|
||||
//$image->desactivate_image($id_image);
|
||||
//$image->reactivate_image($id_image);
|
||||
|
||||
//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
|
||||
//$image->upload_image($id_image, $file_name);
|
||||
|
||||
//$image->download_image($id_image);
|
||||
|
||||
/*
|
||||
$opt_update = Array();
|
||||
$opt_update['name'] = "Test";
|
||||
$opt_update['tags'] = null;
|
||||
|
||||
$update = $image->update_image($id_image, $opt_update);
|
||||
echo $update->name;
|
||||
*/
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue