public void DeleteSnapshot() { Identity identity = new Identity() { AuthEndpoint = "http://192.168.1.149:5000/v2.0", Password = "******", TenantName = "admin", Username = "******", }; InstanceManager instanceManager = new InstanceManager(identity); var firstInstaceId = "a9a8ba2c-fc26-4ecc-8419-ca9b7cf326a2"; var snapshotName = instanceManager.CreateSnapshot(firstInstaceId, (x) => { return(true); }); ImageManager imageManager = new ImageManager(identity); OpenstackImage image = imageManager.GetImage(new OpenstackImage() { Name = snapshotName }); Assert.AreNotSame(image, null); imageManager.Delete(image.Id); image = imageManager.GetImage(new OpenstackImage() { Name = snapshotName }); Assert.AreEqual(image, null); }
public void DownloadSnapshot() { Identity identity = new Identity() { AuthEndpoint = "http://192.168.1.118:5000/v2.0", Password = "******", TenantName = "admin", Username = "******", }; InstanceManager instanceManager = new InstanceManager(identity); var firstInstaceId = "f71e50ab-cf33-4491-b6f4-8887b29b2c22"; var snapshotName = instanceManager.CreateSnapshot(firstInstaceId, (x) => { return(true); }); ImageManager imageManager = new ImageManager(identity); OpenstackImage image = imageManager.GetImage(new OpenstackImage() { Name = snapshotName }); Assert.AreNotSame(image, null); image = imageManager.GetImage(image.Id); imageManager.DownloadImage(image.Id, @"E:\\AtlasVHDS\\" + image.Name + "." + image.DiskFormat); imageManager.Delete(image.Id); image = imageManager.GetImage(new OpenstackImage() { Name = snapshotName }); Assert.AreEqual(image, null); }
public void UploadImage() { string path = @"E:\AtlasVHDS\Snapshot-8e2f.ami"; FileInfo image = new FileInfo(path); Identity identity = new Identity() { AuthEndpoint = "http://192.168.1.149:5000/v2.0", Password = "******", TenantName = "admin", Username = "******", }; ImageManager imageManager = new ImageManager(identity); OpenstackImage img = new OpenstackImage() { Name = "Test" + Guid.NewGuid().ToString().Substring(0, 4), DiskFormat = image.Extension, Size = image.Length, }; OpenstackImage obj = imageManager.UploadImage(image); }
public void CreateSnapshot() { Identity identity = new Identity() { AuthEndpoint = "http://192.168.1.149:5000/v2.0", Password = "******", TenantName = "admin", Username = "******", }; InstanceManager instanceManager = new InstanceManager(identity); var firstInstaceId = instanceManager.ListInstances(identity)[0].Id; var snapshotName = instanceManager.CreateSnapshot(firstInstaceId, (x) => { return(true); }); ImageManager imageManager = new ImageManager(identity); OpenstackImage image = imageManager.GetImage(new OpenstackImage() { Name = snapshotName }); Assert.AreNotSame(image, null); }