本文整理汇总了Java中com.xensource.xenapi.Types.BadServerResponse类的典型用法代码示例。如果您正苦于以下问题:Java BadServerResponse类的具体用法?Java BadServerResponse怎么用?Java BadServerResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BadServerResponse类属于com.xensource.xenapi.Types包,在下文中一共展示了BadServerResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSRByNameLabelandHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected SR getSRByNameLabelandHost(final Connection conn, final String name)
throws BadServerResponse, XenAPIException, XmlRpcException {
final Set<SR> srs = SR.getByNameLabel(conn, name);
SR ressr = null;
for (final SR sr : srs) {
final Set<PBD> pbds;
pbds = sr.getPBDs(conn);
for (final PBD pbd : pbds) {
final PBD.Record pbdr = pbd.getRecord(conn);
if (pbdr.host != null && pbdr.host.getUuid(conn).equals(_host.getUuid())) {
if (!pbdr.currentlyAttached) {
pbd.plug(conn);
}
ressr = sr;
break;
}
}
}
return ressr;
}
示例2: getSRByNameLabel
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected SR getSRByNameLabel(final Connection conn, final String name)
throws BadServerResponse, XenAPIException, XmlRpcException {
final Set<SR> srs = SR.getByNameLabel(conn, name);
SR ressr = null;
for (final SR sr : srs) {
final Set<PBD> pbds;
pbds = sr.getPBDs(conn);
for (final PBD pbd : pbds) {
final PBD.Record pbdr = pbd.getRecord(conn);
if (pbdr.host != null) {
ressr = sr;
break;
}
}
}
return ressr;
}
示例3: getSRByNameLabelandHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected SR getSRByNameLabelandHost(final Connection conn, final String name) throws BadServerResponse, XenAPIException, XmlRpcException {
final Set<SR> srs = SR.getByNameLabel(conn, name);
SR ressr = null;
for (final SR sr : srs) {
Set<PBD> pbds;
pbds = sr.getPBDs(conn);
for (final PBD pbd : pbds) {
final PBD.Record pbdr = pbd.getRecord(conn);
if (pbdr.host != null && pbdr.host.getUuid(conn).equals(_host.getUuid())) {
if (!pbdr.currentlyAttached) {
pbd.plug(conn);
}
ressr = sr;
break;
}
}
}
return ressr;
}
示例4: getSRByNameLabel
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected SR getSRByNameLabel(Connection conn, String name) throws BadServerResponse, XenAPIException, XmlRpcException {
Set<SR> srs = SR.getByNameLabel(conn, name);
SR ressr = null;
for (SR sr : srs) {
Set<PBD> pbds;
pbds = sr.getPBDs(conn);
for (PBD pbd : pbds) {
PBD.Record pbdr = pbd.getRecord(conn);
if (pbdr.host != null) {
ressr = sr;
break;
}
}
}
return ressr;
}
示例5: getSRByNameLabel
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected SR getSRByNameLabel(final Connection conn, final String nameLabel) throws BadServerResponse, XenAPIException, XmlRpcException {
final Set<SR> srs = SR.getByNameLabel(conn, nameLabel);
if (srs.size() != 1) {
throw new CloudRuntimeException("storage uuid: " + nameLabel + " is not unique");
}
final SR poolsr = srs.iterator().next();
return poolsr;
}
示例6: createVdi
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected VDI createVdi(final Connection conn, final String vdiName, final SR sr, final long size) throws BadServerResponse, XenAPIException, XmlRpcException {
final VDI.Record vdir = new VDI.Record();
vdir.nameLabel = vdiName;
vdir.SR = sr;
vdir.type = Types.VdiType.USER;
vdir.virtualSize = size;
final VDI vdi = VDI.create(conn, vdir);
return vdi;
}
示例7: changeMasterIfNeeded
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* If the pool has more than one host and the
* host to be powered off is the master, it changes the master using
* {@link #changePoolMasterHost(Connection, String)}.
*/
protected void changeMasterIfNeeded(Connection conn, Host master, String hostUuid)
throws BadServerResponse, XenAPIException, XmlRpcException {
if (hostUuid.equals(master.getUuid(conn)) && !isLastHostOnPool(conn)) {
changePoolMasterHost(conn, hostUuid);
waitChangePoolMasterHost(master, conn, hostUuid);
}
}
示例8: getMasterHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* Returns the {@link Host} that is the current master of this pool.
*/
protected Host getMasterHost(Connection conn) throws BadServerResponse, XenAPIException, XmlRpcException {
Iterator<Pool> poolIterator = Pool.getAll(conn).iterator();
if (poolIterator.hasNext()) {
return poolIterator.next().getMaster(conn);
}
throw new CloudRuntimeException("Could not find master server for pool.");
}
示例9: changePoolMasterHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* The new master will be selected with no specific criteria.
*/
protected void changePoolMasterHost(Connection conn, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException {
for (Host host : Host.getAll(conn)) {
if (hostUuid.equals(host.getUuid(conn))) {
continue;
}
if (hostUtils.isHostReachable(host.getAddress(conn))) {
Pool.designateNewMaster(conn, host);
return;
}
}
}
示例10: waitChangePoolMasterHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* Waits until the master of the pool changes, given a total of 90 tries,
* each taking 3 seconds of wait.
*/
protected void waitChangePoolMasterHost(Host master, Connection conn, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException {
int count = 0;
while (hostUuid.equals(master.getUuid(conn))) {
threadUtils.sleepThread(3);
count++;
if (count > 90) {
throw new CloudRuntimeException(String.format("Could not shut down host [uuid=%s]; It was not possible to assign a new master to its pool", hostUuid));
}
}
}
示例11: actualIsoTemplate
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
private String actualIsoTemplate(final Connection conn) throws BadServerResponse, XenAPIException, XmlRpcException {
final Host host = Host.getByUuid(conn, _host.getUuid());
final Host.Record record = host.getRecord(conn);
final String xenBrand = record.softwareVersion.get("product_brand");
final String xenVersion = record.softwareVersion.get("product_version");
final String[] items = xenVersion.split("\\.");
// guest-tools.iso for XenServer version 7.0+
if (xenBrand.equals("XenServer") && Integer.parseInt(items[0]) >= 7) {
return "guest-tools.iso";
}
// xs-tools.iso for older XenServer versions
return "xs-tools.iso";
}
示例12: setNicDevIdIfCorrectVifIsNotNull
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected void setNicDevIdIfCorrectVifIsNotNull(final Connection conn, final IpAddressTO ip, final VIF correctVif) throws InternalErrorException, BadServerResponse,
XenAPIException, XmlRpcException {
if (correctVif == null) {
if (ip.isAdd()) {
throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
} else {
s_logger.debug("VIF to deassociate IP with does not exist, return success");
}
} else {
ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
}
}
示例13: deleteVDI
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
protected void deleteVDI(final Connection conn, final VDI vdi) throws BadServerResponse, XenAPIException, XmlRpcException {
vdi.destroy(conn);
}
示例14: disableAndShutdownHost
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* It disables the host (using {@link Host#disable(Connection)}) and shuts it down
* using the {@link Host#shutdown(Connection)} method.
*/
protected void disableAndShutdownHost(Connection conn, Host host) throws BadServerResponse, XenAPIException, XmlRpcException {
host.disable(conn);
host.shutdown(conn);
}
示例15: isLastHostOnPool
import com.xensource.xenapi.Types.BadServerResponse; //导入依赖的package包/类
/**
* Returns true if the pool has exactly one {@link Host}.
*/
protected boolean isLastHostOnPool(Connection conn) throws BadServerResponse, XenAPIException, XmlRpcException {
return Host.getAll(conn).size() == 1;
}