mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7868: Failed storage.PrimaryStorageDownloadCommand leaves corrupt VDIs in primary storage.
This commit is contained in:
parent
a275bd7ca4
commit
6a6d4d876f
@ -2744,6 +2744,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||||||
try {
|
try {
|
||||||
vdi.destroy(conn);
|
vdi.destroy(conn);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
String msg = "Failed to destroy VDI : " + nameLabel + "due to " + e.toString() + "\n Force deleting VDI using system 'rm' command";
|
||||||
|
s_logger.warn(msg);
|
||||||
|
try {
|
||||||
|
String srUUID = vdi.getSR(conn).getUuid(conn);
|
||||||
|
String vdiUUID = vdi.getUuid(conn);
|
||||||
|
String vdifile = "/var/run/sr-mount/" + srUUID + "/" + vdiUUID + ".vhd";
|
||||||
|
String results = callHostPluginAsync(conn, "vmopspremium", "remove_corrupt_vdi", 10, "vdifile", vdifile);
|
||||||
|
} catch (Exception e2) {
|
||||||
|
s_logger.warn(e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -100,6 +100,16 @@ def copy_vhd_from_secondarystorage(session, args):
|
|||||||
txt = '10#failed'
|
txt = '10#failed'
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
@echo
|
||||||
|
def remove_corrupt_vdi(session, args):
|
||||||
|
vdifile = args['vdifile']
|
||||||
|
try:
|
||||||
|
cmd = ['rm', '-f', vdifile]
|
||||||
|
txt = util.pread2(cmd)
|
||||||
|
except:
|
||||||
|
txt = '10#failed'
|
||||||
|
return txt
|
||||||
|
|
||||||
@echo
|
@echo
|
||||||
def setup_heartbeat_sr(session, args):
|
def setup_heartbeat_sr(session, args):
|
||||||
host = args['host']
|
host = args['host']
|
||||||
@ -146,4 +156,4 @@ def asmonitor(session, args):
|
|||||||
return 'fail'
|
return 'fail'
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor})
|
XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor, "remove_corrupt_vdi": remove_corrupt_vdi})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user