您的位置:首页 > 运维架构

[OpenStack]openstack4j里的ServerService API

2016-06-17 17:52 330 查看

Server query

List<? extends Server> org.openstack4j.api.compute.ServerService.list()

List all servers (detailed) that the current tenant has access to
Returns:

          list of all servers

List<? extends Server> org.openstack4j.api.compute.ServerService.list(boolean detail)

List all servers (detailed / brief) that the current tenant has access to
Parameters:

          detail
if true all attributes will be populated, false (brief) will be ID, Name and Links
Returns:

          list of all servers

List<? extends Server> org.openstack4j.api.compute.ServerService.list(Map filteringParams)

Returns list of servers filtered by parameters.
Parameters:

          filteringParams
map (name, value) of filtering parameters
Returns:

          list of all servers

List<? extends Server> org.openstack4j.api.compute.ServerService.listAll(boolean detail)

List all servers for all tenants (detailed / brief)
Parameters:

          detail
if true all attributes will be populated, false (brief) will be ID, Name and Links
Returns:

          list of all servers

Server org.openstack4j.api.compute.ServerService.get(String serverId)

Get the specified server by ID
Parameters:

          serverId
the server id
Returns:

          the server or null if not found

Server creation

Server org.openstack4j.api.compute.ServerService.boot(ServerCreate server)

Create (boot) a new Server
Parameters:

          server
the server to boot
Returns:

          the newly created server

Server org.openstack4j.api.compute.ServerService.bootAndWaitActive(ServerCreate server, int maxWaitTime)

Create (boot) a new Server
Parameters:

          server
the server to boot
          maxWaitTime the max time to wait in milliseconds for the server to become ACTIVE
Returns:

          the newly created server

Server actions

Delete, Restore

ActionResponse org.openstack4j.api.compute.ServerService.delete(String serverId)

Delete (i.e shut down and delete the image) of the server
Parameters:

          serverId
the server identifier
Returns:

          the action response

Reboot

ActionResponse org.openstack4j.api.compute.ServerService.reboot(String serverId, RebootType type)

Reboot a server by SOFT (software-level) or HARD (hardware power cycle)
Parameters:

          serverId
the server id

          type the type of reboot
Returns:

          the action response

Rebuild

ActionResponse org.openstack4j.api.compute.ServerService.rebuild(String serverId, RebuildOptions options)

Rebuilds the specified server
Parameters:

          serverId
the server id

          options additional options used during the rebuild. (OPTIONAL, can be null)
Returns:

          the action response

Evacuate

Resize, Confirm resize, Revert resize

ActionResponse org.openstack4j.api.compute.ServerService.resize(String serverId, String flavorId)

Resize a server's resources. Until a resize event is confirmed confirmResize(String), the old server will be kept around and you'll be able to roll back to the old flavor quick with revertResize(String). All resizes will be automatically confirmed after 24
hours.
Parameters:

          serverId
the server identifier

          flavorId the new flavor id to resize to
Returns:

          the action response

ActionResponse org.openstack4j.api.compute.ServerService.confirmResize(String serverId)

Confirm that the resize worked, thus removing the original server
Parameters:

          serverId
the server identifier
Returns:

          the action response

ActionResponse org.openstack4j.api.compute.ServerService.revertResize(String serverId)

Revert a previous resize, switching back to the old server
Parameters:

          serverId
the server identifier
Returns:

          the action response

Pause, Unpause

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.PAUSE)

Pause the server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.UNPAUSE)

UnPause the paused server

Suspend, Resume

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.SUSPEND)

Suspend a server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.RESUME)

Rescue the server

Snapshot

String org.openstack4j.api.compute.ServerService.createSnapshot(String serverId, String snapshotName)

Creates the snapshot for a Server
Parameters:

          serverId
the server id

          snapshotName the snapshot name
Returns:

          the newly created snapshot UUID

Backup

ActionResponse org.openstack4j.api.compute.ServerService.backupServer(String serverId, BackupOptions options)

Sets up a new backup schedule service for the given serverId
Parameters:

          serverId
the server identifier

          options the backup options
Returns:

          the action response

Start, Stop

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.START)

Start the server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.STOP)

Stop the server

Shelve, Shelve offload, Unshelve

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.SHELVE)

Shelve the server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.SHELVE_OFFLOAD)

Remove a shelved instance from the compute node

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.UNSHELVE)

Unshelve the server

Lock, Unlock

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.LOCK)

Lock the server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.UNLOCK)

Unlock a locked server

Rescue, Unrescue

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.RESCUE)

Rescue the server

ActionResponse org.openstack4j.api.compute.ServerService.action(String serverId, Action.UNRESCUE)

Unrescue the server

Set administrator password

ActionResponse org.openstack4j.api.compute.ServerService.changeAdminPassword(String serverId, String adminPassword)

Changes the admin/root password on the server
Parameters:

          serverId
the server identifier

          adminPassword the new password
Returns:

          the action response

Migrate, Live migrate

ActionResponse org.openstack4j.api.compute.ServerService.migrateServer(String serverId)

Only user with admin role can do this. Migrate a server. The new host will be selected by the scheduler. Until a resize event is confirmed confirmResize(String), the old server will be kept around and you'll be able to roll back to the old host quick with revertResize(String).
All resizes will be automatically confirmed after 24 hours.
Parameters:

          serverId
the server identifier
Returns:

          the action response

ActionResponse org.openstack4j.api.compute.ServerService.liveMigrate(String serverId, LiveMigrateOptions options)

Live-migrates a server identified with {@code serverId} to a new host without rebooting
Parameters:

          serverId
the server identifier

          options live migration options
Returns:

          the action response

Trigger crash dump

Server passwords

See Server creation and Set administrator password.

Server metadata

Map org.openstack4j.api.compute.ServerService.getMetadata(String serverId)

Returns the metadata for the specified server
Parameters:

          serverId
the server identifier
Returns:

          Map of metadata of key and value

Map org.openstack4j.api.compute.ServerService.updateMetadata(String serverId, Map metadata)

Creates or replaces metadata items for the specified server
Parameters:

          serverId
the server identifier

          metadata the metadata to create or update
Returns:

          Map of metadata as the current state on the server

ActionResponse org.openstack4j.api.compute.ServerService.deleteMetadataItem(String serverId, String key)

Removes the specified metadata item via the specified key and serverId
Parameters:

          serverId
the server identifier

          key the metadata key to remove
Returns:

          the action response

Server networks

See Server creation.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  OpenStack