diff --git a/tools/virsh.c b/tools/virsh.c index 62581f6b39..3da8bc5288 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -12869,6 +12869,10 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) virDomainSnapshotFree(snapshot); snapshot = NULL; + /* strstr is safe here, since xml came from libvirt API and not user */ + if (strstr(doc, "disk-snapshot")) + define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; + /* Create and open the temporary file. */ tmp = editWriteToTempFile(ctl, doc); if (!tmp) @@ -12978,6 +12982,9 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) xml = virDomainSnapshotGetXMLDesc(snapshot, VIR_DOMAIN_XML_SECURE); if (!xml) goto cleanup; + /* strstr is safe here, since xml came from libvirt API and not user */ + if (strstr(xml, "disk-snapshot")) + flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; snapshot2 = virDomainSnapshotCreateXML(dom, xml, flags); if (snapshot2 == NULL) goto cleanup;