Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.
package com.cloud.hypervisor.kvm.resource;

import java.io.File;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -64,34 +63,18 @@ public String getPoolUUID() {
return poolUuid;
}

public void setPoolUUID(String poolUuid) {
this.poolUuid = poolUuid;
}

public String getPoolIp() {
return poolIp;
}

public void setPoolIp(String poolIp) {
this.poolIp = poolIp;
}

public String getPoolMountSourcePath() {
return poolMountSourcePath;
}

public void setPoolMountSourcePath(String poolMountSourcePath) {
this.poolMountSourcePath = poolMountSourcePath;
}

public String getMountDestPath() {
return mountDestPath;
}

public void setMountDestPath(String mountDestPath) {
this.mountDestPath = mountDestPath;
}

public PoolType getType() {
return poolType;
}
Expand Down Expand Up @@ -202,35 +185,6 @@ protected void destroyVMs(String mountPath) {
}
}

protected String getHBFile(String mountPoint, String hostIP) {
return mountPoint + File.separator + "KVMHA" + File.separator + "hb-" + hostIP;
}

protected String getHBFolder(String mountPoint) {
return mountPoint + File.separator + "KVMHA" + File.separator;
}

protected String runScriptRetry(String cmdString, OutputInterpreter interpreter) {
String result = null;
for (int i = 0; i < 3; i++) {
Script cmd = new Script("/bin/bash", _timeout);
cmd.add("-c");
cmd.add(cmdString);
if (interpreter != null)
result = cmd.execute(interpreter);
else {
result = cmd.execute();
}
if (result == Script.ERR_TIMEOUT) {
continue;
} else if (result == null) {
break;
}
}

return result;
}

public Boolean hasHeartBeat() {
// TODO Auto-generated method stub
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -256,7 +255,6 @@
import com.cloud.vm.VirtualMachine.PowerState;
import com.cloud.vm.VmDetailConstants;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -440,7 +438,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private String setupTungstenVrouterPath;
private String updateTungstenLoadbalancerStatsPath;
private String updateTungstenLoadbalancerSslPath;
private String host;

private String dcId;
private String clusterId;
Expand Down Expand Up @@ -600,7 +597,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv

private boolean isReconcileCommandsEnabled = false;

private static Gson gson = new Gson();

/**
* Virsh command to set the memory balloon stats period.<br><br>
Expand Down Expand Up @@ -2325,19 +2321,6 @@ protected Long getJsonLongValueOrNull(JsonObject jsonObject, String fieldName) {
return element.getAsLong();
}

boolean isDirectAttachedNetwork(final String type) {
if ("untagged".equalsIgnoreCase(type)) {
return true;
} else {
try {
Long.valueOf(type);
} catch (final NumberFormatException e) {
return true;
}
return false;
}
}

public String startVM(final Connect conn, final String vmName, final String domainXML) throws LibvirtException, InternalErrorException {
return startVM(conn, vmName, domainXML, 0);
}
Expand Down Expand Up @@ -2761,7 +2744,6 @@ protected ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand c
conn = getLibvirtUtilitiesHelper().getConnectionByVmName(routerName);
Pair<Map<String, Integer>, Integer> macAddressToNicNumPair = getMacAddressToNicNumPair(conn, routerName);
final Map<String, Integer> macAddressToNicNum = macAddressToNicNumPair.first();
Integer devNum = macAddressToNicNumPair.second();

final IpAddressTO[] ips = cmd.getIpAddresses();
for (final IpAddressTO ip : ips) {
Expand Down Expand Up @@ -4131,10 +4113,6 @@ public boolean cleanupDisk(final DiskDef disk) {
return storagePoolManager.disconnectPhysicalDiskByPath(path);
}

protected KVMStoragePoolManager getPoolManager() {
return storagePoolManager;
}

public void detachAndAttachConfigDriveISO(final Connect conn, final String vmName) {
// detach and re-attach configdrive ISO
List<DiskDef> disks = getDisks(conn, vmName);
Expand Down Expand Up @@ -4978,14 +4956,6 @@ boolean isGuestPVEnabled(final String guestOSName) {
return db != DiskDef.DiskBus.IDE;
}

public boolean isCentosHost() {
if (hvVersion <= 9) {
return true;
} else {
return false;
}
}

public DiskDef.DiskBus getDiskModelFromVMDetail(final VirtualMachineTO vmTO) {
Map<String, String> details = vmTO.getDetails();
if (details == null) {
Expand Down Expand Up @@ -5106,10 +5076,6 @@ public List<DiskDef> getDisks(final Connect conn, final String vmName) {
}
}

private String executeBashScript(final String script) {
return createScript(script).execute();
}

private Script createScript(final String script) {
final Script command = new Script("/bin/bash", timeout, LOGGER);
command.add("-c");
Expand Down Expand Up @@ -5632,7 +5598,6 @@ public boolean destroyNetworkRulesForNic(final Connect conn, final String vmName
}

final InterfaceDef intf = intfs.get(nic.getDeviceId());
final String brname = intf.getBrName();
final String vif = intf.getDevName();

final Script cmd = new Script(securityGroupPath, timeout, LOGGER);
Expand Down Expand Up @@ -5753,41 +5718,6 @@ public boolean defaultNetworkRules(final Connect conn, final String vmName, fina
return true;
}

protected boolean post_default_network_rules(final Connect conn, final String vmName, final NicTO nic, final Long vmId, final InetAddress dhcpServerIp, final String hostIp, final String hostMacAddr) {
if (!canBridgeFirewall) {
return false;
}

final List<InterfaceDef> intfs = getInterfaces(conn, vmName);
if (intfs.size() < nic.getDeviceId()) {
return false;
}

final InterfaceDef intf = intfs.get(nic.getDeviceId());
final String brname = intf.getBrName();
final String vif = intf.getDevName();

final Script cmd = new Script(securityGroupPath, timeout, LOGGER);
cmd.add("post_default_network_rules");
cmd.add("--vmname", vmName);
cmd.add("--vmid", vmId.toString());
cmd.add("--vmip", nic.getIp());
cmd.add("--vmmac", nic.getMac());
cmd.add("--vif", vif);
cmd.add("--brname", brname);
if (dhcpServerIp != null) {
cmd.add("--dhcpSvr", dhcpServerIp.getHostAddress());
}

cmd.add("--hostIp", hostIp);
cmd.add("--hostMacAddr", hostMacAddr);
final String result = cmd.execute();
if (result != null) {
return false;
}
return true;
}

public boolean configureDefaultNetworkRulesForSystemVm(final Connect conn, final String vmName) {
if (!canBridgeFirewall) {
return false;
Expand Down Expand Up @@ -6023,16 +5953,6 @@ private HashMap<String, Pair<Long, Long>> syncNetworkGroups(final long id) {
return states;
}

/* online snapshot supported by enhanced qemu-kvm */
private boolean isSnapshotSupported() {
final String result = executeBashScript("qemu-img --help|grep convert");
if (result != null) {
return false;
} else {
return true;
}
}

public Pair<Double, Double> getNicStats(final String nicName) {
return new Pair<Double, Double>(readDouble(nicName, "rx_bytes"), readDouble(nicName, "tx_bytes"));
}
Expand Down Expand Up @@ -6196,10 +6116,6 @@ public void restoreVMSnapshotMetadata(Domain dm, String vmName, List<Ternary<Str
}
}

public String getHostDistro() {
return hostDistro;
}

public boolean isHostSecured() {
// Test for host certificates
final File confFile = PropertiesUtil.findConfigFile(KeyStoreUtils.AGENT_PROPSFILE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class LibvirtConnection {
protected static Logger LOGGER = LogManager.getLogger(LibvirtConnection.class);
static private Map<String, Connect> s_connections = new HashMap<String, Connect>();

static private Connect s_connection;
static private String s_hypervisorURI;
static private Thread libvirtEventThread;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public LibvirtSecretDef(Usage usage, String uuid, String description) {
_description = description;
}

public boolean getEphemeral() {
return _ephemeral;
}

public void setEphemeral(boolean ephemeral) { _ephemeral = ephemeral; }

public boolean getPrivate() {
Expand All @@ -71,14 +67,6 @@ public String getDescription() {
return _description;
}

public String getVolumeVolume() {
return _volumeVolume;
}

public String getCephName() {
return _cephName;
}

public void setVolumeVolume(String volume) {
_volumeVolume = volume;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,6 @@ public LibvirtStorageVolumeDef parseStorageVolumeXML(String volXML) {
return null;
}

public String getBackingFileNameIfExists(String volXML) {
try {
DocumentBuilder builder = ParserUtils.getSaferDocumentBuilderFactory().newDocumentBuilder();

InputSource is = new InputSource();
is.setCharacterStream(new StringReader(volXML));
Document doc = builder.parse(is);

Element rootElement = doc.getDocumentElement();
Element backingStore = (Element)rootElement.getElementsByTagName("backingStore").item(0);
if (backingStore != null) {
String[] paths = getTagValue("path", backingStore).split("/");
return paths[paths.length-1];
}
} catch (ParserConfigurationException | SAXException | IOException e) {
logger.error(e.toString(), e);
}
return null;
}

private static String getTagValue(String tag, Element eElement) {
NodeList nlList = eElement.getElementsByTagName(tag).item(0).getChildNodes();
Node nValue = nlList.item(0);
Expand Down
Loading
Loading