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 @@ -125,6 +125,7 @@
import org.libvirt.DomainInfo.DomainState;
import org.libvirt.DomainInterfaceStats;
import org.libvirt.DomainSnapshot;
import org.libvirt.Error;
import org.libvirt.LibvirtException;
import org.libvirt.MemoryStatistic;
import org.libvirt.Network;
Expand Down Expand Up @@ -610,8 +611,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv

public static final String CGROUP_V2 = "cgroup2fs";

public static final String AGENT_IS_NOT_CONNECTED = "QEMU guest agent is not connected";

public static final org.libvirt.Error.ErrorNumber AGENT_UNRESPONSIVE_ERROR = Error.ErrorNumber.VIR_ERR_AGENT_UNRESPONSIVE;
/**
* Virsh command to merge (blockcommit) snapshot into the base file.<br><br>
* 1st parameter: VM's name;<br>
Expand Down Expand Up @@ -7185,7 +7185,7 @@ public Map<String, Long> createDiskOnlyVmSnapshotForRunningVm(List<Pair<VolumeOb
} catch (LibvirtException e) {
String errorMsg = String.format("Creation of disk-only VM snapshot for VM [%s] failed due to %s.", vmName, e.getMessage());
boolean isVmConsistent = false;
if (e.getMessage().contains(AGENT_IS_NOT_CONNECTED)) {
if (isGuestAgentUnresponsive(e)) {
errorMsg = "QEMU guest agent is not connected. If the VM has been recently started, it might connect soon. Otherwise the VM does not have the" +
" guest agent installed; thus the QuiesceVM parameter is not supported.";
isVmConsistent = true;
Expand All @@ -7203,6 +7203,10 @@ public Map<String, Long> createDiskOnlyVmSnapshotForRunningVm(List<Pair<VolumeOb
}
}

public static boolean isGuestAgentUnresponsive(LibvirtException e) {
return AGENT_UNRESPONSIVE_ERROR.equals(e.getError().getCode());
}

public Map<String, Long> createDiskOnlyVMSnapshotOfStoppedVm(List<Pair<VolumeObjectTO, String>> volumeTosAndNewPaths, String vmName) {
logger.info("Creating volume deltas for stopped VM [{}].", vmName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private boolean waitForBoot(ValidateKbossVmCommand cmd, Domain vm) throws Libvir
return true;
}
} catch (LibvirtException ex) {
if (!ex.getMessage().contains(LibvirtComputingResource.AGENT_IS_NOT_CONNECTED)) {
if (!LibvirtComputingResource.isGuestAgentUnresponsive(ex)) {
logger.error("Got an unexpected Libvirt Exception, giving up on validating VM [{}].", vm.getName(), ex);
throw ex;
}
Expand Down
Loading