a
This commit is contained in:
		
					parent
					
						
							
								495fce8782
							
						
					
				
			
			
				commit
				
					
						4b95acc96c
					
				
			
		
					 1 changed files with 3 additions and 4 deletions
				
			
		
							
								
								
									
										7
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								main.py
									
										
									
									
									
								
							| 
						 | 
					@ -6,9 +6,9 @@ from config import logging, client, BASE_PATH, WITHOUT_CEPH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# If you are using WITHOUT_CEPH FLAG in .env
 | 
					# If you are using WITHOUT_CEPH FLAG in .env
 | 
				
			||||||
# then please make sure that /var/vm directory
 | 
					# then please make sure that /var/image directory
 | 
				
			||||||
# exists otherwise this script would fail
 | 
					# exists otherwise this script would fail
 | 
				
			||||||
if WITHOUT_CEPH and not os.path.isdir("/var/vm"):
 | 
					if WITHOUT_CEPH and not os.path.isdir("/var/image"):
 | 
				
			||||||
    exit(1)
 | 
					    exit(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ for image in images_to_be_created:
 | 
				
			||||||
        snapshot_protect_command = ["rbd", "snap", "protect", f"{image_store_pool}/{image_uuid}@protected"]
 | 
					        snapshot_protect_command = ["rbd", "snap", "protect", f"{image_store_pool}/{image_uuid}@protected"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if WITHOUT_CEPH:
 | 
					        if WITHOUT_CEPH:
 | 
				
			||||||
            image_import_command = ["mv", "image.raw", os.path.join("/var/vm", image_uuid)]
 | 
					            image_import_command = ["mv", "image.raw", os.path.join("/var/image", image_uuid)]
 | 
				
			||||||
            snapshot_creation_command = ["true"]
 | 
					            snapshot_creation_command = ["true"]
 | 
				
			||||||
            snapshot_protect_command = ["true"]
 | 
					            snapshot_protect_command = ["true"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,6 @@ for image in images_to_be_created:
 | 
				
			||||||
                    try:
 | 
					                    try:
 | 
				
			||||||
                        # Convert .qcow2 to .raw
 | 
					                        # Convert .qcow2 to .raw
 | 
				
			||||||
                        subprocess.check_output(qemu_img_convert_command)
 | 
					                        subprocess.check_output(qemu_img_convert_command)
 | 
				
			||||||
                        print("converting")
 | 
					 | 
				
			||||||
                    except Exception as e:
 | 
					                    except Exception as e:
 | 
				
			||||||
                        logging.exception(e)
 | 
					                        logging.exception(e)
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue