Merge branch 'master' into test-merge-api

Conflicts:
	api/src/com/cloud/agent/api/BackupSnapshotCommand.java
	api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
	api/src/com/cloud/agent/api/to/PortForwardingRuleTO.java
	api/src/com/cloud/network/NetworkService.java
	api/src/com/cloud/resource/ResourceService.java
	api/src/org/apache/cloudstack/api/ApiConstants.java
	api/src/org/apache/cloudstack/api/ResponseGenerator.java
	api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
	client/tomcatconf/commands.properties.in
	core/src/com/cloud/storage/SnapshotVO.java
	pom.xml
	server/src/com/cloud/api/ApiDispatcher.java
	server/src/com/cloud/api/ApiResponseHelper.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java
	server/src/com/cloud/network/NetworkManagerImpl.java
	server/src/com/cloud/network/rules/RulesManagerImpl.java
	server/src/com/cloud/offerings/NetworkOfferingVO.java
	server/src/com/cloud/resource/ResourceManagerImpl.java
	server/src/com/cloud/upgrade/dao/Upgrade40to41.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	server/test/com/cloud/vpc/MockNetworkManagerImpl.java
	setup/db/create-schema.sql
	setup/db/db/schema-40to410.sql

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-12-23 13:54:46 -08:00
commit 296b49c2f8
404 changed files with 22078 additions and 8076 deletions

2
.gitignore vendored
View File

@ -67,8 +67,10 @@ awsapi/modules/*
.settings/
db.properties.override
awsapi/overlays/
tools/marvin/marvin/cloudstackAPI/*
*.egg-info/
docs/tmp
docs/publish
docs/runbook/tmp
docs/runbook/publish
Gemfile.lock

3824
LICENSE

File diff suppressed because it is too large Load Diff

146
NOTICE
View File

@ -6,9 +6,84 @@
This distribution contains third party resources requiring the following notices:
Source code distribution if this software contains third party resources requiring
the following notices:
For
jquery.md5.js
jQuery MD5 Plugin 1.2.1
https://github.com/blueimp/jQuery-MD5
Copyright 2010, Sebastian Tschan
https://blueimp.net
Licensed under the MIT license:
http://creativecommons.org/licenses/MIT/
Based on
A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
Digest Algorithm, as defined in RFC 1321.
Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
Distributed under the BSD License
See http://pajhome.org.uk/crypt/md5 for more info.
For
jquery.js
jQuery JavaScript Library v1.3.2
http://jquery.com/
Copyright (c) 2009 John Resig
Dual licensed under the MIT and GPL licenses.
http://docs.jquery.com/License
Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
Revision: 6246
For
jquery.js
jQuery JavaScript Library v1.6.1
http://jquery.com/
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
http://sizzlejs.com/
Copyright 2011, The Dojo Foundation
Released under the MIT, BSD, and GPL Licenses.
Date: Thu May 12 15:04:36 2011 -0400
For
jquery.colorhelpers.js
Plugin for jQuery for working with colors.
Version 1.1.
Inspiration from jQuery color animation plugin by John Resig.
Released under the MIT license by Ole Laursen, October 2009.
********************************************************************************
Binary or packaged versions of this software (including versions built from source)
contains third party resources requiring the following notices:
For
cloud-ejb-api-3.0.jar
cloud-email.jar
@ -337,28 +412,6 @@
without prior written authorization of the copyright holder.
For
jquery.md5.js
jQuery MD5 Plugin 1.2.1
https://github.com/blueimp/jQuery-MD5
Copyright 2010, Sebastian Tschan
https://blueimp.net
Licensed under the MIT license:
http://creativecommons.org/licenses/MIT/
Based on
A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
Digest Algorithm, as defined in RFC 1321.
Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
Distributed under the BSD License
See http://pajhome.org.uk/crypt/md5 for more info.
For
XmlSchema-1.4.3.jar
@ -430,21 +483,6 @@
THE SOFTWARE.
For
jquery.js
jQuery JavaScript Library v1.3.2
http://jquery.com/
Copyright (c) 2009 John Resig
Dual licensed under the MIT and GPL licenses.
http://docs.jquery.com/License
Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
Revision: 6246
For
axis2-1.5.1.jar
axis2-adb-1.5.1.jar
@ -532,25 +570,6 @@
--------------------------------------------------------------------------------
For
jquery.js
jQuery JavaScript Library v1.6.1
http://jquery.com/
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
http://sizzlejs.com/
Copyright 2011, The Dojo Foundation
Released under the MIT, BSD, and GPL Licenses.
Date: Thu May 12 15:04:36 2011 -0400
For
rampart-lib
@ -588,19 +607,6 @@
software copyright (c) 1999.
For
jquery.colorhelpers.js
Plugin for jQuery for working with colors.
Version 1.1.
Inspiration from jQuery color animation plugin by John Resig.
Released under the MIT license by Ole Laursen, October 2009.
For
woden-api-1.0M8.jar
woden-impl-dom-1.0M8.jar

View File

@ -231,6 +231,7 @@ public class AgentShell implements IAgentShell {
int response;
response = client.executeMethod(method);
if (response != HttpURLConnection.HTTP_OK) {
method.releaseConnection();
s_logger.warn("Retrieving from " + url + " gives response code: "
+ response);
throw new CloudRuntimeException("Unable to download from " + url
@ -253,6 +254,7 @@ public class AgentShell implements IAgentShell {
s_logger.warn("Exception while closing download stream from "
+ url + ", ", e);
}
method.releaseConnection();
}
private void loadProperties() throws ConfigurationException {

View File

@ -17,6 +17,7 @@
package com.cloud.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.agent.api.to.SwiftTO;
import com.cloud.storage.StoragePool;
@ -32,6 +33,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
private Long snapshotId;
@LogLevel(Log4jLevel.Off)
private SwiftTO swift;
private S3TO s3;
StorageFilerTO pool;
protected BackupSnapshotCommand() {
@ -48,8 +50,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
* @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
* @param isVolumeInactive True if the volume belongs to a VM that is not running or is detached.
*/
public BackupSnapshotCommand(String primaryStoragePoolNameLabel,
String secondaryStoragePoolURL,
public BackupSnapshotCommand(String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
@ -64,13 +65,12 @@ public class BackupSnapshotCommand extends SnapshotCommand {
String vmName,
int wait)
{
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
this.snapshotId = snapshotId;
this.prevSnapshotUuid = prevSnapshotUuid;
this.prevBackupUuid = prevBackupUuid;
this.isVolumeInactive = isVolumeInactive;
this.vmName = vmName;
this.pool = new StorageFilerTO(pool);
setVolumePath(volumePath);
setWait(wait);
}
@ -88,7 +88,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
}
public String getVmName() {
return vmName;
return vmName;
}
public SwiftTO getSwift() {
@ -99,6 +99,14 @@ public class BackupSnapshotCommand extends SnapshotCommand {
this.swift = swift;
}
public S3TO getS3() {
return s3;
}
public void setS3(S3TO s3) {
this.s3 = s3;
}
public Long getSnapshotId() {
return snapshotId;
}

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
@ -40,7 +42,8 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
* It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
* @param origTemplateInstallPath The install path of the original template VHD on the secondary
*/
public CreatePrivateTemplateFromSnapshotCommand(String primaryStoragePoolNameLabel,
public CreatePrivateTemplateFromSnapshotCommand(StoragePool pool,
String secondaryStoragePoolURL,
Long dcId,
Long accountId,
@ -52,7 +55,7 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
String templateName,
int wait)
{
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
this.origTemplateInstallPath = origTemplateInstallPath;
this.newTemplateId = newTemplateId;
this.templateName = templateName;

View File

@ -16,6 +16,9 @@
// under the License.
package com.cloud.agent.api;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
private String _vmName;
private String _volumePath;
@ -23,13 +26,14 @@ public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
private String _uniqueName;
private long _templateId;
private long _accountId;
StorageFilerTO _primaryPool;
// For XenServer
private String _secondaryStorageUrl;
public CreatePrivateTemplateFromVolumeCommand() {
}
public CreatePrivateTemplateFromVolumeCommand(String StoragePoolUUID, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) {
public CreatePrivateTemplateFromVolumeCommand(StoragePool pool, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) {
_secondaryStorageUrl = secondaryStorageUrl;
_templateId = templateId;
_accountId = accountId;
@ -37,7 +41,8 @@ public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
_uniqueName = uniqueName;
_volumePath = volumePath;
_vmName = vmName;
primaryStoragePoolNameLabel = StoragePoolUUID;
primaryStoragePoolNameLabel = pool.getUuid();
_primaryPool = new StorageFilerTO(pool);
setWait(wait);
}
@ -46,6 +51,10 @@ public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
return false;
}
public StorageFilerTO getPool() {
return _primaryPool;
}
public String getSecondaryStorageUrl() {
return _secondaryStorageUrl;
}

View File

@ -16,6 +16,8 @@
// under the License.
package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
@ -39,7 +41,8 @@ public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
* It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
* @param templatePath The install path of the template VHD on the secondary, if this a root volume
*/
public CreateVolumeFromSnapshotCommand(String primaryStoragePoolNameLabel,
public CreateVolumeFromSnapshotCommand(StoragePool pool,
String secondaryStoragePoolURL,
Long dcId,
Long accountId,
@ -48,7 +51,7 @@ public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
String backedUpSnapshotName,
int wait)
{
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
setWait(wait);
}
}

View File

@ -17,6 +17,7 @@
package com.cloud.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.SwiftTO;
/**
@ -26,6 +27,7 @@ import com.cloud.agent.api.to.SwiftTO;
public class DeleteSnapshotBackupCommand extends SnapshotCommand {
@LogLevel(Log4jLevel.Off)
private SwiftTO swift;
private S3TO s3;
private Boolean all;
public SwiftTO getSwift() {
@ -44,6 +46,10 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
this.swift = swift;
}
public S3TO getS3() {
return s3;
}
protected DeleteSnapshotBackupCommand() {
}
@ -73,6 +79,7 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
* @param childUUID The child VHD file of the backup whose parent is reset to its grandparent.
*/
public DeleteSnapshotBackupCommand(SwiftTO swift,
S3TO s3,
String secondaryStoragePoolURL,
Long dcId,
Long accountId,
@ -81,6 +88,7 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
{
super(null, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
setSwift(swift);
this.s3 = s3;
setAll(all);
}
}

View File

@ -0,0 +1,106 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.agent.api;
import com.cloud.agent.api.to.S3TO;
public class DeleteTemplateFromS3Command extends Command {
private S3TO s3;
private Long templateId;
private Long accountId;
protected DeleteTemplateFromS3Command() {
super();
}
public DeleteTemplateFromS3Command(final S3TO s3, final Long accountId,
final Long templateId) {
super();
this.s3 = s3;
this.accountId = accountId;
this.templateId = templateId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((accountId == null) ? 0 : accountId.hashCode());
result = prime * result + ((s3 == null) ? 0 : s3.hashCode());
result = prime * result
+ ((templateId == null) ? 0 : templateId.hashCode());
return result;
}
@Override
public boolean equals(Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null) {
return false;
}
if (getClass() != thatObject.getClass()) {
return false;
}
final DeleteTemplateFromS3Command thatCommand = (DeleteTemplateFromS3Command) thatObject;
if (!(accountId == thatCommand.accountId)
|| (this.accountId != null && this.accountId
.equals(thatCommand.accountId))) {
return false;
}
if (!(templateId == thatCommand.templateId)
|| (this.templateId != null && this.templateId
.equals(thatCommand.templateId))) {
return false;
}
return true;
}
public S3TO getS3() {
return s3;
}
public Long getTemplateId() {
return templateId;
}
public Long getAccountId() {
return accountId;
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.agent.api;
import com.cloud.agent.api.to.S3TO;
public class DownloadSnapshotFromS3Command extends SnapshotCommand {
private S3TO s3;
private String parent;
protected DownloadSnapshotFromS3Command() {
super();
}
public DownloadSnapshotFromS3Command(S3TO s3, String parent,
String secondaryStorageUrl, Long dcId, Long accountId,
Long volumeId, String backupUuid, int wait) {
super(null, secondaryStorageUrl, backupUuid, "", dcId, accountId,
volumeId);
this.s3 = s3;
this.parent = parent;
setWait(wait);
}
public S3TO getS3() {
return s3;
}
public void setS3(S3TO s3) {
this.s3 = s3;
}
public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
}

View File

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.agent.api;
import com.cloud.agent.api.to.S3TO;
public final class DownloadTemplateFromS3ToSecondaryStorageCommand extends Command {
private final S3TO s3;
private final Long accountId;
private final Long templateId;
private final String storagePath;
public DownloadTemplateFromS3ToSecondaryStorageCommand(final S3TO s3,
final Long accountId, final Long templateId,
final String storagePath, final int wait) {
super();
this.s3 = s3;
this.accountId = accountId;
this.templateId = templateId;
this.storagePath = storagePath;
setWait(wait);
}
public S3TO getS3() {
return this.s3;
}
public Long getAccountId() {
return this.accountId;
}
public Long getTemplateId() {
return this.templateId;
}
public String getStoragePath() {
return this.storagePath;
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -16,12 +16,16 @@
// under the License.
package com.cloud.agent.api;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on
* the XenServer.
*/
public class SnapshotCommand extends Command {
protected String primaryStoragePoolNameLabel;
StorageFilerTO primaryPool;
private String snapshotUuid;
private String snapshotName;
private String secondaryStorageUrl;
@ -46,10 +50,11 @@ public class SnapshotCommand extends Command {
* is the value of that field If you have better ideas on how to
* get it, you are welcome.
*/
public SnapshotCommand(String primaryStoragePoolNameLabel,
public SnapshotCommand(StoragePool pool,
String secondaryStorageUrl, String snapshotUuid,
String snapshotName, Long dcId, Long accountId, Long volumeId) {
this.primaryStoragePoolNameLabel = primaryStoragePoolNameLabel;
this.primaryStoragePoolNameLabel = pool.getUuid();
this.primaryPool = new StorageFilerTO(pool);
this.snapshotUuid = snapshotUuid;
this.secondaryStorageUrl = secondaryStorageUrl;
this.dcId = dcId;
@ -65,6 +70,13 @@ public class SnapshotCommand extends Command {
return primaryStoragePoolNameLabel;
}
/**
* @return the primaryPool
*/
public StorageFilerTO getPool() {
return primaryPool;
}
/**
* @return the snapshotUuid
*/

View File

@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
public class UpgradeSnapshotCommand extends SnapshotCommand {
private String version;
private Long templateId;
@ -30,7 +32,7 @@ public class UpgradeSnapshotCommand extends SnapshotCommand {
* @param snapshotUuid The UUID of the snapshot which is going to be upgraded
* @param _version version for this snapshot
*/
public UpgradeSnapshotCommand(String primaryStoragePoolNameLabel,
public UpgradeSnapshotCommand(StoragePool pool,
String secondaryStoragePoolURL,
Long dcId,
Long accountId,
@ -42,7 +44,7 @@ public class UpgradeSnapshotCommand extends SnapshotCommand {
String snapshotName,
String version)
{
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
this.version = version;
this.templateId = templateId;
this.tmpltAccountId = tmpltAccountId;

View File

@ -0,0 +1,121 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.agent.api;
import com.cloud.agent.api.to.S3TO;
public class UploadTemplateToS3FromSecondaryStorageCommand extends Command {
private final S3TO s3;
private final String storagePath;
private final Long dataCenterId;
private final Long accountId;
private final Long templateId;
public UploadTemplateToS3FromSecondaryStorageCommand(final S3TO s3,
final String storagePath, final Long dataCenterId, final Long accountId,
final Long templateId) {
super();
this.s3 = s3;
this.storagePath = storagePath;
this.dataCenterId = dataCenterId;
this.accountId = accountId;
this.templateId = templateId;
}
@Override
public boolean executeInSequence() {
return false;
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final UploadTemplateToS3FromSecondaryStorageCommand thatCommand =
(UploadTemplateToS3FromSecondaryStorageCommand) thatObject;
if (this.accountId != null ? !this.accountId.equals(thatCommand
.accountId) : thatCommand.accountId != null) {
return false;
}
if (this.dataCenterId != null ? !this.dataCenterId.equals(thatCommand
.dataCenterId) : thatCommand.dataCenterId != null) {
return false;
}
if (this.s3 != null ? !this.s3.equals(thatCommand.s3) : thatCommand.s3 != null) {
return false;
}
if (this.storagePath != null ? !this.storagePath.equals(thatCommand
.storagePath) : thatCommand.storagePath != null) {
return false;
}
if (this.templateId != null ? !this.templateId.equals(thatCommand.templateId) :
thatCommand.templateId != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.s3 != null ? this.s3.hashCode() : 0;
result = 31 * result + (this.storagePath != null ? this.storagePath.hashCode() : 0);
result = 31 * result + (this.dataCenterId != null ? this.dataCenterId.hashCode() : 0);
result = 31 * result + (this.accountId != null ? this.accountId.hashCode() : 0);
result = 31 * result + (this.templateId != null ? this.templateId.hashCode() : 0);
return result;
}
public S3TO getS3() {
return this.s3;
}
public String getStoragePath() {
return this.storagePath;
}
public Long getDataCenterId() {
return this.dataCenterId;
}
public Long getAccountId() {
return this.accountId;
}
public Long getTemplateId() {
return this.templateId;
}
}

View File

@ -34,7 +34,7 @@ public class downloadSnapshotFromSwiftCommand extends SnapshotCommand {
public downloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
super("", secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
setParent(parent);
setSwift(swift);
setWait(wait);

View File

@ -17,7 +17,8 @@
package com.cloud.agent.api.storage;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
/**
*
@ -27,16 +28,19 @@ public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
String poolUuid;
long poolId;
StorageFilerTO primaryPool;
String secondaryStorageUrl;
String primaryStorageUrl;
protected PrimaryStorageDownloadCommand() {
}
public PrimaryStorageDownloadCommand(String name, String url, ImageFormat format, long accountId, long poolId, String poolUuid, int wait) {
public PrimaryStorageDownloadCommand(String name, String url, ImageFormat format, long accountId, StoragePool pool, int wait) {
super(name, url, format, accountId);
this.poolId = poolId;
this.poolUuid = poolUuid;
this.poolId = pool.getId();
this.poolUuid = pool.getUuid();
this.primaryPool = new StorageFilerTO(pool);
setWait(wait);
}
@ -48,6 +52,10 @@ public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
return poolId;
}
public StorageFilerTO getPool() {
return primaryPool;
}
public void setLocalPath(String path) {
this.localPath = path;
}

View File

@ -39,8 +39,8 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
this.dstPortRange = new int[] { rule.getDestinationPortStart(), rule.getDestinationPortEnd() };
}
protected PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol, boolean revoked, boolean brandNew) {
super(id, srcIp,null, protocol, srcPortStart, srcPortEnd, revoked, brandNew, FirewallRule.Purpose.PortForwarding, null,0,0);
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol, boolean revoked, boolean alreadyAdded) {
super(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.PortForwarding, null,0,0);
this.dstIp = dstIp;
this.dstPortRange = new int[] { dstPortStart, dstPortEnd };
}

View File

@ -0,0 +1,252 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.to;
import com.cloud.utils.S3Utils;
import java.util.Date;
public final class S3TO implements S3Utils.ClientOptions {
private Long id;
private String uuid;
private String accessKey;
private String secretKey;
private String endPoint;
private String bucketName;
private Boolean httpsFlag;
private Integer connectionTimeout;
private Integer maxErrorRetry;
private Integer socketTimeout;
private Date created;
public S3TO() {
super();
}
public S3TO(final Long id, final String uuid, final String accessKey,
final String secretKey, final String endPoint,
final String bucketName, final Boolean httpsFlag,
final Integer connectionTimeout, final Integer maxErrorRetry,
final Integer socketTimeout, final Date created) {
super();
this.id = id;
this.uuid = uuid;
this.accessKey = accessKey;
this.secretKey = secretKey;
this.endPoint = endPoint;
this.bucketName = bucketName;
this.httpsFlag = httpsFlag;
this.connectionTimeout = connectionTimeout;
this.maxErrorRetry = maxErrorRetry;
this.socketTimeout = socketTimeout;
this.created = created;
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject)
return true;
if (thatObject == null || getClass() != thatObject.getClass())
return false;
final S3TO thatS3TO = (S3TO) thatObject;
if (httpsFlag != null ? !httpsFlag.equals(thatS3TO.httpsFlag)
: thatS3TO.httpsFlag != null) {
return false;
}
if (accessKey != null ? !accessKey.equals(thatS3TO.accessKey)
: thatS3TO.accessKey != null) {
return false;
}
if (connectionTimeout != null ? !connectionTimeout
.equals(thatS3TO.connectionTimeout)
: thatS3TO.connectionTimeout != null) {
return false;
}
if (endPoint != null ? !endPoint.equals(thatS3TO.endPoint)
: thatS3TO.endPoint != null) {
return false;
}
if (id != null ? !id.equals(thatS3TO.id) : thatS3TO.id != null) {
return false;
}
if (uuid != null ? !uuid.equals(thatS3TO.uuid) : thatS3TO.uuid != null) {
return false;
}
if (maxErrorRetry != null ? !maxErrorRetry
.equals(thatS3TO.maxErrorRetry)
: thatS3TO.maxErrorRetry != null) {
return false;
}
if (secretKey != null ? !secretKey.equals(thatS3TO.secretKey)
: thatS3TO.secretKey != null) {
return false;
}
if (socketTimeout != null ? !socketTimeout
.equals(thatS3TO.socketTimeout)
: thatS3TO.socketTimeout != null) {
return false;
}
if (bucketName != null ? !bucketName.equals(thatS3TO.bucketName)
: thatS3TO.bucketName != null) {
return false;
}
if (created != null ? !created.equals(thatS3TO.created)
: thatS3TO.created != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (accessKey != null ? accessKey.hashCode() : 0);
result = 31 * result + (secretKey != null ? secretKey.hashCode() : 0);
result = 31 * result + (endPoint != null ? endPoint.hashCode() : 0);
result = 31 * result + (bucketName != null ? bucketName.hashCode() : 0);
result = 31 * result + (httpsFlag ? 1 : 0);
result = 31
* result
+ (connectionTimeout != null ? connectionTimeout.hashCode() : 0);
result = 31 * result
+ (maxErrorRetry != null ? maxErrorRetry.hashCode() : 0);
result = 31 * result
+ (socketTimeout != null ? socketTimeout.hashCode() : 0);
return result;
}
public Long getId() {
return this.id;
}
public void setId(final Long id) {
this.id = id;
}
public String getUuid() {
return this.uuid;
}
public void setUuid(final String uuid) {
this.uuid = uuid;
}
@Override
public String getAccessKey() {
return this.accessKey;
}
public void setAccessKey(final String accessKey) {
this.accessKey = accessKey;
}
@Override
public String getSecretKey() {
return this.secretKey;
}
public void setSecretKey(final String secretKey) {
this.secretKey = secretKey;
}
@Override
public String getEndPoint() {
return this.endPoint;
}
public void setEndPoint(final String endPoint) {
this.endPoint = endPoint;
}
public String getBucketName() {
return this.bucketName;
}
public void setBucketName(final String bucketName) {
this.bucketName = bucketName;
}
@Override
public Boolean isHttps() {
return this.httpsFlag;
}
public void setHttps(final Boolean httpsFlag) {
this.httpsFlag = httpsFlag;
}
@Override
public Integer getConnectionTimeout() {
return connectionTimeout;
}
public void setConnectionTimeout(final Integer connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
@Override
public Integer getMaxErrorRetry() {
return maxErrorRetry;
}
public void setMaxErrorRetry(final Integer maxErrorRetry) {
this.maxErrorRetry = maxErrorRetry;
}
@Override
public Integer getSocketTimeout() {
return socketTimeout;
}
public void setSocketTimeout(final Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}
public Date getCreated() {
return this.created;
}
public void setCreated(final Date created) {
this.created = created;
}
}

View File

@ -0,0 +1,218 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.api.commands;
import static org.apache.cloudstack.api.ApiConstants.S3_ACCESS_KEY;
import static org.apache.cloudstack.api.ApiConstants.S3_CONNECTION_TIMEOUT;
import static org.apache.cloudstack.api.ApiConstants.S3_END_POINT;
import static org.apache.cloudstack.api.ApiConstants.S3_HTTPS_FLAG;
import static org.apache.cloudstack.api.ApiConstants.S3_MAX_ERROR_RETRY;
import static org.apache.cloudstack.api.ApiConstants.S3_SECRET_KEY;
import static org.apache.cloudstack.api.ApiConstants.S3_SOCKET_TIMEOUT;
import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME;
import static org.apache.cloudstack.api.BaseCmd.CommandType.INTEGER;
import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING;
import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import com.cloud.api.response.S3Response;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.S3;
@Implementation(description = "Adds S3", responseObject = S3Response.class, since = "4.0.0")
public final class AddS3Cmd extends BaseCmd {
private static String COMMAND_NAME = "adds3response";
@Parameter(name = S3_ACCESS_KEY, type = STRING, required = true,
description = "S3 access key")
private String accessKey;
@Parameter(name = S3_SECRET_KEY, type = STRING, required = true,
description = "S3 secret key")
private String secretKey;
@Parameter(name = S3_END_POINT, type = STRING, required = false,
description = "S3 host name")
private String endPoint = null;
@Parameter(name = S3_BUCKET_NAME, type = STRING, required = true,
description = "name of the template storage bucket")
private String bucketName;
@Parameter(name = S3_HTTPS_FLAG, type = BOOLEAN, required = false,
description = "connect to the S3 endpoint via HTTPS?")
private Boolean httpsFlag = null;
@Parameter(name = S3_CONNECTION_TIMEOUT, type = INTEGER, required = false,
description = "connection timeout (milliseconds)")
private Integer connectionTimeout = null;
@Parameter(name = S3_MAX_ERROR_RETRY, type = INTEGER, required = false,
description = "maximum number of times to retry on error")
private Integer maxErrorRetry = null;
@Parameter(name = S3_SOCKET_TIMEOUT, type = INTEGER, required = false,
description = "socket timeout (milliseconds)")
private Integer socketTimeout = null;
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException {
final S3 result;
try {
result = _resourceService.discoverS3(this);
if (result == null) {
throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3.");
}
} catch (DiscoveryException e) {
throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
}
final S3Response response = _responseGenerator.createS3Response(result);
response.setResponseName(this.getCommandName());
this.setResponseObject(response);
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || this.getClass() != thatObject.getClass()) {
return false;
}
final AddS3Cmd thatAddS3Cmd = (AddS3Cmd) thatObject;
if (this.httpsFlag != null ? !this.httpsFlag.equals(thatAddS3Cmd.httpsFlag) : thatAddS3Cmd.httpsFlag != null) {
return false;
}
if (this.accessKey != null ? !this.accessKey.equals(thatAddS3Cmd.accessKey) : thatAddS3Cmd.accessKey != null) {
return false;
}
if (this.connectionTimeout != null ? !this.connectionTimeout.equals(thatAddS3Cmd.connectionTimeout) : thatAddS3Cmd.connectionTimeout != null) {
return false;
}
if (this.endPoint != null ? !this.endPoint.equals(thatAddS3Cmd.endPoint) : thatAddS3Cmd.endPoint != null) {
return false;
}
if (this.maxErrorRetry != null ? !this.maxErrorRetry.equals(thatAddS3Cmd.maxErrorRetry) : thatAddS3Cmd.maxErrorRetry != null) {
return false;
}
if (this.secretKey != null ? !this.secretKey.equals(thatAddS3Cmd.secretKey) : thatAddS3Cmd.secretKey != null) {
return false;
}
if (this.socketTimeout != null ? !this.socketTimeout.equals(thatAddS3Cmd.socketTimeout) : thatAddS3Cmd.socketTimeout != null) {
return false;
}
if (this.bucketName != null ? !this.bucketName.equals(thatAddS3Cmd.bucketName) : thatAddS3Cmd.bucketName != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.accessKey != null ? this.accessKey.hashCode() : 0;
result = 31 * result + (this.secretKey != null ? this.secretKey.hashCode() : 0);
result = 31 * result + (this.endPoint != null ? this.endPoint.hashCode() : 0);
result = 31 * result + (this.bucketName != null ? this.bucketName.hashCode() : 0);
result = 31 * result + (this.httpsFlag != null && this.httpsFlag == true ? 1 : 0);
result = 31 * result + (this.connectionTimeout != null ? this.connectionTimeout.hashCode() : 0);
result = 31 * result + (this.maxErrorRetry != null ? this.maxErrorRetry.hashCode() : 0);
result = 31 * result + (this.socketTimeout != null ? this.socketTimeout.hashCode() : 0);
return result;
}
@Override
public String getCommandName() {
return COMMAND_NAME;
}
@Override
public long getEntityOwnerId() {
return ACCOUNT_ID_SYSTEM;
}
public String getAccessKey() {
return this.accessKey;
}
public String getSecretKey() {
return this.secretKey;
}
public String getEndPoint() {
return this.endPoint;
}
public String getBucketName() {
return this.bucketName;
}
public Boolean getHttpsFlag() {
return this.httpsFlag;
}
public Integer getConnectionTimeout() {
return this.connectionTimeout;
}
public Integer getMaxErrorRetry() {
return this.maxErrorRetry;
}
public Integer getSocketTimeout() {
return this.socketTimeout;
}
}

View File

@ -0,0 +1,112 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.api.commands;
import static org.apache.cloudstack.api.ApiConstants.ID;
import static org.apache.cloudstack.api.BaseCmd.CommandType.LONG;
import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.api.response.S3Response;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.S3;
@Implementation(description = "Lists S3s", responseObject = S3Response.class, since = "4.0.0")
public final class ListS3sCmd extends BaseListCmd {
private static final String COMMAND_NAME = "lists3sresponse";
@Parameter(name = ID, type = LONG, required = true, description = "The ID of the S3")
private Long id;
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException {
final List<? extends S3> result = _resourceService.listS3s(this);
final ListResponse<S3Response> response = new ListResponse<S3Response>();
final List<S3Response> s3Responses = new ArrayList<S3Response>();
if (result != null) {
for (S3 s3 : result) {
S3Response s3Response = _responseGenerator.createS3Response(s3);
s3Response.setResponseName(this.getCommandName());
s3Response.setObjectName("s3");
s3Responses.add(s3Response);
}
}
response.setResponses(s3Responses);
response.setResponseName(this.getCommandName());
this.setResponseObject(response);
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final ListS3sCmd thatListS3sCmd = (ListS3sCmd) thatObject;
if (this.id != null ? !this.id.equals(thatListS3sCmd.id) : thatListS3sCmd.id != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
return this.id != null ? this.id.hashCode() : 0;
}
@Override
public String getCommandName() {
return COMMAND_NAME;
}
public Long getId() {
return this.id;
}
}

View File

@ -0,0 +1,210 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.api.response;
import com.cloud.serializer.Param;
import com.cloud.utils.IdentityProxy;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
import static org.apache.cloudstack.api.ApiConstants.*;
public class S3Response extends BaseResponse {
@SerializedName(ID)
@Param(description = "The ID of the S3 configuration")
private IdentityProxy id = new IdentityProxy("s3");
@SerializedName(S3_ACCESS_KEY)
@Param(description = "The S3 access key")
private String accessKey;
@SerializedName(S3_SECRET_KEY)
@Param(description = "The S3 secret key")
private String secretKey;
@SerializedName(S3_END_POINT)
@Param(description = "The S3 end point")
private String endPoint;
@SerializedName(S3_BUCKET_NAME)
@Param(description = "The name of the template storage bucket")
private String bucketName;
@SerializedName(S3_HTTPS_FLAG)
@Param(description = "Connect to S3 using HTTPS?")
private Integer httpsFlag;
@SerializedName(S3_CONNECTION_TIMEOUT)
@Param(description = "The connection timeout (milliseconds)")
private Integer connectionTimeout;
@SerializedName(S3_MAX_ERROR_RETRY)
@Param(description = "The maximum number of time to retry a connection on error.")
private Integer maxErrorRetry;
@SerializedName(S3_SOCKET_TIMEOUT)
@Param(description = "The connection socket (milliseconds)")
private Integer socketTimeout;
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || this.getClass() != thatObject.getClass()) {
return false;
}
final S3Response thatS3Response = (S3Response) thatObject;
if (this.httpsFlag != null ? !this.httpsFlag.equals(thatS3Response.httpsFlag) : thatS3Response.httpsFlag != null) {
return false;
}
if (this.accessKey != null ? !this.accessKey.equals(thatS3Response.accessKey) : thatS3Response.accessKey != null) {
return false;
}
if (this.connectionTimeout != null ? !this.connectionTimeout.equals(thatS3Response.connectionTimeout) : thatS3Response.connectionTimeout != null) {
return false;
}
if (this.endPoint != null ? !this.endPoint.equals(thatS3Response.endPoint) : thatS3Response.endPoint != null) {
return false;
}
if (this.id != null ? !this.id.equals(thatS3Response.id) : thatS3Response.id != null) {
return false;
}
if (this.maxErrorRetry != null ? !this.maxErrorRetry.equals(thatS3Response.maxErrorRetry) : thatS3Response.maxErrorRetry != null) {
return false;
}
if (this.secretKey != null ? !this.secretKey.equals(thatS3Response.secretKey) : thatS3Response.secretKey != null) {
return false;
}
if (this.socketTimeout != null ? !this.socketTimeout.equals(thatS3Response.socketTimeout) : thatS3Response.socketTimeout != null) {
return false;
}
if (this.bucketName != null ? !this.bucketName.equals(thatS3Response.bucketName) : thatS3Response.bucketName != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.id != null ? this.id.hashCode() : 0;
result = 31 * result + (this.accessKey != null ? this.accessKey.hashCode() : 0);
result = 31 * result + (this.secretKey != null ? this.secretKey.hashCode() : 0);
result = 31 * result + (this.endPoint != null ? this.endPoint.hashCode() : 0);
result = 31 * result + (this.bucketName != null ? this.bucketName.hashCode() : 0);
result = 31 * result + (this.httpsFlag != null ? this.httpsFlag : 0);
result = 31 * result + (this.connectionTimeout != null ? this.connectionTimeout.hashCode() : 0);
result = 31 * result + (this.maxErrorRetry != null ? this.maxErrorRetry.hashCode() : 0);
result = 31 * result + (this.socketTimeout != null ? this.socketTimeout.hashCode() : 0);
return result;
}
@Override
public String getObjectId() {
return this.id.getValue().toString();
}
public void setObjectId(Long id) {
this.id.setValue(id);
}
public String getAccessKey() {
return this.accessKey;
}
public void setAccessKey(final String accessKey) {
this.accessKey = accessKey;
}
public String getSecretKey() {
return this.secretKey;
}
public void setSecretKey(final String secretKey) {
this.secretKey = secretKey;
}
public String getEndPoint() {
return this.endPoint;
}
public void setEndPoint(final String endPoint) {
this.endPoint = endPoint;
}
public String getTemplateBucketName() {
return this.bucketName;
}
public void setTemplateBucketName(final String templateBucketName) {
this.bucketName = templateBucketName;
}
public Integer getHttpsFlag() {
return this.httpsFlag;
}
public void setHttpsFlag(final Integer httpsFlag) {
this.httpsFlag = httpsFlag;
}
public Integer getConnectionTimeout() {
return this.connectionTimeout;
}
public void setConnectionTimeout(final Integer connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
public Integer getMaxErrorRetry() {
return this.maxErrorRetry;
}
public void setMaxErrorRetry(final Integer maxErrorRetry) {
this.maxErrorRetry = maxErrorRetry;
}
public Integer getSocketTimeout() {
return this.socketTimeout;
}
public void setSocketTimeout(final Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}
}

View File

@ -16,11 +16,6 @@
// under the License.
package com.cloud.network;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import com.cloud.acl.ControlledEntity;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
@ -28,6 +23,11 @@ import com.cloud.network.Networks.TrafficType;
import com.cloud.utils.fsm.FiniteState;
import com.cloud.utils.fsm.StateMachine;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* owned by an account.
*/
@ -168,6 +168,7 @@ public interface Network extends ControlledEntity {
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
public static final Capability RedundantRouter = new Capability("RedundantRouter");
public static final Capability ElasticIp = new Capability("ElasticIp");
public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
public static final Capability ElasticLb = new Capability("ElasticLb");
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");

View File

@ -41,7 +41,7 @@ public interface NetworkService {
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException,
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;

View File

@ -107,6 +107,8 @@ public interface NetworkOffering {
boolean getElasticIp();
boolean getAssociatePublicIP();
boolean getElasticLb();
boolean getSpecifyIpRanges();

View File

@ -24,12 +24,15 @@ import org.apache.cloudstack.api.command.admin.host.*;
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
import com.cloud.api.commands.AddS3Cmd;
import com.cloud.api.commands.ListS3sCmd;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.org.Cluster;
import com.cloud.storage.S3;
import com.cloud.storage.Swift;
import com.cloud.utils.fsm.NoTransitionException;
import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
@ -90,7 +93,12 @@ public interface ResourceService {
Swift discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
List<? extends Swift> listSwifts(ListSwiftsCmd cmd);
List<? extends S3> listS3s(ListS3sCmd cmd);
}

View File

@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.storage;
import com.cloud.agent.api.to.S3TO;
import java.util.Date;
public interface S3 {
long getId();
String getUuid();
String getAccessKey();
String getSecretKey();
String getEndPoint();
String getBucketName();
Integer getHttpsFlag();
Integer getConnectionTimeout();
Integer getMaxErrorRetry();
Integer getSocketTimeout();
Date getCreated();
S3TO toS3TO();
}

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api;
import org.omg.CORBA.PUBLIC_MEMBER;
public class ApiConstants {
public static final String ACCOUNT = "account";
public static final String ACCOUNTS = "accounts";
@ -383,7 +385,16 @@ public class ApiConstants {
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
public static final String S3_ACCESS_KEY = "accesskey";
public static final String S3_SECRET_KEY = "secretkey";
public static final String S3_END_POINT = "endpoint";
public static final String S3_BUCKET_NAME = "bucket";
public static final String S3_HTTPS_FLAG = "usehttps";
public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout";
public static final String S3_MAX_ERROR_RETRY = "maxerrorretry";
public static final String S3_SOCKET_TIMEOUT = "sockettimeout";
public static final String INCL_ZONES = "includezones";
public static final String EXCL_ZONES = "excludezones";
public static final String SOURCE = "source";
public static final String COUNTER_ID = "counterid";
public static final String AGGR_OPERATOR = "aggroperator";

View File

@ -92,6 +92,7 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.api.response.S3Response;
import com.cloud.async.AsyncJob;
import com.cloud.capacity.Capacity;
@ -144,6 +145,7 @@ import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.server.ResourceTag;
import com.cloud.storage.GuestOS;
import com.cloud.storage.S3;
import com.cloud.storage.Snapshot;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Swift;
@ -296,6 +298,8 @@ public interface ResponseGenerator {
SwiftResponse createSwiftResponse(Swift swift);
S3Response createS3Response(S3 result);
PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result);
ServiceResponse createNetworkServiceResponse(Service service);
@ -375,5 +379,4 @@ public interface ResponseGenerator {
GuestOSResponse createGuestOSResponse(GuestOS os);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
}

View File

@ -216,7 +216,8 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException{
try {
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), false, getZoneId());
IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
if (ip != null) {
this.setEntityId(ip.getId());
} else {

View File

@ -36,7 +36,7 @@ public class BackupSnapshotAnswerTest {
StoragePool pool = Mockito.mock(StoragePool.class);
bsc = new BackupSnapshotCommand("primaryStoragePoolNameLabel",
bsc = new BackupSnapshotCommand(
"secondaryStoragePoolURL", 101L, 102L, 103L, 104L,
"volumePath", pool, "snapshotUuid", "snapshotName",
"prevSnapshotUuid", "prevBackupUuid", false, "vmName", 5);

View File

@ -116,14 +116,14 @@ public class BackupSnapshotCommandTest {
};
BackupSnapshotCommand bsc = new BackupSnapshotCommand(
"primaryStoragePoolNameLabel", "http://secondary.Storage.Url",
"http://secondary.Storage.Url",
101L, 102L, 103L, 104L, "vPath", pool,
"420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
"9012793e-0657-11e2-bebc-0050568b0057",
"7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
BackupSnapshotCommand bsc1 = new BackupSnapshotCommand(
"primaryStoragePoolNameLabel", "http://secondary.Storage.Url",
"http://secondary.Storage.Url",
101L, 102L, 103L, 104L, "vPath", pool,
"420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
"9012793e-0657-11e2-bebc-0050568b0057",
@ -132,7 +132,7 @@ public class BackupSnapshotCommandTest {
@Test
public void testGetPrimaryStoragePoolNameLabel() {
String label = bsc.getPrimaryStoragePoolNameLabel();
assertTrue(label.equals("primaryStoragePoolNameLabel"));
assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
}
@Test

View File

@ -23,19 +23,109 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.cloud.agent.api.SnapshotCommand;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolStatus;
public class SnapshotCommandTest {
SnapshotCommand ssc = new SnapshotCommand("primaryStoragePoolNameLabel",
public StoragePool pool = new StoragePool() {
public long getId() {
return 1L;
};
public String getName() {
return "name";
};
public String getUuid() {
return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
};
public StoragePoolType getPoolType() {
return StoragePoolType.Filesystem;
};
public Date getCreated() {
Date date = null;
try {
date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
.parse("01/01/1970 12:12:12");
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
public Date getUpdateTime() {
return new Date();
};
public long getDataCenterId() {
return 0L;
};
public long getCapacityBytes() {
return 0L;
};
public long getAvailableBytes() {
return 0L;
};
public Long getClusterId() {
return 0L;
};
public String getHostAddress() {
return "hostAddress";
};
public String getPath() {
return "path";
};
public String getUserInfo() {
return "userInfo";
};
public boolean isShared() {
return false;
};
public boolean isLocal() {
return false;
};
public StoragePoolStatus getStatus() {
return StoragePoolStatus.Up;
};
public int getPort() {
return 25;
};
public Long getPodId() {
return 0L;
};
};
SnapshotCommand ssc = new SnapshotCommand(pool,
"http://secondary.Storage.Url",
"420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "snapshotName", 101L, 102L,
103L);
SnapshotCommand ssc1;
@Before
public void setUp() {
ssc1 = new SnapshotCommand("primaryStoragePoolNameLabel",
ssc1 = new SnapshotCommand(pool,
"secondaryStorageUrl", "snapshotUuid", "snapshotName", 101L,
102L, 103L);
}
@ -43,7 +133,7 @@ public class SnapshotCommandTest {
@Test
public void testGetPrimaryStoragePoolNameLabel() {
String label = ssc.getPrimaryStoragePoolNameLabel();
assertTrue(label.equals("primaryStoragePoolNameLabel"));
assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
}
@Test

View File

@ -58,6 +58,7 @@ import com.caringo.client.ScspResponse;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
/**
@ -413,23 +414,26 @@ public class S3CAStorBucketAdapter implements S3BucketAdapter {
}
public class ScspDataSource implements DataSource {
GetMethod method;
public ScspDataSource(GetMethod m) {
method = m;
String content_type = null;
byte content[] = null;
public ScspDataSource(GetMethod method) {
Header h = method.getResponseHeader("Content-type");
if (h != null) {
content_type = h.getValue();
}
try{
content = method.getResponseBody();
}catch(IOException e){
s_logger.error("CAStor loadObjectRange getInputStream error", e);
}
}
@Override
public String getContentType() {
Header h = method.getResponseHeader("Content-type");
return h==null ? null : h.getValue();
return content_type;
}
@Override
public InputStream getInputStream() throws IOException {
try {
return method.getResponseBodyAsStream();
} catch (Exception e) {
s_logger.error("CAStor loadObjectRange getInputStream error", e);
return null;
}
public InputStream getInputStream() {
return new ByteArrayInputStream(content);
}
@Override
public String getName() {
@ -445,21 +449,27 @@ public class S3CAStorBucketAdapter implements S3BucketAdapter {
@Override
public DataHandler loadObjectRange(String mountedRoot, String bucket, String fileName, long startPos, long endPos) {
HttpClient httpClient = new HttpClient(s_httpClientManager);
// Create a method instance.
GetMethod method = new GetMethod(castorURL(mountedRoot, bucket, fileName));
method.addRequestHeader("Range", "bytes=" + startPos + "-" + endPos);
int statusCode;
try {
HttpClient httpClient = new HttpClient(s_httpClientManager);
// Create a method instance.
GetMethod method = new GetMethod(castorURL(mountedRoot, bucket, fileName));
method.addRequestHeader("Range", "bytes=" + startPos + "-" + endPos);
int statusCode = httpClient.executeMethod(method);
if (statusCode < HTTP_OK || statusCode >= HTTP_UNSUCCESSFUL) {
s_logger.error("CAStor loadObjectRange response: "+ statusCode);
throw new FileNotExistException("CAStor loadObjectRange response: " + statusCode);
}
return new DataHandler(new ScspDataSource(method));
} catch (Exception e) {
statusCode = httpClient.executeMethod(method);
} catch (HttpException e) {
s_logger.error("CAStor loadObjectRange failure", e);
throw new FileNotExistException("CAStor loadObjectRange failure: " + e);
} catch (IOException e) {
s_logger.error("CAStor loadObjectRange failure", e);
throw new FileNotExistException("CAStor loadObjectRange failure: " + e);
}
if (statusCode < HTTP_OK || statusCode >= HTTP_UNSUCCESSFUL) {
s_logger.error("CAStor loadObjectRange response: "+ statusCode);
throw new FileNotExistException("CAStor loadObjectRange response: " + statusCode);
}
DataHandler ret = new DataHandler(new ScspDataSource(method));
method.releaseConnection();
return ret;
}
@Override

View File

@ -19,7 +19,7 @@
#new labels (begin) **********************************************************************************************
label.egress.rules=Egress rules
message.acquire.new.ip.vpc=Please confirm that you would like to acquire a new IP for this VPC.
label.zoneWizard.trafficType.management=Mangement: Traffic between CloudStack\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs
label.zoneWizard.trafficType.management=Management: Traffic between CloudStack\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs
label.zoneWizard.trafficType.public=Public: Traffic between the internet and virtual machines in the cloud.
label.zoneWizard.trafficType.guest=Guest: Traffic between end-user virtual machines
label.zoneWizard.trafficType.storage=Storage: Traffic between primary and secondary storage servers, such as VM templates and snapshots
@ -32,6 +32,17 @@ label.destroy=Destroy
label.restore=Restore
label.isolation.uri=Isolation URI
label.broadcast.uri=Broadcast URI
label.enable.s3=Enable S3-backed Secondary Storage
confirm.enable.s3=Please fill in the following information to enable support for S3-backed Secondary Storage
message.after.enable.s3=S3-backed Secondary Storage configured. Note: When you leave this page, you will not be able to re-configure S3 again.
label.s3.access_key=Access Key
label.s3.secret_key=Secret Key
label.s3.bucket=Bucket
label.s3.endpoint=Endpoint
label.s3.use_https=Use HTTPS
label.s3.connection_timeout=Connection Timeout
label.s3.max_error_retry=Max Error Retry
label.s3.socket_timeout=Socket Timeout
#new labels (end) ************************************************************************************************
@ -305,8 +316,6 @@ label.installWizard.subtitle=This tour will aid you in setting up your CloudStac
label.continue=Continue
label.installWizard.title=Hello and Welcome to CloudStack&#8482
label.agree=Agree
label.license.agreement=License Agreement
label.license.agreement.subtitle=Please accept the CloudStack&#8482 EULA before installing.
label.manage.resources=Manage Resources
label.port.forwarding.policies=Port forwarding policies
label.load.balancing.policies=Load balancing policies

View File

@ -292,8 +292,6 @@ label.installWizard.subtitle=Ce tutorial vous aidera
label.continue=Continuer
label.installWizard.title=Bonjour et bienvenue dans CloudStack
label.agree=Accepter
label.license.agreement=Accord de licence
label.license.agreement.subtitle=Merci d\'accepter l\'EULA CloudStack avant d\'installer.
label.manage.resources=Gérer les ressources
label.port.forwarding.policies=Règles de transfert de port
label.load.balancing.policies=Règles de répartition de charge

View File

@ -295,8 +295,6 @@ label.installWizard.subtitle=このガイド ツアーは CloudStack&#8482; 環
label.continue=続行
label.installWizard.title=CloudStack&#8482; へようこそ
label.agree=同意する
label.license.agreement=ライセンス契約
label.license.agreement.subtitle=インストールの前に CloudStack&#8482; エンド ユーザー ライセンス契約に同意してください。
label.manage.resources=リソースの管理
label.port.forwarding.policies=ポート転送ポリシー
label.load.balancing.policies=負荷分散ポリシー

View File

@ -292,8 +292,6 @@ label.installWizard.subtitle=Este tour vai auxiliar voc
label.continue=Continuar
label.installWizard.title=Olá, seja bem vindo ao CloudStack&\#8482
label.agree=Concordo
label.license.agreement=Acordo de Licença
label.license.agreement.subtitle=Por favor aceite a EULA do CloudStack&\#8482 antes de instalar.
label.manage.resources=Gerenciar Recursos
label.port.forwarding.policies=Políticas de redirecionamento de portas
label.load.balancing.policies=Políticas de balanceamento de carga

View File

@ -292,8 +292,6 @@ label.installWizard.subtitle=Это руководство настроит ва
label.continue=Продолжить
label.installWizard.title=Здравствуйте и добро пожаловать в CloudStack\!
label.agree=Согласен
label.license.agreement=Лицензионное соглашение
label.license.agreement.subtitle=Для продолжения установки согласитесь с лицензионным соглашением.
label.manage.resources=Управление ресурсами
label.port.forwarding.policies=Политики проброса портов
label.load.balancing.policies=Политики балансировки нагрузки

View File

@ -295,8 +295,6 @@ label.installWizard.subtitle=此教程将帮助您设置 CloudStack&#8482 安装
label.continue=继续
label.installWizard.title=您好,欢迎使用 CloudStack&#8482
label.agree=同意
label.license.agreement=许可协议
label.license.agreement.subtitle=必须先接受 CloudStack&#8482 EULA 才能进行安装。
label.manage.resources=管理资源
label.port.forwarding.policies=端口转发策略
label.load.balancing.policies=负载平衡策略

View File

@ -224,10 +224,14 @@ listAlerts=org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;3
#### system capacity commands
listCapacity=org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;3
#### swift commands^M
#### swift commands
addSwift=org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;1
listSwifts=org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;1
#### s3 commands
addS3=com.cloud.api.commands.AddS3Cmd;1
listS3s=com.cloud.api.commands.ListS3sCmd;1
#### host commands
addHost=org.apache.cloudstack.api.command.admin.host.AddHostCmd;3
addCluster=org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;1

View File

@ -37,9 +37,6 @@ db.cloud.testOnBorrow=true
db.cloud.testWhileIdle=true
db.cloud.timeBetweenEvictionRunsMillis=40000
db.cloud.minEvictableIdleTimeMillis=240000
db.cloud.removeAbandoned=false
db.cloud.removeAbandonedTimeout=300
db.cloud.logAbandoned=true
db.cloud.poolPreparedStatements=false
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true

View File

@ -37,9 +37,6 @@ db.cloud.testOnBorrow=true
db.cloud.testWhileIdle=true
db.cloud.timeBetweenEvictionRunsMillis=40000
db.cloud.minEvictableIdleTimeMillis=240000
db.cloud.removeAbandoned=false
db.cloud.removeAbandonedTimeout=300
db.cloud.logAbandoned=true
db.cloud.poolPreparedStatements=false
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true

View File

@ -43,6 +43,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${cs.codec.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>

View File

@ -24,11 +24,15 @@ public class DirectNetworkUsageCommand extends Command {
private List<String> publicIps;
private Date start;
private Date end;
private String includeZones;
private String excludeZones;
public DirectNetworkUsageCommand(List<String> publicIps, Date start, Date end) {
public DirectNetworkUsageCommand(List<String> publicIps, Date start, Date end, String includeZones, String excludeZones) {
this.setPublicIps(publicIps);
this.setStart(start);
this.setEnd(end);
this.setIncludeZones(includeZones);
this.setExcludeZones(excludeZones);
}
@Override
@ -59,4 +63,21 @@ public class DirectNetworkUsageCommand extends Command {
public Date getEnd() {
return end;
}
public String getIncludeZones() {
return includeZones;
}
public void setIncludeZones(String includeZones) {
this.includeZones = includeZones;
}
public String getExcludeZones() {
return excludeZones;
}
public void setExcludeZones(String excludeZones) {
this.excludeZones = excludeZones;
}
}

View File

@ -49,7 +49,6 @@ import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupTrafficMonitorCommand;
import com.cloud.host.Host;
import com.cloud.resource.ServerResource;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.exception.ExecutionException;
public class TrafficSentinelResource implements ServerResource {
@ -59,8 +58,8 @@ public class TrafficSentinelResource implements ServerResource {
private String _ip;
private String _guid;
private String _url;
private static Integer _numRetries;
private static Integer _timeoutInSeconds;
private String _inclZones;
private String _exclZones;
private static final Logger s_logger = Logger.getLogger(TrafficSentinelResource.class);
@ -91,9 +90,8 @@ public class TrafficSentinelResource implements ServerResource {
throw new ConfigurationException("Unable to find url");
}
_numRetries = NumbersUtil.parseInt((String) params.get("numRetries"), 1);
_timeoutInSeconds = NumbersUtil.parseInt((String) params.get("timeoutInSeconds"), 300);
_inclZones = (String)params.get("inclZones");
_exclZones = (String)params.get("exclZones");
return true;
} catch (Exception e) {
@ -197,6 +195,15 @@ public class TrafficSentinelResource implements ServerResource {
try {
//Direct Network Usage
URL trafficSentinel;
//Use Global include/exclude zones if there are no per TS zones
if(_inclZones == null){
_inclZones = cmd.getIncludeZones();
}
if(_exclZones == null){
_exclZones = cmd.getExcludeZones();
}
try {
//Query traffic Sentinel
trafficSentinel = new URL(_url+"/inmsf/Query?script="+URLEncoder.encode(getScript(cmd.getPublicIps(), cmd.getStart(), cmd.getEnd()),"UTF-8")
@ -247,12 +254,28 @@ public class TrafficSentinelResource implements ServerResource {
IpAddresses += ",";
}
}
String destZoneCondition = "";
if(_inclZones !=null && !_inclZones.isEmpty()){
destZoneCondition = " & destinationzone = "+_inclZones;
}
if(_exclZones !=null && !_exclZones.isEmpty()){
destZoneCondition += " & destinationzone != "+_exclZones;
}
String srcZoneCondition = "";
if(_inclZones !=null && !_inclZones.isEmpty()){
srcZoneCondition = " & sourcezone = "+_inclZones;
}
if(_exclZones !=null && !_exclZones.isEmpty()){
srcZoneCondition += " & sourcezone != "+_exclZones;
}
String startDate = getDateString(start);
String endtDate = getDateString(end);
StringBuffer sb = new StringBuffer();
sb.append("var q = Query.topN(\"historytrmx\",");
sb.append(" \"ipsource,bytes\",");
sb.append(" \"ipsource = "+IpAddresses+" & destinationzone = EXTERNAL\",");
sb.append(" \"ipsource = "+IpAddresses+destZoneCondition+"\",");
sb.append(" \""+startDate+", "+endtDate+"\",");
sb.append(" \"bytes\",");
sb.append(" 100000);");
@ -265,7 +288,7 @@ public class TrafficSentinelResource implements ServerResource {
sb.append(" });");
sb.append("var q = Query.topN(\"historytrmx\",");
sb.append(" \"ipdestination,bytes\",");
sb.append(" \"ipdestination = "+IpAddresses+" & sourcezone = EXTERNAL\",");
sb.append(" \"ipdestination = "+IpAddresses+srcZoneCondition+"\",");
sb.append(" \""+startDate+", "+endtDate+"\",");
sb.append(" \"bytes\",");
sb.append(" 100000);");

View File

@ -0,0 +1,208 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.storage;
import com.cloud.agent.api.to.S3TO;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.Identity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "s3")
public class S3VO implements S3, Identity {
public static final String ID_COLUMN_NAME = "id";
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = ID_COLUMN_NAME)
private long id;
@Column(name = "uuid")
private String uuid;
@Column(name = "access_key")
private String accessKey;
@Column(name = "secret_key")
private String secretKey;
@Column(name = "end_point")
private String endPoint;
@Column(name = "bucket")
private String bucketName;
@Column(name = "https")
private Integer httpsFlag;
@Column(name = "connection_timeout")
private Integer connectionTimeout;
@Column(name = "max_error_retry")
private Integer maxErrorRetry;
@Column(name = "socket_timeout")
private Integer socketTimeout;
@Column(name = GenericDao.CREATED_COLUMN)
private Date created;
public S3VO() {
super();
}
public S3VO(final String uuid, final String accessKey,
final String secretKey, final String endPoint,
final String bucketName, final Boolean httpsFlag,
final Integer connectionTimeout, final Integer maxErrorRetry,
final Integer socketTimeout, final Date created) {
super();
this.uuid = uuid;
this.accessKey = accessKey;
this.secretKey = secretKey;
this.endPoint = endPoint;
this.bucketName = bucketName;
Integer value = null;
if (httpsFlag != null) {
value = httpsFlag == false ? 0 : 1;
}
this.httpsFlag = value;
this.connectionTimeout = connectionTimeout;
this.maxErrorRetry = maxErrorRetry;
this.socketTimeout = socketTimeout;
this.created = created;
}
@Override
public S3TO toS3TO() {
Boolean httpsFlag = null;
if (this.httpsFlag != null) {
httpsFlag = this.httpsFlag == 0 ? false : true;
}
return new S3TO(this.id, this.uuid, this.accessKey, this.secretKey,
this.endPoint, this.bucketName, httpsFlag,
this.connectionTimeout, this.maxErrorRetry, this.socketTimeout,
this.created);
}
public long getId() {
return this.id;
}
public void setId(final long id) {
this.id = id;
}
public String getUuid() {
return this.uuid;
}
public void setUuid(final String uuid) {
this.uuid = uuid;
}
public String getAccessKey() {
return this.accessKey;
}
public void setAccessKey(final String accessKey) {
this.accessKey = accessKey;
}
public String getSecretKey() {
return this.secretKey;
}
public void setSecretKey(final String secretKey) {
this.secretKey = secretKey;
}
public String getEndPoint() {
return this.endPoint;
}
public void setEndPoint(final String endPoint) {
this.endPoint = endPoint;
}
public String getBucketName() {
return this.bucketName;
}
public void setBucketName(final String bucketName) {
this.bucketName = bucketName;
}
public Integer getHttpsFlag() {
return this.httpsFlag;
}
public void setHttpsFlag(final Integer httpsFlag) {
this.httpsFlag = httpsFlag;
}
public Integer getConnectionTimeout() {
return this.connectionTimeout;
}
public void setConnectionTimeout(final int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
public Integer getMaxErrorRetry() {
return this.maxErrorRetry;
}
public void setMaxErrorRetry(final int maxErrorRetry) {
this.maxErrorRetry = maxErrorRetry;
}
public Integer getSocketTimeout() {
return this.socketTimeout;
}
public void setSocketTimeout(final int socketTimeout) {
this.socketTimeout = socketTimeout;
}
public Date getCreated() {
return this.created;
}
public void setCreated(final Date created) {
this.created = created;
}
}

View File

@ -91,6 +91,9 @@ public class SnapshotVO implements Snapshot, Identity {
@Column(name="swift_id")
Long swiftId;
@Column(name="s3_id")
Long s3Id;
@Column(name="sechost_id")
Long secHostId;
@ -289,4 +292,13 @@ public class SnapshotVO implements Snapshot, Identity {
public void setUuid(String uuid) {
this.uuid = uuid;
}
public Long getS3Id() {
return s3Id;
}
public void setS3Id(Long s3Id) {
this.s3Id = s3Id;
}
}

View File

@ -0,0 +1,203 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.storage;
import com.cloud.utils.db.GenericDaoBase;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.text.DateFormat;
import java.util.Date;
@Entity
@Table(name = "template_s3_ref")
public class VMTemplateS3VO {
public static final String S3_ID_COLUMN_NAME = "s3_id";
public static final String TEMPLATE_ID_COLUMN_NAME = "template_id";
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = S3_ID_COLUMN_NAME)
private long s3Id;
@Column(name = TEMPLATE_ID_COLUMN_NAME)
private long templateId;
@Column(name = GenericDaoBase.CREATED_COLUMN)
private Date created;
@Column(name = "size")
private Long size;
@Column(name = "physical_size")
private Long physicalSize;
public VMTemplateS3VO() {
super();
}
public VMTemplateS3VO(final long s3Id, final long templateId,
final Date created, final Long size, final Long physicalSize) {
super();
this.s3Id = s3Id;
this.templateId = templateId;
this.created = created;
this.size = size;
this.physicalSize = physicalSize;
}
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final VMTemplateS3VO thatVMTemplateS3VO = (VMTemplateS3VO) thatObject;
if (this.id != thatVMTemplateS3VO.id) {
return false;
}
if (this.s3Id != thatVMTemplateS3VO.s3Id) {
return false;
}
if (this.templateId != thatVMTemplateS3VO.templateId) {
return false;
}
if (this.created != null ? !created.equals(thatVMTemplateS3VO.created)
: thatVMTemplateS3VO.created != null) {
return false;
}
if (this.physicalSize != null ? !physicalSize
.equals(thatVMTemplateS3VO.physicalSize)
: thatVMTemplateS3VO.physicalSize != null) {
return false;
}
if (this.size != null ? !size.equals(thatVMTemplateS3VO.size)
: thatVMTemplateS3VO.size != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = (int) (this.id ^ (this.id >>> 32));
result = 31 * result + (int) (this.s3Id ^ (this.s3Id >>> 32));
result = 31 * result
+ (int) (this.templateId ^ (this.templateId >>> 32));
result = 31 * result
+ (this.created != null ? this.created.hashCode() : 0);
result = 31 * result + (this.size != null ? this.size.hashCode() : 0);
result = 31
* result
+ (this.physicalSize != null ? this.physicalSize.hashCode() : 0);
return result;
}
public long getId() {
return this.id;
}
public void setId(final long id) {
this.id = id;
}
public long getS3Id() {
return this.s3Id;
}
public void setS3Id(final long s3Id) {
this.s3Id = s3Id;
}
public long getTemplateId() {
return this.templateId;
}
public void setTemplateId(final long templateId) {
this.templateId = templateId;
}
public Date getCreated() {
return this.created;
}
public void setCreated(final Date created) {
this.created = created;
}
public Long getSize() {
return this.size;
}
public void setSize(final Long size) {
this.size = size;
}
public Long getPhysicalSize() {
return this.physicalSize;
}
public void setPhysicalSize(final Long physicalSize) {
this.physicalSize = physicalSize;
}
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder(
"VMTemplateS3VO [ id: ").append(id).append(", created: ")
.append(DateFormat.getDateTimeInstance().format(created))
.append(", physicalSize: ").append(physicalSize)
.append(", size: ").append(size).append(", templateId: ")
.append(templateId).append(", s3Id: ").append(s3Id)
.append(" ]");
return stringBuilder.toString();
}
}

View File

@ -16,10 +16,20 @@
// under the License.
package com.cloud.storage.resource;
import static com.cloud.utils.S3Utils.deleteDirectory;
import static com.cloud.utils.S3Utils.getDirectory;
import static com.cloud.utils.S3Utils.putDirectory;
import static com.cloud.utils.StringUtils.join;
import static com.cloud.utils.db.GlobalLock.executeWithNoWaitLock;
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static org.apache.commons.lang.StringUtils.substringAfterLast;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
@ -32,6 +42,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
import javax.naming.ConfigurationException;
@ -46,6 +57,9 @@ import com.cloud.agent.api.ComputeChecksumCommand;
import com.cloud.agent.api.DeleteObjectFromSwiftCommand;
import com.cloud.agent.api.DeleteSnapshotBackupCommand;
import com.cloud.agent.api.DeleteSnapshotsDirCommand;
import com.cloud.agent.api.DeleteTemplateFromS3Command;
import com.cloud.agent.api.DownloadSnapshotFromS3Command;
import com.cloud.agent.api.DownloadTemplateFromS3ToSecondaryStorageCommand;
import com.cloud.agent.api.GetStorageStatsAnswer;
import com.cloud.agent.api.GetStorageStatsCommand;
import com.cloud.agent.api.PingCommand;
@ -60,6 +74,8 @@ import com.cloud.agent.api.SecStorageSetupCommand.Certificates;
import com.cloud.agent.api.StartupSecondaryStorageCommand;
import com.cloud.agent.api.SecStorageVMSetupCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupSecondaryStorageCommand;
import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand;
import com.cloud.agent.api.downloadSnapshotFromSwiftCommand;
import com.cloud.agent.api.downloadTemplateFromSwiftToSecondaryStorageCommand;
import com.cloud.agent.api.uploadTemplateToSwiftFromSecondaryStorageCommand;
@ -75,6 +91,7 @@ import com.cloud.agent.api.storage.ListVolumeAnswer;
import com.cloud.agent.api.storage.ListVolumeCommand;
import com.cloud.agent.api.storage.UploadCommand;
import com.cloud.agent.api.storage.ssCommand;
import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.SwiftTO;
import com.cloud.exception.InternalErrorException;
import com.cloud.host.Host;
@ -89,6 +106,9 @@ import com.cloud.storage.template.TemplateLocation;
import com.cloud.storage.template.UploadManager;
import com.cloud.storage.template.UploadManagerImpl;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.S3Utils;
import com.cloud.utils.S3Utils.FileNamingStrategy;
import com.cloud.utils.S3Utils.ObjectNamingStrategy;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
@ -96,8 +116,15 @@ import com.cloud.utils.script.OutputInterpreter;
import com.cloud.utils.script.Script;
import com.cloud.vm.SecondaryStorageVm;
public class NfsSecondaryStorageResource extends ServerResourceBase implements SecondaryStorageResource {
private static final Logger s_logger = Logger.getLogger(NfsSecondaryStorageResource.class);
public class NfsSecondaryStorageResource extends ServerResourceBase implements
SecondaryStorageResource {
private static final Logger s_logger = Logger
.getLogger(NfsSecondaryStorageResource.class);
private static final String TEMPLATE_ROOT_DIR = "template/tmpl";
private static final String SNAPSHOT_ROOT_DIR = "snapshots";
int _timeout;
String _instance;
@ -167,16 +194,24 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
return execute((ListVolumeCommand)cmd);
}else if (cmd instanceof downloadSnapshotFromSwiftCommand){
return execute((downloadSnapshotFromSwiftCommand)cmd);
} else if (cmd instanceof DownloadSnapshotFromS3Command) {
return execute((DownloadSnapshotFromS3Command) cmd);
} else if (cmd instanceof DeleteSnapshotBackupCommand){
return execute((DeleteSnapshotBackupCommand)cmd);
} else if (cmd instanceof DeleteSnapshotsDirCommand){
return execute((DeleteSnapshotsDirCommand)cmd);
} else if (cmd instanceof downloadTemplateFromSwiftToSecondaryStorageCommand) {
return execute((downloadTemplateFromSwiftToSecondaryStorageCommand) cmd);
} else if (cmd instanceof DownloadTemplateFromS3ToSecondaryStorageCommand) {
return execute((DownloadTemplateFromS3ToSecondaryStorageCommand) cmd);
} else if (cmd instanceof uploadTemplateToSwiftFromSecondaryStorageCommand) {
return execute((uploadTemplateToSwiftFromSecondaryStorageCommand) cmd);
} else if (cmd instanceof UploadTemplateToS3FromSecondaryStorageCommand) {
return execute((UploadTemplateToS3FromSecondaryStorageCommand) cmd);
} else if (cmd instanceof DeleteObjectFromSwiftCommand) {
return execute((DeleteObjectFromSwiftCommand) cmd);
} else if (cmd instanceof DeleteTemplateFromS3Command) {
return execute((DeleteTemplateFromS3Command) cmd);
} else if (cmd instanceof CleanupSnapshotBackupCommand){
return execute((CleanupSnapshotBackupCommand)cmd);
} else {
@ -184,6 +219,69 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
@SuppressWarnings("unchecked")
private String determineS3TemplateDirectory(final Long accountId,
final Long templateId) {
return join(asList(TEMPLATE_ROOT_DIR, accountId, templateId),
S3Utils.SEPARATOR);
}
@SuppressWarnings("unchecked")
private String determineStorageTemplatePath(final String storagePath,
final Long accountId, final Long templateId) {
return join(
asList(getRootDir(storagePath), TEMPLATE_ROOT_DIR, accountId,
templateId), File.separator);
}
private Answer execute(
final DownloadTemplateFromS3ToSecondaryStorageCommand cmd) {
final S3TO s3 = cmd.getS3();
final String storagePath = cmd.getStoragePath();
final Long accountId = cmd.getAccountId();
final Long templateId = cmd.getTemplateId();
try {
final File downloadDirectory = _storage
.getFile(determineStorageTemplatePath(storagePath,
accountId, templateId));
downloadDirectory.mkdirs();
if (!downloadDirectory.exists()) {
final String errMsg = format(
"Unable to create directory "
+ "download directory %1$s for download of template id "
+ "%2$s from S3.", downloadDirectory.getName(),
templateId);
s_logger.error(errMsg);
return new Answer(cmd, false, errMsg);
}
getDirectory(s3, s3.getBucketName(),
determineS3TemplateDirectory(accountId, templateId),
downloadDirectory, new FileNamingStrategy() {
@Override
public String determineFileName(final String key) {
return substringAfterLast(key, S3Utils.SEPARATOR);
}
});
return new Answer(cmd, true, format("Successfully downloaded "
+ "template id %1$s from S3 to directory %2$s", templateId,
downloadDirectory.getName()));
} catch (Exception e) {
final String errMsg = format("Failed to upload template id %1$s "
+ "due to $2%s", templateId, e.getMessage());
s_logger.error(errMsg, e);
return new Answer(cmd, false, errMsg);
}
}
private Answer execute(downloadTemplateFromSwiftToSecondaryStorageCommand cmd) {
SwiftTO swift = cmd.getSwift();
@ -255,6 +353,83 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
private Answer execute(UploadTemplateToS3FromSecondaryStorageCommand cmd) {
final S3TO s3 = cmd.getS3();
final Long accountId = cmd.getAccountId();
final Long templateId = cmd.getTemplateId();
try {
final String templatePath = determineStorageTemplatePath(
cmd.getStoragePath(), accountId, templateId);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found template id " + templateId
+ " account id " + accountId + " from directory "
+ templatePath + " to upload to S3.");
}
if (!_storage.isDirectory(templatePath)) {
final String errMsg = format("S3 Sync Failure: Directory %1$s"
+ "for template id %2$s does not exist.", templatePath,
templateId);
s_logger.error(errMsg);
return new Answer(cmd, false, errMsg);
}
if (!_storage.isFile(templatePath + "/template.properties")) {
final String errMsg = format("S3 Sync Failure: Template id "
+ "%1$s does not exist on the file system.",
templatePath);
s_logger.error(errMsg);
return new Answer(cmd, false, errMsg);
}
if (s_logger.isDebugEnabled()) {
s_logger.debug(format(
"Pushing template id %1$s from %2$s to S3...",
templateId, templatePath));
}
final String bucket = s3.getBucketName();
putDirectory(s3, bucket, _storage.getFile(templatePath),
new FilenameFilter() {
@Override
public boolean accept(final File directory,
final String fileName) {
return !fileName.startsWith(".");
}
}, new ObjectNamingStrategy() {
@Override
public String determineKey(final File file) {
s_logger.debug(String
.format("Determining key using account id %1$s and template id %2$s",
accountId, templateId));
return join(
asList(determineS3TemplateDirectory(
accountId, templateId), file
.getName()), S3Utils.SEPARATOR);
}
});
return new Answer(
cmd,
true,
format("Uploaded the contents of directory %1$s for template id %2$s to S3 bucket %3$s",
templatePath, templateId, bucket));
} catch (Exception e) {
final String errMsg = format("Failed to upload template id %1$s",
templateId);
s_logger.error(errMsg, e);
return new Answer(cmd, false, errMsg);
}
}
private Answer execute(DeleteObjectFromSwiftCommand cmd) {
SwiftTO swift = cmd.getSwift();
String container = cmd.getContainer();
@ -278,6 +453,47 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
private Answer execute(final DeleteTemplateFromS3Command cmd) {
final S3TO s3 = cmd.getS3();
final Long accountId = cmd.getAccountId();
final Long templateId = cmd.getTemplateId();
if (accountId == null || (accountId != null && accountId <= 0)) {
final String errorMessage = "No account id specified for S3 template deletion.";
s_logger.error(errorMessage);
return new Answer(cmd, false, errorMessage);
}
if (templateId == null || (templateId != null && templateId <= 0)) {
final String errorMessage = "No template id specified for S3 template deletion.";
s_logger.error(errorMessage);
return new Answer(cmd, false, errorMessage);
}
if (s3 == null) {
final String errorMessge = "No S3 client options provided";
s_logger.error(errorMessge);
return new Answer(cmd, false, errorMessge);
}
final String bucket = s3.getBucketName();
try {
deleteDirectory(s3, bucket,
determineS3TemplateDirectory(templateId, accountId));
return new Answer(cmd, true, String.format(
"Deleted template %1%s from bucket %2$s.", templateId,
bucket));
} catch (Exception e) {
final String errorMessage = String
.format("Failed to delete templaet id %1$s from bucket %2$s due to the following error: %3$s",
templateId, bucket, e.getMessage());
s_logger.error(errorMessage, e);
return new Answer(cmd, false, errorMessage);
}
}
String swiftDownload(SwiftTO swift, String container, String rfilename, String lFullPath) {
Script command = new Script("/bin/bash", s_logger);
command.add("-c");
@ -450,6 +666,110 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
public Answer execute(final DownloadSnapshotFromS3Command cmd) {
final S3TO s3 = cmd.getS3();
final String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
final Long accountId = cmd.getAccountId();
final Long volumeId = cmd.getVolumeId();
try {
executeWithNoWaitLock(determineSnapshotLockId(accountId, volumeId),
new Callable<Void>() {
@Override
public Void call() throws Exception {
final String directoryName = determineSnapshotLocalDirectory(
secondaryStorageUrl, accountId, volumeId);
String result = createLocalDir(directoryName);
if (result != null) {
throw new InternalErrorException(
format("Failed to create directory %1$s during S3 snapshot download.",
directoryName));
}
final String snapshotFileName = determineSnapshotBackupFilename(cmd
.getSnapshotUuid());
final String key = determineSnapshotS3Key(
accountId, volumeId, snapshotFileName);
final File targetFile = S3Utils.getFile(s3,
s3.getBucketName(), key,
_storage.getFile(directoryName),
new FileNamingStrategy() {
@Override
public String determineFileName(
String key) {
return snapshotFileName;
}
});
if (cmd.getParent() != null) {
final String parentPath = join(
File.pathSeparator, directoryName,
determineSnapshotBackupFilename(cmd
.getParent()));
result = setVhdParent(
targetFile.getAbsolutePath(),
parentPath);
if (result != null) {
throw new InternalErrorException(
format("Failed to set the parent for backup %1$s to %2$s due to %3$s.",
targetFile
.getAbsolutePath(),
parentPath, result));
}
}
return null;
}
});
return new Answer(
cmd,
true,
format("Succesfully retrieved volume id %1$s for account id %2$s to %3$s from S3.",
volumeId, accountId, secondaryStorageUrl));
} catch (Exception e) {
final String errMsg = format(
"Failed to retrieve volume id %1$s for account id %2$s to %3$s from S3 due to exception %4$s",
volumeId, accountId, secondaryStorageUrl, e.getMessage());
s_logger.error(errMsg);
return new Answer(cmd, false, errMsg);
}
}
private String determineSnapshotS3Directory(final Long accountId,
final Long volumeId) {
return join(S3Utils.SEPARATOR, SNAPSHOT_ROOT_DIR, accountId, volumeId);
}
private String determineSnapshotS3Key(final Long accountId,
final Long volumeId, final String snapshotFileName) {
final String directoryName = determineSnapshotS3Directory(accountId,
volumeId);
return join(S3Utils.SEPARATOR, directoryName, snapshotFileName);
}
private String determineSnapshotLocalDirectory(
final String secondaryStorageUrl, final Long accountId,
final Long volumeId) {
return join(File.pathSeparator, getRootDir(secondaryStorageUrl),
SNAPSHOT_ROOT_DIR, accountId, volumeId);
}
public Answer execute(downloadSnapshotFromSwiftCommand cmd){
SwiftTO swift = cmd.getSwift();
String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
@ -621,6 +941,92 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
private String deleteSnapshotBackupFromLocalFileSystem(
final String secondaryStorageUrl, final Long accountId,
final Long volumeId, final String name, final Boolean deleteAllFlag) {
final String lPath = determineSnapshotLocalDirectory(
secondaryStorageUrl, accountId, volumeId)
+ File.pathSeparator
+ (deleteAllFlag ? "*" : "*" + name + "*");
final String result = deleteLocalFile(lPath);
if (result != null) {
return "failed to delete snapshot " + lPath + " , err=" + result;
}
return null;
}
private String deleteSnapshotBackupfromS3(final S3TO s3,
final String secondaryStorageUrl, final Long accountId,
final Long volumeId, final String name, final Boolean deleteAllFlag) {
try {
final String bucket = s3.getBucketName();
final String result = executeWithNoWaitLock(
determineSnapshotLockId(accountId, volumeId),
new Callable<String>() {
@Override
public String call() throws Exception {
final String innerResult = deleteSnapshotBackupFromLocalFileSystem(
secondaryStorageUrl, accountId, volumeId,
name, deleteAllFlag);
if (innerResult != null) {
return innerResult;
}
if (deleteAllFlag) {
S3Utils.deleteDirectory(
s3,
bucket,
determineSnapshotS3Directory(accountId,
volumeId));
} else {
S3Utils.deleteObject(
s3,
bucket,
determineSnapshotS3Key(
accountId,
volumeId,
determineSnapshotBackupFilename(name)));
}
return null;
}
});
return result;
} catch (Exception e) {
s_logger.error(
String.format(
"Failed to delete snapshot backup for account id %1$s volume id %2$sfrom S3.",
accountId, volumeId), e);
return e.getMessage();
}
}
private String determineSnapshotBackupFilename(final String snapshotUuid) {
return snapshotUuid + ".vhd";
}
private String determineSnapshotLockId(final Long accountId,
final Long volumeId) {
return join("_", "SNAPSHOT", accountId, volumeId);
}
protected Answer execute(final DeleteSnapshotBackupCommand cmd) {
String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
Long accountId = cmd.getAccountId();
@ -628,21 +1034,22 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
String name = cmd.getSnapshotUuid();
try {
SwiftTO swift = cmd.getSwift();
S3TO s3 = cmd.getS3();
if (swift == null) {
String parent = getRootDir(secondaryStorageUrl);
String filename;
if (cmd.isAll()) {
filename = "*";
} else {
filename = "*" + name + "*";
}
String lPath = parent + "/snapshots/" + String.valueOf(accountId) + "/" + String.valueOf(volumeId) + "/" + filename;
String result = deleteLocalFile(lPath);
final String result = deleteSnapshotBackupFromLocalFileSystem(
secondaryStorageUrl, accountId, volumeId, name,
cmd.isAll());
if (result != null) {
String errMsg = "failed to delete snapshot " + lPath + " , err=" + result;
s_logger.warn(errMsg);
return new Answer(cmd, false, errMsg);
s_logger.warn(result);
return new Answer(cmd, false, result);
}
} else if (s3 != null) {
final String result = deleteSnapshotBackupfromS3(s3,
secondaryStorageUrl, accountId, volumeId, name,
cmd.isAll());
if (result != null) {
s_logger.warn(result);
return new Answer(cmd, false, result);
}
} else {
String filename;

View File

@ -1,18 +1,18 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -31,16 +31,28 @@ package com.xensource.xenapi;
public enum APIVersion
{
API_1_1, API_1_2, API_1_3, API_1_4, API_1_5, API_1_6, API_1_7, UNKNOWN;
API_1_1, API_1_2, API_1_3, API_1_4, API_1_5, API_1_6, API_1_7, API_1_8, API_1_9, API_1_10, UNKNOWN;
public static APIVersion latest()
{
return API_1_7;
return API_1_10;
}
public static APIVersion fromMajorMinor(long major, long minor)
{
if (major == 1 && minor == 7)
if (major == 1 && minor == 10)
{
return API_1_10;
}
else if (major == 1 && minor == 9)
{
return API_1_9;
}
else if (major == 1 && minor == 8)
{
return API_1_8;
}
else if (major == 1 && minor == 7)
{
return API_1_7;
}
@ -93,6 +105,12 @@ public enum APIVersion
return "1.6";
case API_1_7:
return "1.7";
case API_1_8:
return "1.8";
case API_1_9:
return "1.9";
case API_1_10:
return "1.10";
default:
return "Unknown";
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -109,4 +111,4 @@ public class Auth extends XenAPIObject {
return Types.toSetOfString(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Blob extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Blob extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -99,6 +104,7 @@ public class Blob extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
print.printf("%1$20s: %2$s\n", "size", this.size);
print.printf("%1$20s: %2$s\n", "_public", this._public);
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
print.printf("%1$20s: %2$s\n", "mimeType", this.mimeType);
return writer.toString();
@ -113,6 +119,7 @@ public class Blob extends XenAPIObject {
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
map.put("size", this.size == null ? 0 : this.size);
map.put("public", this._public == null ? false : this._public);
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
map.put("mime_type", this.mimeType == null ? "" : this.mimeType);
return map;
@ -127,13 +134,17 @@ public class Blob extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
* Size of the binary data, in bytes
*/
public Long size;
/**
* True if the blob is publicly accessible
*/
public Boolean _public;
/**
* Time at which the data in the blob was last updated
*/
@ -265,6 +276,23 @@ public class Blob extends XenAPIObject {
return Types.toLong(result);
}
/**
* Get the public field of the given blob.
*
* @return value of the field
*/
public Boolean getPublic(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "blob.get_public";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBoolean(result);
}
/**
* Get the last_updated field of the given blob.
*
@ -331,26 +359,43 @@ public class Blob extends XenAPIObject {
return;
}
/**
* Set the public field of the given blob.
*
* @param _public New value to set
*/
public void setPublic(Connection c, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "blob.set_public";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Create a placeholder for a binary blob
*
* @param mimeType The mime-type of the blob. Defaults to 'application/octet-stream' if the empty string is supplied
* @param _public True if the blob should be publicly available
* @return The reference to the created blob
*/
public static Blob create(Connection c, String mimeType) throws
public static Blob create(Connection c, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "blob.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
}
/**
*
*
*
*/
public void destroy(Connection c) throws
@ -398,4 +443,4 @@ public class Blob extends XenAPIObject {
return Types.toMapOfBlobBlobRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -44,14 +46,14 @@ import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
*
*
*
* @author Citrix Systems, Inc.
*/
public class Bond extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Bond extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -99,6 +104,10 @@ public class Bond extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "master", this.master);
print.printf("%1$20s: %2$s\n", "slaves", this.slaves);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
print.printf("%1$20s: %2$s\n", "primarySlave", this.primarySlave);
print.printf("%1$20s: %2$s\n", "mode", this.mode);
print.printf("%1$20s: %2$s\n", "properties", this.properties);
print.printf("%1$20s: %2$s\n", "linksUp", this.linksUp);
return writer.toString();
}
@ -111,6 +120,10 @@ public class Bond extends XenAPIObject {
map.put("master", this.master == null ? new PIF("OpaqueRef:NULL") : this.master);
map.put("slaves", this.slaves == null ? new LinkedHashSet<PIF>() : this.slaves);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
map.put("primary_slave", this.primarySlave == null ? new PIF("OpaqueRef:NULL") : this.primarySlave);
map.put("mode", this.mode == null ? Types.BondMode.UNRECOGNIZED : this.mode);
map.put("properties", this.properties == null ? new HashMap<String, String>() : this.properties);
map.put("links_up", this.linksUp == null ? 0 : this.linksUp);
return map;
}
@ -130,6 +143,22 @@ public class Bond extends XenAPIObject {
* additional configuration
*/
public Map<String, String> otherConfig;
/**
* The PIF of which the IP configuration and MAC were copied to the bond, and which will receive all configuration/VLANs/VIFs on the bond if the bond is destroyed
*/
public PIF primarySlave;
/**
* The algorithm used to distribute traffic among the bonded NICs
*/
public Types.BondMode mode;
/**
* Additional configuration properties specific to the bond mode.
*/
public Map<String, String> properties;
/**
* Number of links up in this bond
*/
public Long linksUp;
}
/**
@ -235,6 +264,74 @@ public class Bond extends XenAPIObject {
return Types.toMapOfStringString(result);
}
/**
* Get the primary_slave field of the given Bond.
*
* @return value of the field
*/
public PIF getPrimarySlave(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.get_primary_slave";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPIF(result);
}
/**
* Get the mode field of the given Bond.
*
* @return value of the field
*/
public Types.BondMode getMode(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.get_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBondMode(result);
}
/**
* Get the properties field of the given Bond.
*
* @return value of the field
*/
public Map<String, String> getProperties(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.get_properties";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Get the links_up field of the given Bond.
*
* @return value of the field
*/
public Long getLinksUp(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.get_links_up";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toLong(result);
}
/**
* Set the other_config field of the given Bond.
*
@ -289,16 +386,18 @@ public class Bond extends XenAPIObject {
*
* @param network Network to add the bonded PIF to
* @param members PIFs to add to this bond
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the first of the specified 'members'
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the primary slave.
* @param mode Bonding mode to use for the new bond
* @param properties Additional configuration parameters specific to the bond mode
* @return Task
*/
public static Task createAsync(Connection c, Network network, Set<PIF> members, String MAC) throws
public static Task createAsync(Connection c, Network network, Set<PIF> members, String MAC, Types.BondMode mode, Map<String, String> properties) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.Bond.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -309,16 +408,18 @@ public class Bond extends XenAPIObject {
*
* @param network Network to add the bonded PIF to
* @param members PIFs to add to this bond
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the first of the specified 'members'
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the primary slave.
* @param mode Bonding mode to use for the new bond
* @param properties Additional configuration parameters specific to the bond mode
* @return The reference of the created Bond object
*/
public static Bond create(Connection c, Network network, Set<PIF> members, String MAC) throws
public static Bond create(Connection c, Network network, Set<PIF> members, String MAC, Types.BondMode mode, Map<String, String> properties) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(properties)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBond(result);
@ -356,6 +457,76 @@ public class Bond extends XenAPIObject {
return;
}
/**
* Change the bond mode
*
* @param value The new bond mode
* @return Task
*/
public Task setModeAsync(Connection c, Types.BondMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.Bond.set_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Change the bond mode
*
* @param value The new bond mode
*/
public void setMode(Connection c, Types.BondMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.set_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the value of a property of the bond
*
* @param name The property name
* @param value The property value
* @return Task
*/
public Task setPropertyAsync(Connection c, String name, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.Bond.set_property";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the value of a property of the bond
*
* @param name The property name
* @param value The property value
*/
public void setProperty(Connection c, String name, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Bond.set_property";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the Bonds known to the system.
*
@ -390,4 +561,4 @@ public class Bond extends XenAPIObject {
return Types.toMapOfBondBondRecord(result);
}
}
}

View File

@ -1,18 +1,18 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -54,11 +54,11 @@ public class Connection
/**
* The version of the bindings that this class belongs to.
*/
public static final String BINDINGS_VERSION = "5.6.100-1";
public static final String BINDINGS_VERSION = "6.1.0-1";
/**
* true if the connection is to the Rio edition of XenServer. Certain function calls are not allowed.
*
*
* @deprecated Use getAPIVersion() instead.
*/
@Deprecated
@ -91,12 +91,12 @@ public class Connection
/**
* Creates a connection to a particular server using a given username and password. This object can then be passed
* in to any other API calls.
*
*
* This constructor calls Session.loginWithPassword, passing itself as the first parameter.
*
*
* When this constructor is used, a call to dispose() (also called in the Connection's finalizer) will attempt a
* Session.logout on this connection.
*
*
* @deprecated Use a constructor that takes a URL as the first parameter instead.
*/
@Deprecated
@ -155,10 +155,10 @@ public class Connection
/**
* Creates a connection to a particular server using a given username and password. This object can then be passed
* in to any other API calls.
*
*
* Note this constructor does NOT call Session.loginWithPassword; the programmer is responsible for calling it,
* passing the Connection as a parameter. No attempt to connect to the server is made until login is called.
*
*
* When this constructor is used, a call to dispose() will do nothing. The programmer is responsible for manually
* logging out the Session.
*/
@ -172,7 +172,7 @@ public class Connection
/**
* Creates a connection to a particular server using a given username and password. This object can then be passed
* in to any other API calls.
*
*
* The additional sessionReference parameter must be a reference to a logged-in Session. Any method calls on this
* Connection will use it. This constructor does not call Session.loginWithPassword, and dispose() on the resulting
* Connection object does not call Session.logout. The programmer is responsible for ensuring the Session is logged
@ -285,7 +285,7 @@ public class Connection
}
/*
* Because the binding calls are constructing their own parameter lists, they need to be able to get to
* Because the binding calls are constructing their own parameter lists, they need to be able to get to
* the session reference directly. This is all rather ugly and needs redone
* Changed to public to allow easier integration with HTTP-level streaming interface,
* see CA-15447
@ -310,17 +310,17 @@ public class Connection
response.get("Status").equals("Success"))
{
// Store the Session reference and ask the server what the
// API version it's using is.
// API version it's using is.
Session session = Types.toSession(response.get("Value"));
sessionReference = session.ref;
sessionReference = session.ref;
setAPIVersion(session);
}
else if (method_call.equals("session.slave_local_login_with_password") &&
response.get("Status").equals("Success"))
{
// Store the Session reference and assume API version 1.2.
// Store the Session reference and assume the latest API version.
sessionReference = Types.toSession(response.get("Value")).ref;
apiVersion = APIVersion.API_1_2;
apiVersion = APIVersion.latest();
}
else if (method_call.equals("session.logout"))
{

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Console extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Console extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -411,4 +416,4 @@ public class Console extends XenAPIObject {
return Types.toMapOfConsoleConsoleRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Crashdump extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Crashdump extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -350,4 +355,4 @@ public class Crashdump extends XenAPIObject {
return Types.toMapOfCrashdumpCrashdumpRecord(result);
}
}
}

View File

@ -0,0 +1,303 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* DR task
*
* @author Citrix Systems, Inc.
*/
public class DRTask extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
DRTask(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a DRTask, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof DRTask)
{
DRTask other = (DRTask) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a DRTask
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "introducedSRs", this.introducedSRs);
return writer.toString();
}
/**
* Convert a DR_task.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("introduced_SRs", this.introducedSRs == null ? new LinkedHashSet<SR>() : this.introducedSRs);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* All SRs introduced by this appliance
*/
public Set<SR> introducedSRs;
}
/**
* Get a record containing the current state of the given DR_task.
*
* @return all fields from the object
*/
public DRTask.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toDRTaskRecord(result);
}
/**
* Get a reference to the DR_task instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static DRTask getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toDRTask(result);
}
/**
* Get the uuid field of the given DR_task.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the introduced_SRs field of the given DR_task.
*
* @return value of the field
*/
public Set<SR> getIntroducedSRs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_introduced_SRs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfSR(result);
}
/**
* Create a disaster recovery task which will query the supplied list of devices
*
* @param type The SR driver type of the SRs to introduce
* @param deviceConfig The device configuration of the SRs to introduce
* @param whitelist The devices to use for disaster recovery
* @return Task
*/
public static Task createAsync(Connection c, String type, Map<String, String> deviceConfig, Set<String> whitelist) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.DR_task.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(whitelist)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Create a disaster recovery task which will query the supplied list of devices
*
* @param type The SR driver type of the SRs to introduce
* @param deviceConfig The device configuration of the SRs to introduce
* @param whitelist The devices to use for disaster recovery
* @return The reference to the created task
*/
public static DRTask create(Connection c, String type, Map<String, String> deviceConfig, Set<String> whitelist) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(deviceConfig), Marshalling.toXMLRPC(whitelist)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toDRTask(result);
}
/**
* Destroy the disaster recovery task, detaching and forgetting any SRs introduced which are no longer required
*
* @return Task
*/
public Task destroyAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.DR_task.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Destroy the disaster recovery task, detaching and forgetting any SRs introduced which are no longer required
*
*/
public void destroy(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the DR_tasks known to the system.
*
* @return references to all objects
*/
public static Set<DRTask> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfDRTask(result);
}
/**
* Return a map of DR_task references to DR_task records for all DR_tasks known to the system.
*
* @return records of all objects
*/
public static Map<DRTask, DRTask.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "DR_task.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfDRTaskDRTaskRecord(result);
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class DataSource extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class DataSource extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -127,7 +132,7 @@ public class DataSource extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -156,4 +161,4 @@ public class DataSource extends XenAPIObject {
public Double value;
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Event extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Event extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -152,7 +157,7 @@ public class Event extends XenAPIObject {
}
/**
* Registers this session with the event system. Specifying the empty list will register for all classes.
* Registers this session with the event system. Specifying * as the desired class will register for all classes.
*
* @param classes register for events for the indicated classes
* @return Task
@ -170,7 +175,7 @@ public class Event extends XenAPIObject {
}
/**
* Registers this session with the event system. Specifying the empty list will register for all classes.
* Registers this session with the event system. Specifying * as the desired class will register for all classes.
*
* @param classes register for events for the indicated classes
*/
@ -238,6 +243,28 @@ public class Event extends XenAPIObject {
return Types.toSetOfEventRecord(result);
}
/**
* Blocking call which returns a (possibly empty) batch of events
*
* @param classes register for events for the indicated classes
* @param token A token representing the point from which to generate database events. The empty string represents the beginning.
* @param timeout Return after this many seconds if no events match
* @return the batch of events
*/
public static Set<Event.Record> from(Connection c, Set<String> classes, String token, Double timeout) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.SessionNotRegistered,
Types.EventsLost {
String method_call = "event.from";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes), Marshalling.toXMLRPC(token), Marshalling.toXMLRPC(timeout)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfEventRecord(result);
}
/**
* Return the ID of the next event to be generated by the system
*
@ -255,4 +282,23 @@ public class Event extends XenAPIObject {
return Types.toLong(result);
}
}
/**
* Injects an artificial event on the given object and return the corresponding ID
*
* @param clazz class of the object
* @param ref A reference to the object that will be changed.
* @return the event ID
*/
public static String inject(Connection c, String clazz, String ref) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "event.inject";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(clazz), Marshalling.toXMLRPC(ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
}

View File

@ -0,0 +1,445 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* A group of compatible GPUs across the resource pool
*
* @author Citrix Systems, Inc.
*/
public class GPUGroup extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
GPUGroup(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a GPUGroup, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof GPUGroup)
{
GPUGroup other = (GPUGroup) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a GPUGroup
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
print.printf("%1$20s: %2$s\n", "PGPUs", this.PGPUs);
print.printf("%1$20s: %2$s\n", "VGPUs", this.VGPUs);
print.printf("%1$20s: %2$s\n", "GPUTypes", this.GPUTypes);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
return writer.toString();
}
/**
* Convert a GPU_group.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
map.put("PGPUs", this.PGPUs == null ? new LinkedHashSet<PGPU>() : this.PGPUs);
map.put("VGPUs", this.VGPUs == null ? new LinkedHashSet<VGPU>() : this.VGPUs);
map.put("GPU_types", this.GPUTypes == null ? new LinkedHashSet<String>() : this.GPUTypes);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* a human-readable name
*/
public String nameLabel;
/**
* a notes field containing human-readable description
*/
public String nameDescription;
/**
* List of pGPUs in the group
*/
public Set<PGPU> PGPUs;
/**
* List of vGPUs using the group
*/
public Set<VGPU> VGPUs;
/**
* List of GPU types (vendor+device ID) that can be in this group
*/
public Set<String> GPUTypes;
/**
* Additional configuration
*/
public Map<String, String> otherConfig;
}
/**
* Get a record containing the current state of the given GPU_group.
*
* @return all fields from the object
*/
public GPUGroup.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toGPUGroupRecord(result);
}
/**
* Get a reference to the GPU_group instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static GPUGroup getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toGPUGroup(result);
}
/**
* Get all the GPU_group instances with the given label.
*
* @param label label of object to return
* @return references to objects with matching names
*/
public static Set<GPUGroup> getByNameLabel(Connection c, String label) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_by_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfGPUGroup(result);
}
/**
* Get the uuid field of the given GPU_group.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the name/label field of the given GPU_group.
*
* @return value of the field
*/
public String getNameLabel(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the name/description field of the given GPU_group.
*
* @return value of the field
*/
public String getNameDescription(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the PGPUs field of the given GPU_group.
*
* @return value of the field
*/
public Set<PGPU> getPGPUs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_PGPUs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPGPU(result);
}
/**
* Get the VGPUs field of the given GPU_group.
*
* @return value of the field
*/
public Set<VGPU> getVGPUs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_VGPUs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVGPU(result);
}
/**
* Get the GPU_types field of the given GPU_group.
*
* @return value of the field
*/
public Set<String> getGPUTypes(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_GPU_types";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfString(result);
}
/**
* Get the other_config field of the given GPU_group.
*
* @return value of the field
*/
public Map<String, String> getOtherConfig(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Set the name/label field of the given GPU_group.
*
* @param label New value to set
*/
public void setNameLabel(Connection c, String label) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name/description field of the given GPU_group.
*
* @param description New value to set
*/
public void setNameDescription(Connection c, String description) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the other_config field of the given GPU_group.
*
* @param otherConfig New value to set
*/
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.set_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Add the given key-value pair to the other_config field of the given GPU_group.
*
* @param key Key to add
* @param value Value to add
*/
public void addToOtherConfig(Connection c, String key, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.add_to_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Remove the given key and its corresponding value from the other_config field of the given GPU_group. If the key is not in that Map, then do nothing.
*
* @param key Key to remove
*/
public void removeFromOtherConfig(Connection c, String key) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.remove_from_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the GPU_groups known to the system.
*
* @return references to all objects
*/
public static Set<GPUGroup> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfGPUGroup(result);
}
/**
* Return a map of GPU_group references to GPU_group records for all GPU_groups known to the system.
*
* @return records of all objects
*/
public static Map<GPUGroup, GPUGroup.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "GPU_group.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfGPUGroupGPUGroupRecord(result);
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Host extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Host extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -139,6 +144,9 @@ public class Host extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "powerOnMode", this.powerOnMode);
print.printf("%1$20s: %2$s\n", "powerOnConfig", this.powerOnConfig);
print.printf("%1$20s: %2$s\n", "localCacheSr", this.localCacheSr);
print.printf("%1$20s: %2$s\n", "chipsetInfo", this.chipsetInfo);
print.printf("%1$20s: %2$s\n", "PCIs", this.PCIs);
print.printf("%1$20s: %2$s\n", "PGPUs", this.PGPUs);
return writer.toString();
}
@ -191,6 +199,9 @@ public class Host extends XenAPIObject {
map.put("power_on_mode", this.powerOnMode == null ? "" : this.powerOnMode);
map.put("power_on_config", this.powerOnConfig == null ? new HashMap<String, String>() : this.powerOnConfig);
map.put("local_cache_sr", this.localCacheSr == null ? new SR("OpaqueRef:NULL") : this.localCacheSr);
map.put("chipset_info", this.chipsetInfo == null ? new HashMap<String, String>() : this.chipsetInfo);
map.put("PCIs", this.PCIs == null ? new LinkedHashSet<PCI>() : this.PCIs);
map.put("PGPUs", this.PGPUs == null ? new LinkedHashSet<PGPU>() : this.PGPUs);
return map;
}
@ -203,7 +214,7 @@ public class Host extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -370,6 +381,18 @@ public class Host extends XenAPIObject {
* The SR that is used as a local cache
*/
public SR localCacheSr;
/**
* Information about chipset features
*/
public Map<String, String> chipsetInfo;
/**
* List of PCI devices in the host
*/
public Set<PCI> PCIs;
/**
* List of physical GPUs in the host
*/
public Set<PGPU> PGPUs;
}
/**
@ -1173,6 +1196,57 @@ public class Host extends XenAPIObject {
return Types.toSR(result);
}
/**
* Get the chipset_info field of the given host.
*
* @return value of the field
*/
public Map<String, String> getChipsetInfo(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.get_chipset_info";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Get the PCIs field of the given host.
*
* @return value of the field
*/
public Set<PCI> getPCIs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.get_PCIs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPCI(result);
}
/**
* Get the PGPUs field of the given host.
*
* @return value of the field
*/
public Set<PGPU> getPGPUs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.get_PGPUs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPGPU(result);
}
/**
* Set the name/label field of the given host.
*
@ -1897,7 +1971,7 @@ public class Host extends XenAPIObject {
}
/**
*
*
*
* @return A set of data sources
*/
@ -2031,10 +2105,11 @@ public class Host extends XenAPIObject {
/**
* Return a set of VMs which are not co-operating with the host's memory control system
* @deprecated
*
* @return Task
*/
public Task getUncooperativeResidentVMsAsync(Connection c) throws
@Deprecated public Task getUncooperativeResidentVMsAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -2048,10 +2123,11 @@ public class Host extends XenAPIObject {
/**
* Return a set of VMs which are not co-operating with the host's memory control system
* @deprecated
*
* @return VMs which are not co-operating
*/
public Set<VM> getUncooperativeResidentVMs(Connection c) throws
@Deprecated public Set<VM> getUncooperativeResidentVMs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -2193,7 +2269,41 @@ public class Host extends XenAPIObject {
}
/**
*
* Returns the management interface for the specified host
*
* @return Task
*/
public Task getManagementIfaceAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.host.get_management_interface";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Returns the management interface for the specified host
*
* @return The managment interface for the host
*/
public PIF getManagementIface(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.get_management_interface";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPIF(result);
}
/**
*
*
* @return An XML fragment containing the system status capabilities.
*/
@ -2377,15 +2487,16 @@ public class Host extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return Task
*/
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.host.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -2396,15 +2507,16 @@ public class Host extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return The reference of the blob, needed for populating its data
*/
public Blob createNewBlob(Connection c, String name, String mimeType) throws
public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
@ -2635,7 +2747,7 @@ public class Host extends XenAPIObject {
}
/**
* Set the power-on-mode, host, user and password
* Set the power-on-mode, host, user and password
*
* @param powerOnMode power-on-mode can be empty,iLO,wake-on-lan, DRAC or other
* @param powerOnConfig Power on config
@ -2654,7 +2766,7 @@ public class Host extends XenAPIObject {
}
/**
* Set the power-on-mode, host, user and password
* Set the power-on-mode, host, user and password
*
* @param powerOnMode power-on-mode can be empty,iLO,wake-on-lan, DRAC or other
* @param powerOnConfig Power on config
@ -2732,6 +2844,44 @@ public class Host extends XenAPIObject {
return;
}
/**
* Prepare to receive a VM, returning a token which can be passed to VM.migrate.
*
* @param network The network through which migration traffic should be received.
* @param options Extra configuration operations
* @return Task
*/
public Task migrateReceiveAsync(Connection c, Network network, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.host.migrate_receive";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Prepare to receive a VM, returning a token which can be passed to VM.migrate.
*
* @param network The network through which migration traffic should be received.
* @param options Extra configuration operations
* @return A value which should be passed to VM.migrate
*/
public Map<String, String> migrateReceive(Connection c, Network network, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "host.migrate_receive";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Return a list of all the hosts known to the system.
*
@ -2766,4 +2916,4 @@ public class Host extends XenAPIObject {
return Types.toMapOfHostHostRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class HostCpu extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class HostCpu extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -528,4 +533,4 @@ public class HostCpu extends XenAPIObject {
return Types.toMapOfHostCpuHostCpuRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class HostCrashdump extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class HostCrashdump extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -409,4 +414,4 @@ public class HostCrashdump extends XenAPIObject {
return Types.toMapOfHostCrashdumpHostCrashdumpRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class HostMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class HostMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -365,4 +370,4 @@ public class HostMetrics extends XenAPIObject {
return Types.toMapOfHostMetricsHostMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class HostPatch extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class HostPatch extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -135,7 +140,7 @@ public class HostPatch extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -544,4 +549,4 @@ public class HostPatch extends XenAPIObject {
return Types.toMapOfHostPatchHostPatchRecord(result);
}
}
}

View File

@ -1,18 +1,18 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Message extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Message extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -151,7 +156,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @param name The name of the message
* @param priority The priority of the message
@ -173,7 +178,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
*/
public void destroy(Connection c) throws
@ -188,7 +193,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @param cls The class of object
* @param objUuid The uuid of the object
@ -208,7 +213,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @return The references to the messages
*/
@ -225,7 +230,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @param since The cutoff time
* @return The relevant messages
@ -243,7 +248,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @return The message record
*/
@ -260,7 +265,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @param uuid The uuid of the message
* @return The message reference
@ -278,7 +283,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @return The messages
*/
@ -295,7 +300,7 @@ public class Message extends XenAPIObject {
}
/**
*
*
*
* @param expr The expression to match (not currently used)
* @return The messages
@ -312,4 +317,4 @@ public class Message extends XenAPIObject {
return Types.toMapOfMessageMessageRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Network extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Network extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -107,6 +112,7 @@ public class Network extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "bridge", this.bridge);
print.printf("%1$20s: %2$s\n", "blobs", this.blobs);
print.printf("%1$20s: %2$s\n", "tags", this.tags);
print.printf("%1$20s: %2$s\n", "defaultLockingMode", this.defaultLockingMode);
return writer.toString();
}
@ -127,6 +133,7 @@ public class Network extends XenAPIObject {
map.put("bridge", this.bridge == null ? "" : this.bridge);
map.put("blobs", this.blobs == null ? new HashMap<String, Blob>() : this.blobs);
map.put("tags", this.tags == null ? new LinkedHashSet<String>() : this.tags);
map.put("default_locking_mode", this.defaultLockingMode == null ? Types.NetworkDefaultLockingMode.UNRECOGNIZED : this.defaultLockingMode);
return map;
}
@ -139,7 +146,7 @@ public class Network extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -178,6 +185,10 @@ public class Network extends XenAPIObject {
* user-specified tags for categorization purposes
*/
public Set<String> tags;
/**
* The network will use this value to determine the behaviour of all VIFs where locking_mode = default
*/
public Types.NetworkDefaultLockingMode defaultLockingMode;
}
/**
@ -507,6 +518,23 @@ public class Network extends XenAPIObject {
return Types.toSetOfString(result);
}
/**
* Get the default_locking_mode field of the given network.
*
* @return value of the field
*/
public Types.NetworkDefaultLockingMode getDefaultLockingMode(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "network.get_default_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toNetworkDefaultLockingMode(result);
}
/**
* Set the name/label field of the given network.
*
@ -657,15 +685,16 @@ public class Network extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return Task
*/
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.network.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -676,20 +705,55 @@ public class Network extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return The reference of the blob, needed for populating its data
*/
public Blob createNewBlob(Connection c, String name, String mimeType) throws
public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "network.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
}
/**
* Set the default locking mode for VIFs attached to this network
*
* @param value The default locking mode for VIFs attached to this network.
* @return Task
*/
public Task setDefaultLockingModeAsync(Connection c, Types.NetworkDefaultLockingMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.network.set_default_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the default locking mode for VIFs attached to this network
*
* @param value The default locking mode for VIFs attached to this network.
*/
public void setDefaultLockingMode(Connection c, Types.NetworkDefaultLockingMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "network.set_default_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the networks known to the system.
*
@ -724,4 +788,4 @@ public class Network extends XenAPIObject {
return Types.toMapOfNetworkNetworkRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class PBD extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class PBD extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -534,4 +539,4 @@ public class PBD extends XenAPIObject {
return Types.toMapOfPBDPBDRecord(result);
}
}
}

View File

@ -0,0 +1,418 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* A PCI device
*
* @author Citrix Systems, Inc.
*/
public class PCI extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
PCI(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a PCI, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof PCI)
{
PCI other = (PCI) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a PCI
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "clazzName", this.clazzName);
print.printf("%1$20s: %2$s\n", "vendorName", this.vendorName);
print.printf("%1$20s: %2$s\n", "deviceName", this.deviceName);
print.printf("%1$20s: %2$s\n", "host", this.host);
print.printf("%1$20s: %2$s\n", "pciId", this.pciId);
print.printf("%1$20s: %2$s\n", "dependencies", this.dependencies);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
return writer.toString();
}
/**
* Convert a PCI.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("class_name", this.clazzName == null ? "" : this.clazzName);
map.put("vendor_name", this.vendorName == null ? "" : this.vendorName);
map.put("device_name", this.deviceName == null ? "" : this.deviceName);
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
map.put("pci_id", this.pciId == null ? "" : this.pciId);
map.put("dependencies", this.dependencies == null ? new LinkedHashSet<PCI>() : this.dependencies);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* PCI class name
*/
public String clazzName;
/**
* Vendor name
*/
public String vendorName;
/**
* Device name
*/
public String deviceName;
/**
* Physical machine that owns the PCI device
*/
public Host host;
/**
* PCI ID of the physical device
*/
public String pciId;
/**
* List of dependent PCI devices
*/
public Set<PCI> dependencies;
/**
* Additional configuration
*/
public Map<String, String> otherConfig;
}
/**
* Get a record containing the current state of the given PCI.
*
* @return all fields from the object
*/
public PCI.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPCIRecord(result);
}
/**
* Get a reference to the PCI instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static PCI getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPCI(result);
}
/**
* Get the uuid field of the given PCI.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the class_name field of the given PCI.
*
* @return value of the field
*/
public String getClazzName(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_class_name";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the vendor_name field of the given PCI.
*
* @return value of the field
*/
public String getVendorName(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_vendor_name";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the device_name field of the given PCI.
*
* @return value of the field
*/
public String getDeviceName(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_device_name";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the host field of the given PCI.
*
* @return value of the field
*/
public Host getHost(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_host";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toHost(result);
}
/**
* Get the pci_id field of the given PCI.
*
* @return value of the field
*/
public String getPciId(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_pci_id";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the dependencies field of the given PCI.
*
* @return value of the field
*/
public Set<PCI> getDependencies(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_dependencies";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPCI(result);
}
/**
* Get the other_config field of the given PCI.
*
* @return value of the field
*/
public Map<String, String> getOtherConfig(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Set the other_config field of the given PCI.
*
* @param otherConfig New value to set
*/
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.set_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Add the given key-value pair to the other_config field of the given PCI.
*
* @param key Key to add
* @param value Value to add
*/
public void addToOtherConfig(Connection c, String key, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.add_to_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Remove the given key and its corresponding value from the other_config field of the given PCI. If the key is not in that Map, then do nothing.
*
* @param key Key to remove
*/
public void removeFromOtherConfig(Connection c, String key) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.remove_from_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the PCIs known to the system.
*
* @return references to all objects
*/
public static Set<PCI> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPCI(result);
}
/**
* Return a map of PCI references to PCI records for all PCIs known to the system.
*
* @return records of all objects
*/
public static Map<PCI, PCI.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PCI.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfPCIPCIRecord(result);
}
}

View File

@ -0,0 +1,349 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* A physical GPU (pGPU)
*
* @author Citrix Systems, Inc.
*/
public class PGPU extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
PGPU(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a PGPU, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof PGPU)
{
PGPU other = (PGPU) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a PGPU
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "PCI", this.PCI);
print.printf("%1$20s: %2$s\n", "GPUGroup", this.GPUGroup);
print.printf("%1$20s: %2$s\n", "host", this.host);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
return writer.toString();
}
/**
* Convert a PGPU.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("PCI", this.PCI == null ? new PCI("OpaqueRef:NULL") : this.PCI);
map.put("GPU_group", this.GPUGroup == null ? new GPUGroup("OpaqueRef:NULL") : this.GPUGroup);
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* Link to underlying PCI device
*/
public PCI PCI;
/**
* GPU group the pGPU is contained in
*/
public GPUGroup GPUGroup;
/**
* Host that own the GPU
*/
public Host host;
/**
* Additional configuration
*/
public Map<String, String> otherConfig;
}
/**
* Get a record containing the current state of the given PGPU.
*
* @return all fields from the object
*/
public PGPU.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPGPURecord(result);
}
/**
* Get a reference to the PGPU instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static PGPU getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPGPU(result);
}
/**
* Get the uuid field of the given PGPU.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the PCI field of the given PGPU.
*
* @return value of the field
*/
public PCI getPCI(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_PCI";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPCI(result);
}
/**
* Get the GPU_group field of the given PGPU.
*
* @return value of the field
*/
public GPUGroup getGPUGroup(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_GPU_group";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toGPUGroup(result);
}
/**
* Get the host field of the given PGPU.
*
* @return value of the field
*/
public Host getHost(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_host";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toHost(result);
}
/**
* Get the other_config field of the given PGPU.
*
* @return value of the field
*/
public Map<String, String> getOtherConfig(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Set the other_config field of the given PGPU.
*
* @param otherConfig New value to set
*/
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.set_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Add the given key-value pair to the other_config field of the given PGPU.
*
* @param key Key to add
* @param value Value to add
*/
public void addToOtherConfig(Connection c, String key, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.add_to_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Remove the given key and its corresponding value from the other_config field of the given PGPU. If the key is not in that Map, then do nothing.
*
* @param key Key to remove
*/
public void removeFromOtherConfig(Connection c, String key) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.remove_from_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the PGPUs known to the system.
*
* @return references to all objects
*/
public static Set<PGPU> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPGPU(result);
}
/**
* Return a map of PGPU references to PGPU records for all PGPUs known to the system.
*
* @return records of all objects
*/
public static Map<PGPU, PGPU.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PGPU.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfPGPUPGPURecord(result);
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class PIF extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class PIF extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -119,6 +124,10 @@ public class PIF extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "disallowUnplug", this.disallowUnplug);
print.printf("%1$20s: %2$s\n", "tunnelAccessPIFOf", this.tunnelAccessPIFOf);
print.printf("%1$20s: %2$s\n", "tunnelTransportPIFOf", this.tunnelTransportPIFOf);
print.printf("%1$20s: %2$s\n", "ipv6ConfigurationMode", this.ipv6ConfigurationMode);
print.printf("%1$20s: %2$s\n", "IPv6", this.IPv6);
print.printf("%1$20s: %2$s\n", "ipv6Gateway", this.ipv6Gateway);
print.printf("%1$20s: %2$s\n", "primaryAddressType", this.primaryAddressType);
return writer.toString();
}
@ -151,6 +160,10 @@ public class PIF extends XenAPIObject {
map.put("disallow_unplug", this.disallowUnplug == null ? false : this.disallowUnplug);
map.put("tunnel_access_PIF_of", this.tunnelAccessPIFOf == null ? new LinkedHashSet<Tunnel>() : this.tunnelAccessPIFOf);
map.put("tunnel_transport_PIF_of", this.tunnelTransportPIFOf == null ? new LinkedHashSet<Tunnel>() : this.tunnelTransportPIFOf);
map.put("ipv6_configuration_mode", this.ipv6ConfigurationMode == null ? Types.Ipv6ConfigurationMode.UNRECOGNIZED : this.ipv6ConfigurationMode);
map.put("IPv6", this.IPv6 == null ? new LinkedHashSet<String>() : this.IPv6);
map.put("ipv6_gateway", this.ipv6Gateway == null ? "" : this.ipv6Gateway);
map.put("primary_address_type", this.primaryAddressType == null ? Types.PrimaryAddressType.UNRECOGNIZED : this.primaryAddressType);
return map;
}
@ -250,6 +263,22 @@ public class PIF extends XenAPIObject {
* Indicates to which tunnel this PIF provides transport
*/
public Set<Tunnel> tunnelTransportPIFOf;
/**
* Sets if and how this interface gets an IPv6 address
*/
public Types.Ipv6ConfigurationMode ipv6ConfigurationMode;
/**
* IPv6 address
*/
public Set<String> IPv6;
/**
* IPv6 gateway
*/
public String ipv6Gateway;
/**
* Which protocol should define the primary address of this interface
*/
public Types.PrimaryAddressType primaryAddressType;
}
/**
@ -695,6 +724,74 @@ public class PIF extends XenAPIObject {
return Types.toSetOfTunnel(result);
}
/**
* Get the ipv6_configuration_mode field of the given PIF.
*
* @return value of the field
*/
public Types.Ipv6ConfigurationMode getIpv6ConfigurationMode(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.get_ipv6_configuration_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toIpv6ConfigurationMode(result);
}
/**
* Get the IPv6 field of the given PIF.
*
* @return value of the field
*/
public Set<String> getIPv6(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.get_IPv6";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfString(result);
}
/**
* Get the ipv6_gateway field of the given PIF.
*
* @return value of the field
*/
public String getIpv6Gateway(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.get_ipv6_gateway";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the primary_address_type field of the given PIF.
*
* @return value of the field
*/
public Types.PrimaryAddressType getPrimaryAddressType(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.get_primary_address_type";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPrimaryAddressType(result);
}
/**
* Set the other_config field of the given PIF.
*
@ -884,6 +981,80 @@ public class PIF extends XenAPIObject {
return;
}
/**
* Reconfigure the IPv6 address settings for this interface
*
* @param mode whether to use dynamic/static/no-assignment
* @param IPv6 the new IPv6 address (in <addr>/<prefix length> format)
* @param gateway the new gateway
* @param DNS the new DNS settings
* @return Task
*/
public Task reconfigureIpv6Async(Connection c, Types.Ipv6ConfigurationMode mode, String IPv6, String gateway, String DNS) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.PIF.reconfigure_ipv6";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Reconfigure the IPv6 address settings for this interface
*
* @param mode whether to use dynamic/static/no-assignment
* @param IPv6 the new IPv6 address (in <addr>/<prefix length> format)
* @param gateway the new gateway
* @param DNS the new DNS settings
*/
public void reconfigureIpv6(Connection c, Types.Ipv6ConfigurationMode mode, String IPv6, String gateway, String DNS) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.reconfigure_ipv6";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(mode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Change the primary address type used by this PIF
*
* @param primaryAddressType Whether to prefer IPv4 or IPv6 connections
* @return Task
*/
public Task setPrimaryAddressTypeAsync(Connection c, Types.PrimaryAddressType primaryAddressType) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.PIF.set_primary_address_type";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(primaryAddressType)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Change the primary address type used by this PIF
*
* @param primaryAddressType Whether to prefer IPv4 or IPv6 connections
*/
public void setPrimaryAddressType(Connection c, Types.PrimaryAddressType primaryAddressType) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.set_primary_address_type";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(primaryAddressType)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Scan for physical interfaces on a host and create PIF objects to represent them
*
@ -918,42 +1089,6 @@ public class PIF extends XenAPIObject {
return;
}
/**
* Scan for physical interfaces on a host and create PIF objects to represent them. Use BIOS-based device names.
*
* @param host The host on which to scan
* @return Task
*/
public static Task scanBiosAsync(Connection c, Host host) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.PIF.scan_bios";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Scan for physical interfaces on a host and create PIF objects to represent them. Use BIOS-based device names.
*
* @param host The host on which to scan
* @return List of newly created PIFs
*/
public static Set<PIF> scanBios(Connection c, Host host) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.scan_bios";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(host)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPIF(result);
}
/**
* Create a PIF object matching a particular network interface
*
@ -1097,32 +1232,36 @@ public class PIF extends XenAPIObject {
/**
* Create a new PIF record in the database only
*
* @param device
* @param network
* @param host
* @param MAC
* @param MTU
* @param VLAN
* @param physical
* @param ipConfigurationMode
* @param IP
* @param netmask
* @param gateway
* @param DNS
* @param bondSlaveOf
* @param VLANMasterOf
* @param management
* @param otherConfig
* @param disallowUnplug
* @param device
* @param network
* @param host
* @param MAC
* @param MTU
* @param VLAN
* @param physical
* @param ipConfigurationMode
* @param IP
* @param netmask
* @param gateway
* @param DNS
* @param bondSlaveOf
* @param VLANMasterOf
* @param management
* @param otherConfig
* @param disallowUnplug
* @param ipv6ConfigurationMode
* @param IPv6
* @param ipv6Gateway
* @param primaryAddressType
* @return Task
*/
public static Task dbIntroduceAsync(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map<String, String> otherConfig, Boolean disallowUnplug) throws
public static Task dbIntroduceAsync(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map<String, String> otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set<String> IPv6, String ipv6Gateway, Types.PrimaryAddressType primaryAddressType) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.PIF.db_introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -1131,32 +1270,36 @@ public class PIF extends XenAPIObject {
/**
* Create a new PIF record in the database only
*
* @param device
* @param network
* @param host
* @param MAC
* @param MTU
* @param VLAN
* @param physical
* @param ipConfigurationMode
* @param IP
* @param netmask
* @param gateway
* @param DNS
* @param bondSlaveOf
* @param VLANMasterOf
* @param management
* @param otherConfig
* @param disallowUnplug
* @param device
* @param network
* @param host
* @param MAC
* @param MTU
* @param VLAN
* @param physical
* @param ipConfigurationMode
* @param IP
* @param netmask
* @param gateway
* @param DNS
* @param bondSlaveOf
* @param VLANMasterOf
* @param management
* @param otherConfig
* @param disallowUnplug
* @param ipv6ConfigurationMode
* @param IPv6
* @param ipv6Gateway
* @param primaryAddressType
* @return The ref of the newly created PIF record.
*/
public static PIF dbIntroduce(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map<String, String> otherConfig, Boolean disallowUnplug) throws
public static PIF dbIntroduce(Connection c, String device, Network network, Host host, String MAC, Long MTU, Long VLAN, Boolean physical, Types.IpConfigurationMode ipConfigurationMode, String IP, String netmask, String gateway, String DNS, Bond bondSlaveOf, VLAN VLANMasterOf, Boolean management, Map<String, String> otherConfig, Boolean disallowUnplug, Types.Ipv6ConfigurationMode ipv6ConfigurationMode, Set<String> IPv6, String ipv6Gateway, Types.PrimaryAddressType primaryAddressType) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "PIF.db_introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(host), Marshalling.toXMLRPC(MAC), Marshalling.toXMLRPC(MTU), Marshalling.toXMLRPC(VLAN), Marshalling.toXMLRPC(physical), Marshalling.toXMLRPC(ipConfigurationMode), Marshalling.toXMLRPC(IP), Marshalling.toXMLRPC(netmask), Marshalling.toXMLRPC(gateway), Marshalling.toXMLRPC(DNS), Marshalling.toXMLRPC(bondSlaveOf), Marshalling.toXMLRPC(VLANMasterOf), Marshalling.toXMLRPC(management), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(disallowUnplug), Marshalling.toXMLRPC(ipv6ConfigurationMode), Marshalling.toXMLRPC(IPv6), Marshalling.toXMLRPC(ipv6Gateway), Marshalling.toXMLRPC(primaryAddressType)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toPIF(result);
@ -1228,4 +1371,4 @@ public class PIF extends XenAPIObject {
return Types.toMapOfPIFPIFRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class PIFMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class PIFMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -525,4 +530,4 @@ public class PIFMetrics extends XenAPIObject {
return Types.toMapOfPIFMetricsPIFMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Pool extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Pool extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -121,6 +126,7 @@ public class Pool extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "redoLogVdi", this.redoLogVdi);
print.printf("%1$20s: %2$s\n", "vswitchController", this.vswitchController);
print.printf("%1$20s: %2$s\n", "restrictions", this.restrictions);
print.printf("%1$20s: %2$s\n", "metadataVDIs", this.metadataVDIs);
return writer.toString();
}
@ -155,6 +161,7 @@ public class Pool extends XenAPIObject {
map.put("redo_log_vdi", this.redoLogVdi == null ? new VDI("OpaqueRef:NULL") : this.redoLogVdi);
map.put("vswitch_controller", this.vswitchController == null ? "" : this.vswitchController);
map.put("restrictions", this.restrictions == null ? new HashMap<String, String>() : this.restrictions);
map.put("metadata_VDIs", this.metadataVDIs == null ? new LinkedHashSet<VDI>() : this.metadataVDIs);
return map;
}
@ -262,6 +269,10 @@ public class Pool extends XenAPIObject {
* Pool-wide restrictions currently in effect
*/
public Map<String, String> restrictions;
/**
* The set of currently known metadata VDIs for this pool
*/
public Set<VDI> metadataVDIs;
}
/**
@ -741,6 +752,23 @@ public class Pool extends XenAPIObject {
return Types.toMapOfStringString(result);
}
/**
* Get the metadata_VDIs field of the given pool.
*
* @return value of the field
*/
public Set<VDI> getMetadataVDIs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "pool.get_metadata_VDIs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVDI(result);
}
/**
* Set the name_label field of the given pool.
*
@ -1537,15 +1565,16 @@ public class Pool extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return Task
*/
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.pool.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -1556,15 +1585,16 @@ public class Pool extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return The reference of the blob, needed for populating its data
*/
public Blob createNewBlob(Connection c, String name, String mimeType) throws
public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "pool.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
@ -1798,9 +1828,9 @@ public class Pool extends XenAPIObject {
/**
* Send the given body to the given host and port, using HTTPS, and print the response. This is used for debugging the SSL layer.
*
* @param host
* @param port
* @param body
* @param host
* @param port
* @param body
* @return Task
*/
public static Task sendTestPostAsync(Connection c, String host, Long port, String body) throws
@ -1818,9 +1848,9 @@ public class Pool extends XenAPIObject {
/**
* Send the given body to the given host and port, using HTTPS, and print the response. This is used for debugging the SSL layer.
*
* @param host
* @param port
* @param body
* @param host
* @param port
* @param body
* @return The response
*/
public static String sendTestPost(Connection c, String host, Long port, String body) throws
@ -2291,4 +2321,4 @@ public class Pool extends XenAPIObject {
return Types.toMapOfPoolPoolRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class PoolPatch extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class PoolPatch extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -133,7 +138,7 @@ public class PoolPatch extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -522,7 +527,7 @@ public class PoolPatch extends XenAPIObject {
}
/**
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
* Removes the patch's files from the server
*
* @return Task
*/
@ -539,7 +544,7 @@ public class PoolPatch extends XenAPIObject {
}
/**
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
* Removes the patch's files from the server
*
*/
public void clean(Connection c) throws
@ -553,6 +558,38 @@ public class PoolPatch extends XenAPIObject {
return;
}
/**
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
*
* @return Task
*/
public Task poolCleanAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.pool_patch.pool_clean";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
*
*/
public void poolClean(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "pool_patch.pool_clean";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Removes the patch's files from all hosts in the pool, and removes the database entries. Only works on unapplied patches.
*
@ -585,6 +622,40 @@ public class PoolPatch extends XenAPIObject {
return;
}
/**
* Removes the patch's files from the specified host
*
* @param host The host on which to clean the patch
* @return Task
*/
public Task cleanOnHostAsync(Connection c, Host host) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.pool_patch.clean_on_host";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Removes the patch's files from the specified host
*
* @param host The host on which to clean the patch
*/
public void cleanOnHost(Connection c, Host host) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "pool_patch.clean_on_host";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the pool_patchs known to the system.
*
@ -619,4 +690,4 @@ public class PoolPatch extends XenAPIObject {
return Types.toMapOfPoolPatchPoolPatchRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Role extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Role extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -356,4 +361,4 @@ public class Role extends XenAPIObject {
return Types.toMapOfRoleRoleRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class SM extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class SM extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -139,7 +144,7 @@ public class SM extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -520,4 +525,4 @@ public class SM extends XenAPIObject {
return Types.toMapOfSMSMRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class SR extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class SR extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -113,6 +118,7 @@ public class SR extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "smConfig", this.smConfig);
print.printf("%1$20s: %2$s\n", "blobs", this.blobs);
print.printf("%1$20s: %2$s\n", "localCacheEnabled", this.localCacheEnabled);
print.printf("%1$20s: %2$s\n", "introducedBy", this.introducedBy);
return writer.toString();
}
@ -139,6 +145,7 @@ public class SR extends XenAPIObject {
map.put("sm_config", this.smConfig == null ? new HashMap<String, String>() : this.smConfig);
map.put("blobs", this.blobs == null ? new HashMap<String, Blob>() : this.blobs);
map.put("local_cache_enabled", this.localCacheEnabled == null ? false : this.localCacheEnabled);
map.put("introduced_by", this.introducedBy == null ? new DRTask("OpaqueRef:NULL") : this.introducedBy);
return map;
}
@ -151,7 +158,7 @@ public class SR extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -214,6 +221,10 @@ public class SR extends XenAPIObject {
* True if this SR is assigned to be the local cache for its host
*/
public Boolean localCacheEnabled;
/**
* The disaster recovery task which introduced this SR
*/
public DRTask introducedBy;
}
/**
@ -576,35 +587,20 @@ public class SR extends XenAPIObject {
}
/**
* Set the name/label field of the given SR.
* Get the introduced_by field of the given SR.
*
* @param label New value to set
* @return value of the field
*/
public void setNameLabel(Connection c, String label) throws
public DRTask getIntroducedBy(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.set_name_label";
String method_call = "SR.get_introduced_by";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name/description field of the given SR.
*
* @param description New value to set
*/
public void setNameDescription(Connection c, String description) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
Map response = c.dispatch(method_call, method_params);
return;
Object result = response.get("Value");
return Types.toDRTask(result);
}
/**
@ -1322,20 +1318,89 @@ public class SR extends XenAPIObject {
return;
}
/**
* Set the name label of the SR
*
* @param value The name label for the SR
* @return Task
*/
public Task setNameLabelAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the name label of the SR
*
* @param value The name label for the SR
*/
public void setNameLabel(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name description of the SR
*
* @param value The name description for the SR
* @return Task
*/
public Task setNameDescriptionAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the name description of the SR
*
* @param value The name description for the SR
*/
public void setNameDescription(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Create a placeholder for a named binary blob of data that is associated with this SR
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return Task
*/
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -1346,15 +1411,16 @@ public class SR extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return The reference of the blob, needed for populating its data
*/
public Blob createNewBlob(Connection c, String name, String mimeType) throws
public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
@ -1440,6 +1506,102 @@ public class SR extends XenAPIObject {
return;
}
/**
* Returns successfully if the given SR supports database replication. Otherwise returns an error to explain why not.
*
* @return Task
*/
public Task assertSupportsDatabaseReplicationAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.assert_supports_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Returns successfully if the given SR supports database replication. Otherwise returns an error to explain why not.
*
*/
public void assertSupportsDatabaseReplication(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.assert_supports_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
*
*
* @return Task
*/
public Task enableDatabaseReplicationAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.enable_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
*
*
*/
public void enableDatabaseReplication(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.enable_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
*
*
* @return Task
*/
public Task disableDatabaseReplicationAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.SR.disable_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
*
*
*/
public void disableDatabaseReplication(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "SR.disable_database_replication";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the SRs known to the system.
*
@ -1474,4 +1636,4 @@ public class SR extends XenAPIObject {
return Types.toMapOfSRSRRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Secret extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Secret extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -97,6 +102,7 @@ public class Secret extends XenAPIObject {
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "value", this.value);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
return writer.toString();
}
@ -107,6 +113,7 @@ public class Secret extends XenAPIObject {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("value", this.value == null ? "" : this.value);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
return map;
}
@ -118,6 +125,10 @@ public class Secret extends XenAPIObject {
* the secret
*/
public String value;
/**
* other_config
*/
public Map<String, String> otherConfig;
}
/**
@ -259,6 +270,23 @@ public class Secret extends XenAPIObject {
return Types.toString(result);
}
/**
* Get the other_config field of the given secret.
*
* @return value of the field
*/
public Map<String, String> getOtherConfig(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "secret.get_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Set the value field of the given secret.
*
@ -275,6 +303,55 @@ public class Secret extends XenAPIObject {
return;
}
/**
* Set the other_config field of the given secret.
*
* @param otherConfig New value to set
*/
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "secret.set_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Add the given key-value pair to the other_config field of the given secret.
*
* @param key Key to add
* @param value Value to add
*/
public void addToOtherConfig(Connection c, String key, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "secret.add_to_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Remove the given key and its corresponding value from the other_config field of the given secret. If the key is not in that Map, then do nothing.
*
* @param key Key to remove
*/
public void removeFromOtherConfig(Connection c, String key) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "secret.remove_from_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the secrets known to the system.
*
@ -309,4 +386,4 @@ public class Secret extends XenAPIObject {
return Types.toMapOfSecretSecretRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Session extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Session extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -667,4 +672,4 @@ public class Session extends XenAPIObject {
return;
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Subject extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Subject extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -388,4 +393,4 @@ public class Subject extends XenAPIObject {
return Types.toMapOfSubjectSubjectRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Task extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Task extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -147,7 +152,7 @@ public class Task extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -175,7 +180,7 @@ public class Task extends XenAPIObject {
*/
public Host residentOn;
/**
* if the task is still pending, this field contains the estimated fraction complete (0.-1.). If task has completed (successfully or unsuccessfully) this should be 1.
* This field contains the estimated fraction of the task which is complete. This field should not be used to determine whether the task is complete - for this the status field of the task should be used.
*/
public Double progress;
/**
@ -680,4 +685,4 @@ public class Task extends XenAPIObject {
return Types.toMapOfTaskTaskRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class Tunnel extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class Tunnel extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -466,4 +471,4 @@ public class Tunnel extends XenAPIObject {
return Types.toMapOfTunnelTunnelRecord(result);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class User extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class User extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -376,4 +381,4 @@ public class User extends XenAPIObject {
return;
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VBD extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VBD extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -1153,4 +1158,4 @@ public class VBD extends XenAPIObject {
return Types.toMapOfVBDVBDRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VBDMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VBDMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -341,4 +346,4 @@ public class VBDMetrics extends XenAPIObject {
return Types.toMapOfVBDMetricsVBDMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VDI extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VDI extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -123,6 +128,8 @@ public class VDI extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "tags", this.tags);
print.printf("%1$20s: %2$s\n", "allowCaching", this.allowCaching);
print.printf("%1$20s: %2$s\n", "onBoot", this.onBoot);
print.printf("%1$20s: %2$s\n", "metadataOfPool", this.metadataOfPool);
print.printf("%1$20s: %2$s\n", "metadataLatest", this.metadataLatest);
return writer.toString();
}
@ -159,6 +166,8 @@ public class VDI extends XenAPIObject {
map.put("tags", this.tags == null ? new LinkedHashSet<String>() : this.tags);
map.put("allow_caching", this.allowCaching == null ? false : this.allowCaching);
map.put("on_boot", this.onBoot == null ? Types.OnBoot.UNRECOGNIZED : this.onBoot);
map.put("metadata_of_pool", this.metadataOfPool == null ? new Pool("OpaqueRef:NULL") : this.metadataOfPool);
map.put("metadata_latest", this.metadataLatest == null ? false : this.metadataLatest);
return map;
}
@ -171,7 +180,7 @@ public class VDI extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -227,7 +236,7 @@ public class VDI extends XenAPIObject {
*/
public String location;
/**
*
*
*/
public Boolean managed;
/**
@ -274,6 +283,14 @@ public class VDI extends XenAPIObject {
* The behaviour of this VDI on a VM boot
*/
public Types.OnBoot onBoot;
/**
* The pool whose metadata is contained in this VDI
*/
public Pool metadataOfPool;
/**
* Whether this VDI contains the latest known accessible metadata for the pool
*/
public Boolean metadataLatest;
}
/**
@ -876,35 +893,37 @@ public class VDI extends XenAPIObject {
}
/**
* Set the name/label field of the given VDI.
* Get the metadata_of_pool field of the given VDI.
*
* @param label New value to set
* @return value of the field
*/
public void setNameLabel(Connection c, String label) throws
public Pool getMetadataOfPool(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_name_label";
String method_call = "VDI.get_metadata_of_pool";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
Object result = response.get("Value");
return Types.toPool(result);
}
/**
* Set the name/description field of the given VDI.
* Get the metadata_latest field of the given VDI.
*
* @param description New value to set
* @return value of the field
*/
public void setNameDescription(Connection c, String description) throws
public Boolean getMetadataLatest(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_name_description";
String method_call = "VDI.get_metadata_latest";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
Object result = response.get("Value");
return Types.toBoolean(result);
}
/**
@ -1380,16 +1399,23 @@ public class VDI extends XenAPIObject {
* @param location location information
* @param xenstoreData Data to insert into xenstore
* @param smConfig Storage-specific config
* @param managed Storage-specific config
* @param virtualSize Storage-specific config
* @param physicalUtilisation Storage-specific config
* @param metadataOfPool Storage-specific config
* @param isASnapshot Storage-specific config
* @param snapshotTime Storage-specific config
* @param snapshotOf Storage-specific config
* @return Task
*/
public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig) throws
public static Task introduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.SrOperationNotSupported {
String method_call = "Async.VDI.introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -1409,16 +1435,23 @@ public class VDI extends XenAPIObject {
* @param location location information
* @param xenstoreData Data to insert into xenstore
* @param smConfig Storage-specific config
* @param managed Storage-specific config
* @param virtualSize Storage-specific config
* @param physicalUtilisation Storage-specific config
* @param metadataOfPool Storage-specific config
* @param isASnapshot Storage-specific config
* @param snapshotTime Storage-specific config
* @param snapshotOf Storage-specific config
* @return The ref of the newly created VDI record.
*/
public static VDI introduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig) throws
public static VDI introduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.SrOperationNotSupported {
String method_call = "VDI.introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVDI(result);
@ -1438,15 +1471,22 @@ public class VDI extends XenAPIObject {
* @param location location information
* @param xenstoreData Data to insert into xenstore
* @param smConfig Storage-specific config
* @param managed Storage-specific config
* @param virtualSize Storage-specific config
* @param physicalUtilisation Storage-specific config
* @param metadataOfPool Storage-specific config
* @param isASnapshot Storage-specific config
* @param snapshotTime Storage-specific config
* @param snapshotOf Storage-specific config
* @return Task
*/
public static Task dbIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig) throws
public static Task dbIntroduceAsync(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.db_introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -1466,15 +1506,22 @@ public class VDI extends XenAPIObject {
* @param location location information
* @param xenstoreData Data to insert into xenstore
* @param smConfig Storage-specific config
* @param managed Storage-specific config
* @param virtualSize Storage-specific config
* @param physicalUtilisation Storage-specific config
* @param metadataOfPool Storage-specific config
* @param isASnapshot Storage-specific config
* @param snapshotTime Storage-specific config
* @param snapshotOf Storage-specific config
* @return The ref of the newly created VDI record.
*/
public static VDI dbIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig) throws
public static VDI dbIntroduce(Connection c, String uuid, String nameLabel, String nameDescription, SR SR, Types.VdiType type, Boolean sharable, Boolean readOnly, Map<String, String> otherConfig, String location, Map<String, String> xenstoreData, Map<String, String> smConfig, Boolean managed, Long virtualSize, Long physicalUtilisation, Pool metadataOfPool, Boolean isASnapshot, Date snapshotTime, VDI snapshotOf) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.db_introduce";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid), Marshalling.toXMLRPC(nameLabel), Marshalling.toXMLRPC(nameDescription), Marshalling.toXMLRPC(SR), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(sharable), Marshalling.toXMLRPC(readOnly), Marshalling.toXMLRPC(otherConfig), Marshalling.toXMLRPC(location), Marshalling.toXMLRPC(xenstoreData), Marshalling.toXMLRPC(smConfig), Marshalling.toXMLRPC(managed), Marshalling.toXMLRPC(virtualSize), Marshalling.toXMLRPC(physicalUtilisation), Marshalling.toXMLRPC(metadataOfPool), Marshalling.toXMLRPC(isASnapshot), Marshalling.toXMLRPC(snapshotTime), Marshalling.toXMLRPC(snapshotOf)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVDI(result);
@ -1710,6 +1757,138 @@ public class VDI extends XenAPIObject {
return;
}
/**
* Sets whether this VDI is a snapshot
*
* @param value The new value indicating whether this VDI is a snapshot
*/
public void setIsASnapshot(Connection c, Boolean value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_is_a_snapshot";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Sets the VDI of which this VDI is a snapshot
*
* @param value The VDI of which this VDI is a snapshot
*/
public void setSnapshotOf(Connection c, VDI value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_snapshot_of";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Sets the snapshot time of this VDI.
*
* @param value The snapshot time of this VDI.
*/
public void setSnapshotTime(Connection c, Date value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_snapshot_time";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Records the pool whose metadata is contained by this VDI.
*
* @param value The pool whose metadata is contained by this VDI
*/
public void setMetadataOfPool(Connection c, Pool value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_metadata_of_pool";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name label of the VDI. This can only happen when then its SR is currently attached.
*
* @param value The name lable for the VDI
* @return Task
*/
public Task setNameLabelAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the name label of the VDI. This can only happen when then its SR is currently attached.
*
* @param value The name lable for the VDI
*/
public void setNameLabel(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name description of the VDI. This can only happen when its SR is currently attached.
*
* @param value The name description for the VDI
* @return Task
*/
public Task setNameDescriptionAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the name description of the VDI. This can only happen when its SR is currently attached.
*
* @param value The name description for the VDI
*/
public void setNameDescription(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the value of the on_boot parameter. This value can only be changed when the VDI is not attached to a running VM.
*
@ -1778,6 +1957,112 @@ public class VDI extends XenAPIObject {
return;
}
/**
* Load the metadata found on the supplied VDI and return a session reference which can be used in XenAPI calls to query its contents.
*
* @return Task
*/
public Task openDatabaseAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.open_database";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Load the metadata found on the supplied VDI and return a session reference which can be used in XenAPI calls to query its contents.
*
* @return A session which can be used to query the database
*/
public Session openDatabase(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.open_database";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSession(result);
}
/**
* Check the VDI cache for the pool UUID of the database on this VDI.
*
* @return Task
*/
public Task readDatabasePoolUuidAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.read_database_pool_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Check the VDI cache for the pool UUID of the database on this VDI.
*
* @return The cached pool UUID of the database on the VDI.
*/
public String readDatabasePoolUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.read_database_pool_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Migrate a VDI, which may be attached to a running guest, to a different SR. The destination SR must be visible to the guest.
*
* @param sr The destination SR
* @param options Other parameters
* @return Task
*/
public Task poolMigrateAsync(Connection c, SR sr, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VDI.pool_migrate";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Migrate a VDI, which may be attached to a running guest, to a different SR. The destination SR must be visible to the guest.
*
* @param sr The destination SR
* @param options Other parameters
* @return The new reference of the migrated VDI.
*/
public VDI poolMigrate(Connection c, SR sr, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VDI.pool_migrate";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVDI(result);
}
/**
* Return a list of all the VDIs known to the system.
*
@ -1812,4 +2097,4 @@ public class VDI extends XenAPIObject {
return Types.toMapOfVDIVDIRecord(result);
}
}
}

View File

@ -0,0 +1,446 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* A virtual GPU (vGPU)
*
* @author Citrix Systems, Inc.
*/
public class VGPU extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
VGPU(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a VGPU, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof VGPU)
{
VGPU other = (VGPU) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a VGPU
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "VM", this.VM);
print.printf("%1$20s: %2$s\n", "GPUGroup", this.GPUGroup);
print.printf("%1$20s: %2$s\n", "device", this.device);
print.printf("%1$20s: %2$s\n", "currentlyAttached", this.currentlyAttached);
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
return writer.toString();
}
/**
* Convert a VGPU.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
map.put("GPU_group", this.GPUGroup == null ? new GPUGroup("OpaqueRef:NULL") : this.GPUGroup);
map.put("device", this.device == null ? "" : this.device);
map.put("currently_attached", this.currentlyAttached == null ? false : this.currentlyAttached);
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* VM that owns the vGPU
*/
public VM VM;
/**
* GPU group used by the vGPU
*/
public GPUGroup GPUGroup;
/**
* Order in which the devices are plugged into the VM
*/
public String device;
/**
* Reflects whether the virtual device is currently connected to a physical device
*/
public Boolean currentlyAttached;
/**
* Additional configuration
*/
public Map<String, String> otherConfig;
}
/**
* Get a record containing the current state of the given VGPU.
*
* @return all fields from the object
*/
public VGPU.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVGPURecord(result);
}
/**
* Get a reference to the VGPU instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static VGPU getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVGPU(result);
}
/**
* Get the uuid field of the given VGPU.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the VM field of the given VGPU.
*
* @return value of the field
*/
public VM getVM(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_VM";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVM(result);
}
/**
* Get the GPU_group field of the given VGPU.
*
* @return value of the field
*/
public GPUGroup getGPUGroup(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_GPU_group";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toGPUGroup(result);
}
/**
* Get the device field of the given VGPU.
*
* @return value of the field
*/
public String getDevice(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_device";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the currently_attached field of the given VGPU.
*
* @return value of the field
*/
public Boolean getCurrentlyAttached(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_currently_attached";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBoolean(result);
}
/**
* Get the other_config field of the given VGPU.
*
* @return value of the field
*/
public Map<String, String> getOtherConfig(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Set the other_config field of the given VGPU.
*
* @param otherConfig New value to set
*/
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.set_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Add the given key-value pair to the other_config field of the given VGPU.
*
* @param key Key to add
* @param value Value to add
*/
public void addToOtherConfig(Connection c, String key, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.add_to_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Remove the given key and its corresponding value from the other_config field of the given VGPU. If the key is not in that Map, then do nothing.
*
* @param key Key to remove
*/
public void removeFromOtherConfig(Connection c, String key) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.remove_from_other_config";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
*
*
* @param VM
* @param GPUGroup
* @param device
* @param otherConfig
* @return Task
*/
public static Task createAsync(Connection c, VM VM, GPUGroup GPUGroup, String device, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VGPU.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
*
*
* @param VM
* @param GPUGroup
* @param device
* @param otherConfig
* @return reference to the newly created object
*/
public static VGPU create(Connection c, VM VM, GPUGroup GPUGroup, String device, Map<String, String> otherConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.create";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(VM), Marshalling.toXMLRPC(GPUGroup), Marshalling.toXMLRPC(device), Marshalling.toXMLRPC(otherConfig)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVGPU(result);
}
/**
*
*
* @return Task
*/
public Task destroyAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VGPU.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
*
*
*/
public void destroy(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the VGPUs known to the system.
*
* @return references to all objects
*/
public static Set<VGPU> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVGPU(result);
}
/**
* Return a map of VGPU references to VGPU records for all VGPUs known to the system.
*
* @return records of all objects
*/
public static Map<VGPU, VGPU.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VGPU.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfVGPUVGPURecord(result);
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VIF extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VIF extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -113,6 +118,9 @@ public class VIF extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "qosSupportedAlgorithms", this.qosSupportedAlgorithms);
print.printf("%1$20s: %2$s\n", "metrics", this.metrics);
print.printf("%1$20s: %2$s\n", "MACAutogenerated", this.MACAutogenerated);
print.printf("%1$20s: %2$s\n", "lockingMode", this.lockingMode);
print.printf("%1$20s: %2$s\n", "ipv4Allowed", this.ipv4Allowed);
print.printf("%1$20s: %2$s\n", "ipv6Allowed", this.ipv6Allowed);
return writer.toString();
}
@ -139,6 +147,9 @@ public class VIF extends XenAPIObject {
map.put("qos_supported_algorithms", this.qosSupportedAlgorithms == null ? new LinkedHashSet<String>() : this.qosSupportedAlgorithms);
map.put("metrics", this.metrics == null ? new VIFMetrics("OpaqueRef:NULL") : this.metrics);
map.put("MAC_autogenerated", this.MACAutogenerated == null ? false : this.MACAutogenerated);
map.put("locking_mode", this.lockingMode == null ? Types.VifLockingMode.UNRECOGNIZED : this.lockingMode);
map.put("ipv4_allowed", this.ipv4Allowed == null ? new LinkedHashSet<String>() : this.ipv4Allowed);
map.put("ipv6_allowed", this.ipv6Allowed == null ? new LinkedHashSet<String>() : this.ipv6Allowed);
return map;
}
@ -214,6 +225,18 @@ public class VIF extends XenAPIObject {
* true if the MAC was autogenerated; false indicates it was set manually
*/
public Boolean MACAutogenerated;
/**
* current locking mode of the VIF
*/
public Types.VifLockingMode lockingMode;
/**
* A list of IPv4 addresses which can be used to filter traffic passing through this VIF
*/
public Set<String> ipv4Allowed;
/**
* A list of IPv6 addresses which can be used to filter traffic passing through this VIF
*/
public Set<String> ipv6Allowed;
}
/**
@ -627,6 +650,57 @@ public class VIF extends XenAPIObject {
return Types.toBoolean(result);
}
/**
* Get the locking_mode field of the given VIF.
*
* @return value of the field
*/
public Types.VifLockingMode getLockingMode(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.get_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVifLockingMode(result);
}
/**
* Get the ipv4_allowed field of the given VIF.
*
* @return value of the field
*/
public Set<String> getIpv4Allowed(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.get_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfString(result);
}
/**
* Get the ipv6_allowed field of the given VIF.
*
* @return value of the field
*/
public Set<String> getIpv6Allowed(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.get_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfString(result);
}
/**
* Set the other_config field of the given VIF.
*
@ -805,6 +879,276 @@ public class VIF extends XenAPIObject {
return;
}
/**
* Forcibly unplug the specified VIF
*
* @return Task
*/
public Task unplugForceAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.unplug_force";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Forcibly unplug the specified VIF
*
*/
public void unplugForce(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.unplug_force";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the locking mode for this VIF
*
* @param value The new locking mode for the VIF
* @return Task
*/
public Task setLockingModeAsync(Connection c, Types.VifLockingMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.set_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the locking mode for this VIF
*
* @param value The new locking mode for the VIF
*/
public void setLockingMode(Connection c, Types.VifLockingMode value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.set_locking_mode";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the IPv4 addresses to which traffic on this VIF can be restricted
*
* @param value The IP addresses which will be associated with the VIF
* @return Task
*/
public Task setIpv4AllowedAsync(Connection c, Set<String> value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.set_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the IPv4 addresses to which traffic on this VIF can be restricted
*
* @param value The IP addresses which will be associated with the VIF
*/
public void setIpv4Allowed(Connection c, Set<String> value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.set_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Associates an IPv4 address with this VIF
*
* @param value The IP address which will be associated with the VIF
* @return Task
*/
public Task addIpv4AllowedAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.add_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Associates an IPv4 address with this VIF
*
* @param value The IP address which will be associated with the VIF
*/
public void addIpv4Allowed(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.add_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Removes an IPv4 address from this VIF
*
* @param value The IP address which will be removed from the VIF
* @return Task
*/
public Task removeIpv4AllowedAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.remove_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Removes an IPv4 address from this VIF
*
* @param value The IP address which will be removed from the VIF
*/
public void removeIpv4Allowed(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.remove_ipv4_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the IPv6 addresses to which traffic on this VIF can be restricted
*
* @param value The IP addresses which will be associated with the VIF
* @return Task
*/
public Task setIpv6AllowedAsync(Connection c, Set<String> value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.set_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set the IPv6 addresses to which traffic on this VIF can be restricted
*
* @param value The IP addresses which will be associated with the VIF
*/
public void setIpv6Allowed(Connection c, Set<String> value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.set_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Associates an IPv6 address with this VIF
*
* @param value The IP address which will be associated with the VIF
* @return Task
*/
public Task addIpv6AllowedAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.add_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Associates an IPv6 address with this VIF
*
* @param value The IP address which will be associated with the VIF
*/
public void addIpv6Allowed(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.add_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Removes an IPv6 address from this VIF
*
* @param value The IP address which will be removed from the VIF
* @return Task
*/
public Task removeIpv6AllowedAsync(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VIF.remove_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Removes an IPv6 address from this VIF
*
* @param value The IP address which will be removed from the VIF
*/
public void removeIpv6Allowed(Connection c, String value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VIF.remove_ipv6_allowed";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the VIFs known to the system.
*
@ -839,4 +1183,4 @@ public class VIF extends XenAPIObject {
return Types.toMapOfVIFVIFRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VIFMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VIFMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -341,4 +346,4 @@ public class VIFMetrics extends XenAPIObject {
return Types.toMapOfVIFMetricsVIFMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VLAN extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VLAN extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -413,4 +418,4 @@ public class VLAN extends XenAPIObject {
return Types.toMapOfVLANVLANRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VM extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VM extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -161,6 +166,14 @@ public class VM extends XenAPIObject {
print.printf("%1$20s: %2$s\n", "biosStrings", this.biosStrings);
print.printf("%1$20s: %2$s\n", "protectionPolicy", this.protectionPolicy);
print.printf("%1$20s: %2$s\n", "isSnapshotFromVmpp", this.isSnapshotFromVmpp);
print.printf("%1$20s: %2$s\n", "appliance", this.appliance);
print.printf("%1$20s: %2$s\n", "startDelay", this.startDelay);
print.printf("%1$20s: %2$s\n", "shutdownDelay", this.shutdownDelay);
print.printf("%1$20s: %2$s\n", "order", this.order);
print.printf("%1$20s: %2$s\n", "VGPUs", this.VGPUs);
print.printf("%1$20s: %2$s\n", "attachedPCIs", this.attachedPCIs);
print.printf("%1$20s: %2$s\n", "suspendSR", this.suspendSR);
print.printf("%1$20s: %2$s\n", "version", this.version);
return writer.toString();
}
@ -235,6 +248,14 @@ public class VM extends XenAPIObject {
map.put("bios_strings", this.biosStrings == null ? new HashMap<String, String>() : this.biosStrings);
map.put("protection_policy", this.protectionPolicy == null ? new VMPP("OpaqueRef:NULL") : this.protectionPolicy);
map.put("is_snapshot_from_vmpp", this.isSnapshotFromVmpp == null ? false : this.isSnapshotFromVmpp);
map.put("appliance", this.appliance == null ? new VMAppliance("OpaqueRef:NULL") : this.appliance);
map.put("start_delay", this.startDelay == null ? 0 : this.startDelay);
map.put("shutdown_delay", this.shutdownDelay == null ? 0 : this.shutdownDelay);
map.put("order", this.order == null ? 0 : this.order);
map.put("VGPUs", this.VGPUs == null ? new LinkedHashSet<VGPU>() : this.VGPUs);
map.put("attached_PCIs", this.attachedPCIs == null ? new LinkedHashSet<PCI>() : this.attachedPCIs);
map.put("suspend_SR", this.suspendSR == null ? new SR("OpaqueRef:NULL") : this.suspendSR);
map.put("version", this.version == null ? 0 : this.version);
return map;
}
@ -259,7 +280,7 @@ public class VM extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -439,7 +460,7 @@ public class VM extends XenAPIObject {
*/
public Boolean haAlwaysRun;
/**
* Only defined if ha_always_run is set possible values: "best-effort" meaning "try to restart this VM if possible but don't consider the Pool to be overcommitted if this is not possible"; and a numerical restart priority (e.g. 1, 2, 3,...)
* has possible values: "best-effort" meaning "try to restart this VM if possible but don't consider the Pool to be overcommitted if this is not possible"; "restart" meaning "this VM should be restarted"; "" meaning "do not try to restart this VM"
*/
public String haRestartPriority;
/**
@ -502,6 +523,38 @@ public class VM extends XenAPIObject {
* true if this snapshot was created by the protection policy
*/
public Boolean isSnapshotFromVmpp;
/**
* the appliance to which this VM belongs
*/
public VMAppliance appliance;
/**
* The delay to wait before proceeding to the next order in the startup sequence (seconds)
*/
public Long startDelay;
/**
* The delay to wait before proceeding to the next order in the shutdown sequence (seconds)
*/
public Long shutdownDelay;
/**
* The point in the startup or shutdown sequence at which this VM will be started
*/
public Long order;
/**
* Virtual GPUs
*/
public Set<VGPU> VGPUs;
/**
* Currently passed-through PCI devices
*/
public Set<PCI> attachedPCIs;
/**
* The SR on which a suspend image is stored
*/
public SR suspendSR;
/**
* The number of times this VM has been recovered
*/
public Long version;
}
/**
@ -1276,10 +1329,11 @@ public class VM extends XenAPIObject {
/**
* Get the PCI_bus field of the given VM.
* @deprecated
*
* @return value of the field
*/
public String getPCIBus(Connection c) throws
@Deprecated public String getPCIBus(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -1463,10 +1517,11 @@ public class VM extends XenAPIObject {
/**
* Get the ha_always_run field of the given VM.
* @deprecated
*
* @return value of the field
*/
public Boolean getHaAlwaysRun(Connection c) throws
@Deprecated public Boolean getHaAlwaysRun(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -1750,6 +1805,142 @@ public class VM extends XenAPIObject {
return Types.toBoolean(result);
}
/**
* Get the appliance field of the given VM.
*
* @return value of the field
*/
public VMAppliance getAppliance(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_appliance";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVMAppliance(result);
}
/**
* Get the start_delay field of the given VM.
*
* @return value of the field
*/
public Long getStartDelay(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_start_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toLong(result);
}
/**
* Get the shutdown_delay field of the given VM.
*
* @return value of the field
*/
public Long getShutdownDelay(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_shutdown_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toLong(result);
}
/**
* Get the order field of the given VM.
*
* @return value of the field
*/
public Long getOrder(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_order";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toLong(result);
}
/**
* Get the VGPUs field of the given VM.
*
* @return value of the field
*/
public Set<VGPU> getVGPUs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_VGPUs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVGPU(result);
}
/**
* Get the attached_PCIs field of the given VM.
*
* @return value of the field
*/
public Set<PCI> getAttachedPCIs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_attached_PCIs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfPCI(result);
}
/**
* Get the suspend_SR field of the given VM.
*
* @return value of the field
*/
public SR getSuspendSR(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_suspend_SR";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSR(result);
}
/**
* Get the version field of the given VM.
*
* @return value of the field
*/
public Long getVersion(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.get_version";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toLong(result);
}
/**
* Set the name/label field of the given VM.
*
@ -2139,10 +2330,11 @@ public class VM extends XenAPIObject {
/**
* Set the PCI_bus field of the given VM.
* @deprecated
*
* @param PCIBus New value to set
*/
public void setPCIBus(Connection c, String PCIBus) throws
@Deprecated public void setPCIBus(Connection c, String PCIBus) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -2364,6 +2556,22 @@ public class VM extends XenAPIObject {
return;
}
/**
* Set the suspend_SR field of the given VM.
*
* @param suspendSR New value to set
*/
public void setSuspendSR(Connection c, SR suspendSR) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_suspend_SR";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(suspendSR)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Snapshots the specified VM, making a new VM. Snapshot automatically exploits the capabilities of the underlying storage repository in which the VM's disk images are stored (e.g. Copy on Write).
*
@ -3302,10 +3510,11 @@ public class VM extends XenAPIObject {
/**
* Set the value of the ha_always_run
* @deprecated
*
* @param value The value
*/
public void setHaAlwaysRun(Connection c, Boolean value) throws
@Deprecated public void setHaAlwaysRun(Connection c, Boolean value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -3599,10 +3808,11 @@ public class VM extends XenAPIObject {
/**
* Return true if the VM is currently 'co-operative' i.e. is expected to reach a balloon target and actually has done
* @deprecated
*
* @return Task
*/
public Task getCooperativeAsync(Connection c) throws
@Deprecated public Task getCooperativeAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -3616,10 +3826,11 @@ public class VM extends XenAPIObject {
/**
* Return true if the VM is currently 'co-operative' i.e. is expected to reach a balloon target and actually has done
* @deprecated
*
* @return true if the VM is currently 'co-operative'; false otherwise
*/
public Boolean getCooperative(Connection c) throws
@Deprecated public Boolean getCooperative(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
@ -3823,6 +4034,92 @@ public class VM extends XenAPIObject {
return Types.toLong(result);
}
/**
* Migrate the VM to another host. This can only be called when the specified VM is in the Running state.
*
* @param dest The result of a Host.migrate_receive call.
* @param live Live migration
* @param vdiMap Map of source VDI to destination SR
* @param vifMap Map of source VIF to destination network
* @param options Other parameters
* @return Task
*/
public Task migrateSendAsync(Connection c, Map<String, String> dest, Boolean live, Map<VDI, SR> vdiMap, Map<VIF, Network> vifMap, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmBadPowerState {
String method_call = "Async.VM.migrate_send";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Migrate the VM to another host. This can only be called when the specified VM is in the Running state.
*
* @param dest The result of a Host.migrate_receive call.
* @param live Live migration
* @param vdiMap Map of source VDI to destination SR
* @param vifMap Map of source VIF to destination network
* @param options Other parameters
*/
public void migrateSend(Connection c, Map<String, String> dest, Boolean live, Map<VDI, SR> vdiMap, Map<VIF, Network> vifMap, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmBadPowerState {
String method_call = "VM.migrate_send";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Assert whether a VM can be migrated to the specified destination.
*
* @param dest The result of a VM.migrate_receive call.
* @param live Live migration
* @param vdiMap Map of source VDI to destination SR
* @param vifMap Map of source VIF to destination network
* @param options Other parameters
* @return Task
*/
public Task assertCanMigrateAsync(Connection c, Map<String, String> dest, Boolean live, Map<VDI, SR> vdiMap, Map<VIF, Network> vifMap, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.assert_can_migrate";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Assert whether a VM can be migrated to the specified destination.
*
* @param dest The result of a VM.migrate_receive call.
* @param live Live migration
* @param vdiMap Map of source VDI to destination SR
* @param vifMap Map of source VIF to destination network
* @param options Other parameters
*/
public void assertCanMigrate(Connection c, Map<String, String> dest, Boolean live, Map<VDI, SR> vdiMap, Map<VIF, Network> vifMap, Map<String, String> options) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.assert_can_migrate";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(dest), Marshalling.toXMLRPC(live), Marshalling.toXMLRPC(vdiMap), Marshalling.toXMLRPC(vifMap), Marshalling.toXMLRPC(options)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Returns a record describing the VM's dynamic state, initialised when the VM boots and updated to reflect runtime configuration changes e.g. CPU hotplug
*
@ -3841,7 +4138,7 @@ public class VM extends XenAPIObject {
}
/**
*
*
*
* @return A set of data sources
*/
@ -4052,7 +4349,8 @@ public class VM extends XenAPIObject {
XenAPIException,
XmlRpcException,
Types.HostNotEnoughFreeMemory,
Types.VmRequiresSr {
Types.VmRequiresSr,
Types.VmHostIncompatibleVersion {
String method_call = "Async.VM.assert_can_boot_here";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
@ -4071,7 +4369,8 @@ public class VM extends XenAPIObject {
XenAPIException,
XmlRpcException,
Types.HostNotEnoughFreeMemory,
Types.VmRequiresSr {
Types.VmRequiresSr,
Types.VmHostIncompatibleVersion {
String method_call = "VM.assert_can_boot_here";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
@ -4084,15 +4383,16 @@ public class VM extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return Task
*/
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
public Task createNewBlobAsync(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
@ -4103,15 +4403,16 @@ public class VM extends XenAPIObject {
*
* @param name The name associated with the blob
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
* @param _public True if the blob should be publicly available
* @return The reference of the blob, needed for populating its data
*/
public Blob createNewBlob(Connection c, String name, String mimeType) throws
public Blob createNewBlob(Connection c, String name, String mimeType, Boolean _public) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.create_new_blob";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType), Marshalling.toXMLRPC(_public)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toBlob(result);
@ -4233,6 +4534,326 @@ public class VM extends XenAPIObject {
return;
}
/**
* Set this VM's start delay in seconds
*
* @param value This VM's start delay in seconds
* @return Task
*/
public Task setStartDelayAsync(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.set_start_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set this VM's start delay in seconds
*
* @param value This VM's start delay in seconds
*/
public void setStartDelay(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_start_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set this VM's shutdown delay in seconds
*
* @param value This VM's shutdown delay in seconds
* @return Task
*/
public Task setShutdownDelayAsync(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.set_shutdown_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set this VM's shutdown delay in seconds
*
* @param value This VM's shutdown delay in seconds
*/
public void setShutdownDelay(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_shutdown_delay";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set this VM's boot order
*
* @param value This VM's boot order
* @return Task
*/
public Task setOrderAsync(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.set_order";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set this VM's boot order
*
* @param value This VM's boot order
*/
public void setOrder(Connection c, Long value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_order";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set this VM's suspend VDI, which must be indentical to its current one
*
* @param value The suspend VDI uuid
* @return Task
*/
public Task setSuspendVDIAsync(Connection c, VDI value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.set_suspend_VDI";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Set this VM's suspend VDI, which must be indentical to its current one
*
* @param value The suspend VDI uuid
*/
public void setSuspendVDI(Connection c, VDI value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_suspend_VDI";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Assert whether all SRs required to recover this VM are available.
*
* @param sessionTo The session to which the VM is to be recovered.
* @return Task
*/
public Task assertCanBeRecoveredAsync(Connection c, Session sessionTo) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmIsPartOfAnAppliance,
Types.VmRequiresSr {
String method_call = "Async.VM.assert_can_be_recovered";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Assert whether all SRs required to recover this VM are available.
*
* @param sessionTo The session to which the VM is to be recovered.
*/
public void assertCanBeRecovered(Connection c, Session sessionTo) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmIsPartOfAnAppliance,
Types.VmRequiresSr {
String method_call = "VM.assert_can_be_recovered";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Recover the VM
*
* @param sessionTo The session to which the VM is to be recovered.
* @param force Whether the VM should replace newer versions of itself.
* @return Task
*/
public Task recoverAsync(Connection c, Session sessionTo, Boolean force) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.recover";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Recover the VM
*
* @param sessionTo The session to which the VM is to be recovered.
* @param force Whether the VM should replace newer versions of itself.
*/
public void recover(Connection c, Session sessionTo, Boolean force) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.recover";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Import using a conversion service.
*
* @param type Type of the conversion
* @param username Admin username on the host
* @param password Password on the host
* @param sr The destination SR
* @param remoteConfig Remote configuration options
* @return Task
*/
public static Task importConvertAsync(Connection c, String type, String username, String password, SR sr, Map<String, String> remoteConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.import_convert";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Import using a conversion service.
*
* @param type Type of the conversion
* @param username Admin username on the host
* @param password Password on the host
* @param sr The destination SR
* @param remoteConfig Remote configuration options
*/
public static void importConvert(Connection c, String type, String username, String password, SR sr, Map<String, String> remoteConfig) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.import_convert";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(type), Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password), Marshalling.toXMLRPC(sr), Marshalling.toXMLRPC(remoteConfig)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Assign this VM to an appliance.
*
* @param value The appliance to which this VM should be assigned.
* @return Task
*/
public Task setApplianceAsync(Connection c, VMAppliance value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.set_appliance";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Assign this VM to an appliance.
*
* @param value The appliance to which this VM should be assigned.
*/
public void setAppliance(Connection c, VMAppliance value) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.set_appliance";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Query the system services advertised by this VM and register them. This can only be applied to a system domain.
*
* @return Task
*/
public Task queryServicesAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM.query_services";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Query the system services advertised by this VM and register them. This can only be applied to a system domain.
*
* @return map of service type to name
*/
public Map<String, String> queryServices(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM.query_services";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringString(result);
}
/**
* Return a list of all the VMs known to the system.
*
@ -4267,4 +4888,4 @@ public class VM extends XenAPIObject {
return Types.toMapOfVMVMRecord(result);
}
}
}

View File

@ -0,0 +1,655 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
import com.xensource.xenapi.Types.VersionException;
import com.xensource.xenapi.Types.XenAPIException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.xmlrpc.XmlRpcException;
/**
* VM appliance
*
* @author Citrix Systems, Inc.
*/
public class VMAppliance extends XenAPIObject {
/**
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
/**
* For internal use only.
*/
VMAppliance(String ref) {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
/**
* If obj is a VMAppliance, compares XenAPI references for equality.
*/
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof VMAppliance)
{
VMAppliance other = (VMAppliance) obj;
return other.ref.equals(this.ref);
} else
{
return false;
}
}
@Override
public int hashCode()
{
return ref.hashCode();
}
/**
* Represents all the fields in a VMAppliance
*/
public static class Record implements Types.Record {
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter print = new PrintWriter(writer);
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
print.printf("%1$20s: %2$s\n", "allowedOperations", this.allowedOperations);
print.printf("%1$20s: %2$s\n", "currentOperations", this.currentOperations);
print.printf("%1$20s: %2$s\n", "VMs", this.VMs);
return writer.toString();
}
/**
* Convert a VM_appliance.Record to a Map
*/
public Map<String,Object> toMap() {
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", this.uuid == null ? "" : this.uuid);
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet<Types.VmApplianceOperation>() : this.allowedOperations);
map.put("current_operations", this.currentOperations == null ? new HashMap<String, Types.VmApplianceOperation>() : this.currentOperations);
map.put("VMs", this.VMs == null ? new LinkedHashSet<VM>() : this.VMs);
return map;
}
/**
* Unique identifier/object reference
*/
public String uuid;
/**
* a human-readable name
*/
public String nameLabel;
/**
* a notes field containing human-readable description
*/
public String nameDescription;
/**
* list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client.
*/
public Set<Types.VmApplianceOperation> allowedOperations;
/**
* links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
*/
public Map<String, Types.VmApplianceOperation> currentOperations;
/**
* all VMs in this appliance
*/
public Set<VM> VMs;
}
/**
* Get a record containing the current state of the given VM_appliance.
*
* @return all fields from the object
*/
public VMAppliance.Record getRecord(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_record";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVMApplianceRecord(result);
}
/**
* Get a reference to the VM_appliance instance with the specified UUID.
*
* @param uuid UUID of object to return
* @return reference to the object
*/
public static VMAppliance getByUuid(Connection c, String uuid) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_by_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVMAppliance(result);
}
/**
* Create a new VM_appliance instance, and return its handle.
*
* @param record All constructor arguments
* @return Task
*/
public static Task createAsync(Connection c, VMAppliance.Record record) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM_appliance.create";
String session = c.getSessionReference();
Map<String, Object> record_map = record.toMap();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Create a new VM_appliance instance, and return its handle.
*
* @param record All constructor arguments
* @return reference to the newly created object
*/
public static VMAppliance create(Connection c, VMAppliance.Record record) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.create";
String session = c.getSessionReference();
Map<String, Object> record_map = record.toMap();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toVMAppliance(result);
}
/**
* Destroy the specified VM_appliance instance.
*
* @return Task
*/
public Task destroyAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "Async.VM_appliance.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Destroy the specified VM_appliance instance.
*
*/
public void destroy(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.destroy";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Get all the VM_appliance instances with the given label.
*
* @param label label of object to return
* @return references to objects with matching names
*/
public static Set<VMAppliance> getByNameLabel(Connection c, String label) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_by_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVMAppliance(result);
}
/**
* Get the uuid field of the given VM_appliance.
*
* @return value of the field
*/
public String getUuid(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_uuid";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the name/label field of the given VM_appliance.
*
* @return value of the field
*/
public String getNameLabel(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the name/description field of the given VM_appliance.
*
* @return value of the field
*/
public String getNameDescription(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toString(result);
}
/**
* Get the allowed_operations field of the given VM_appliance.
*
* @return value of the field
*/
public Set<Types.VmApplianceOperation> getAllowedOperations(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_allowed_operations";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVmApplianceOperation(result);
}
/**
* Get the current_operations field of the given VM_appliance.
*
* @return value of the field
*/
public Map<String, Types.VmApplianceOperation> getCurrentOperations(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_current_operations";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfStringVmApplianceOperation(result);
}
/**
* Get the VMs field of the given VM_appliance.
*
* @return value of the field
*/
public Set<VM> getVMs(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_VMs";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVM(result);
}
/**
* Set the name/label field of the given VM_appliance.
*
* @param label New value to set
*/
public void setNameLabel(Connection c, String label) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.set_name_label";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Set the name/description field of the given VM_appliance.
*
* @param description New value to set
*/
public void setNameDescription(Connection c, String description) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.set_name_description";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Start all VMs in the appliance
*
* @param paused Instantiate all VMs belonging to this appliance in paused state if set to true.
* @return Task
*/
public Task startAsync(Connection c, Boolean paused) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "Async.VM_appliance.start";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(paused)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Start all VMs in the appliance
*
* @param paused Instantiate all VMs belonging to this appliance in paused state if set to true.
*/
public void start(Connection c, Boolean paused) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "VM_appliance.start";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(paused)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Perform a clean shutdown of all the VMs in the appliance
*
* @return Task
*/
public Task cleanShutdownAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "Async.VM_appliance.clean_shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Perform a clean shutdown of all the VMs in the appliance
*
*/
public void cleanShutdown(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "VM_appliance.clean_shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Perform a hard shutdown of all the VMs in the appliance
*
* @return Task
*/
public Task hardShutdownAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "Async.VM_appliance.hard_shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Perform a hard shutdown of all the VMs in the appliance
*
*/
public void hardShutdown(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "VM_appliance.hard_shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* For each VM in the appliance, try to shut it down cleanly. If this fails, perform a hard shutdown of the VM.
*
* @return Task
*/
public Task shutdownAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "Async.VM_appliance.shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* For each VM in the appliance, try to shut it down cleanly. If this fails, perform a hard shutdown of the VM.
*
*/
public void shutdown(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationPartiallyFailed {
String method_call = "VM_appliance.shutdown";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Assert whether all SRs required to recover this VM appliance are available.
*
* @param sessionTo The session to which the VM appliance is to be recovered.
* @return Task
*/
public Task assertCanBeRecoveredAsync(Connection c, Session sessionTo) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmRequiresSr {
String method_call = "Async.VM_appliance.assert_can_be_recovered";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Assert whether all SRs required to recover this VM appliance are available.
*
* @param sessionTo The session to which the VM appliance is to be recovered.
*/
public void assertCanBeRecovered(Connection c, Session sessionTo) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmRequiresSr {
String method_call = "VM_appliance.assert_can_be_recovered";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Recover the VM appliance
*
* @param sessionTo The session to which the VM appliance is to be recovered.
* @param force Whether the VMs should replace newer versions of themselves.
* @return Task
*/
public Task recoverAsync(Connection c, Session sessionTo, Boolean force) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmRequiresSr {
String method_call = "Async.VM_appliance.recover";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
/**
* Recover the VM appliance
*
* @param sessionTo The session to which the VM appliance is to be recovered.
* @param force Whether the VMs should replace newer versions of themselves.
*/
public void recover(Connection c, Session sessionTo, Boolean force) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.VmRequiresSr {
String method_call = "VM_appliance.recover";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(sessionTo), Marshalling.toXMLRPC(force)};
Map response = c.dispatch(method_call, method_params);
return;
}
/**
* Return a list of all the VM_appliances known to the system.
*
* @return references to all objects
*/
public static Set<VMAppliance> getAll(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_all";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toSetOfVMAppliance(result);
}
/**
* Return a map of VM_appliance references to VM_appliance records for all VM_appliances known to the system.
*
* @return records of all objects
*/
public static Map<VMAppliance, VMAppliance.Record> getAllRecords(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException {
String method_call = "VM_appliance.get_all_records";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toMapOfVMApplianceVMApplianceRecord(result);
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VMGuestMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VMGuestMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -479,4 +484,4 @@ public class VMGuestMetrics extends XenAPIObject {
return Types.toMapOfVMGuestMetricsVMGuestMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VMMetrics extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VMMetrics extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -502,4 +507,4 @@ public class VMMetrics extends XenAPIObject {
return Types.toMapOfVMMetricsVMMetricsRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VMPP extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VMPP extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -155,7 +160,7 @@ public class VMPP extends XenAPIObject {
*/
public String nameLabel;
/**
* a notes field containg human-readable description
* a notes field containing human-readable description
*/
public String nameDescription;
/**
@ -809,7 +814,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -841,7 +846,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -873,7 +878,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -905,7 +910,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -937,7 +942,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -953,7 +958,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to add
* @param value the value to add
@ -970,7 +975,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to add
* @param value the value to add
@ -987,7 +992,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to add
* @param value the value to add
@ -1004,7 +1009,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to add
* @param value the value to add
@ -1021,7 +1026,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to remove
*/
@ -1037,7 +1042,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to remove
*/
@ -1053,7 +1058,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to remove
*/
@ -1069,7 +1074,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param key the key to remove
*/
@ -1085,7 +1090,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -1101,7 +1106,7 @@ public class VMPP extends XenAPIObject {
}
/**
*
*
*
* @param value the value to set
*/
@ -1150,4 +1155,4 @@ public class VMPP extends XenAPIObject {
return Types.toMapOfVMPPVMPPRecord(result);
}
}
}

View File

@ -1,18 +1,19 @@
/* Copyright (c) Citrix Systems, Inc.
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@ -27,6 +28,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.xensource.xenapi;
import com.xensource.xenapi.Types.BadServerResponse;
@ -51,7 +53,7 @@ import org.apache.xmlrpc.XmlRpcException;
public class VTPM extends XenAPIObject {
/**
* The XenAPI reference to this object.
* The XenAPI reference (OpaqueRef) to this object.
*/
protected final String ref;
@ -62,6 +64,9 @@ public class VTPM extends XenAPIObject {
this.ref = ref;
}
/**
* @return The XenAPI reference (OpaqueRef) to this object.
*/
public String toWireString() {
return this.ref;
}
@ -282,4 +287,4 @@ public class VTPM extends XenAPIObject {
return Types.toVM(result);
}
}
}

View File

@ -1,18 +1,18 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

Some files were not shown because too many files have changed in this diff Show More